Delete .shellcheckrc (#1947)

* CI: disable Ubuntu 16.04 as it's EOL

https://github.blog/changelog/2021-04-29-github-actions-ubuntu-16-04-lts-virtual-environment-will-be-removed-on-september-20-2021/

* main: lint false positive

* install: lint

* plugins/cmd-returned-notify: don't `export`

* plugins/xterm: lint

* plugins/git: lint

* plugins/goenv: lint

* plugins/alias-completion: lint false positives

* plugins/alias-completion: fix SC2155, SC2154

Declare `locals` at the top of the function

* completion: lint completions using `bash_completion` functions

Match the style of the existing code

* completion/knife: lint false positives

* completion/knife: lint

* completion/sdkman: lint

* completion/composer: lint

* Move `.shellcheckrc` under `themes/`

* lib/theme: fix SC2155, SC2154, SC2034

* lib/colors: don't warn on unused variables

We assign a large number of variables here and they may or may not be used anywhere else, so disable SC2034 for this file (only).

Alsö disable SC2005 as the functions in this file were written before `printf` was invented and have to do some fancy metascripting to get escape sequences interpreted reliably. I’m not smart enough to fix this to use `printf`, so leave it for now.

* themes/agnoster: lint

* themes: disable SC2154 for colors

Each one of these themes will need it’s own fix for SC2154, possibly upstream.

Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules.

* themes: disable SC2154, fix SC2155

Each one of these themes will need it’s own fix for SC2154, possibly upstream.

Due to the way themes are, it's entirely normal to have a *lot* of false positives for SC2034. So much so, that I have to admit that it is probably just not worth linting for SC2034 despite my dislike of blanket ignore rules.

* Delete `.shellcheckrc`

* remove executable bit
This commit is contained in:
John D Pell
2021-09-18 02:50:59 -07:00
committed by GitHub
parent b48f3fd7d3
commit 1c3cbf7ca6
44 changed files with 183 additions and 126 deletions

View File

@@ -1,4 +1,7 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
# Define this here so it can be used by all of the Powerline themes
THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true}
@@ -139,7 +142,7 @@ function __powerline_scm_prompt() {
}
function __powerline_cwd_prompt() {
local cwd=$(pwd | sed "s|^${HOME}|~|")
local cwd="${PWD/$HOME/\~}"
echo "${cwd}|${CWD_THEME_PROMPT_COLOR}"
}
@@ -157,10 +160,10 @@ function __powerline_clock_prompt() {
}
function __powerline_battery_prompt() {
local color=""
local battery_status="$(battery_percentage 2> /dev/null)"
local color="" battery_status
battery_status="$(battery_percentage 2> /dev/null)"
if [[ -z "${battery_status}" ]] || [[ "${battery_status}" = "-1" ]] || [[ "${battery_status}" = "no" ]]; then
if [[ -z "${battery_status}" || "${battery_status}" == "-1" || "${battery_status}" == "no" ]]; then
true
else
if [[ "$((10#${battery_status}))" -le 5 ]]; then
@@ -176,7 +179,7 @@ function __powerline_battery_prompt() {
}
function __powerline_in_vim_prompt() {
if [ -n "$VIMRUNTIME" ]; then
if [[ -n "$VIMRUNTIME" ]]; then
echo "${IN_VIM_THEME_PROMPT_TEXT}|${IN_VIM_THEME_PROMPT_COLOR}"
fi
}
@@ -221,7 +224,8 @@ function __powerline_command_number_prompt() {
}
function __powerline_duration_prompt() {
local duration=$(_command_duration)
local duration
duration=$(_command_duration)
[[ -n "$duration" ]] && echo "${duration}|${COMMAND_DURATION_PROMPT_COLOR}"
}
@@ -265,7 +269,7 @@ function __powerline_last_status_prompt() {
function __powerline_prompt_command() {
local last_status="$?" ## always the first
local separator_char="${POWERLINE_PROMPT_CHAR}"
local separator_char="${POWERLINE_PROMPT_CHAR}" info prompt_color
LEFT_PROMPT=""
SEGMENTS_AT_LEFT=0
@@ -277,7 +281,7 @@ function __powerline_prompt_command() {
## left prompt ##
for segment in $POWERLINE_PROMPT; do
local info="$(__powerline_"${segment}"_prompt)"
info="$(__powerline_"${segment}"_prompt)"
[[ -n "${info}" ]] && __powerline_left_segment "${info}"
done
@@ -289,7 +293,7 @@ function __powerline_prompt_command() {
# By default we try to match the prompt to the adjacent segment's background color,
# but when part of the prompt exists within that segment, we instead match the foreground color.
local prompt_color="$(set_color "${LAST_SEGMENT_COLOR}" -)"
prompt_color="$(set_color "${LAST_SEGMENT_COLOR}" -)"
if [[ -n "${LEFT_PROMPT}" ]] && [[ -n "${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}" ]]; then
LEFT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR}")${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}"
prompt_color="${normal}"

View File

@@ -1,4 +1,5 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck source=../../themes/powerline/powerline.base.bash
. "$BASH_IT/themes/powerline/powerline.base.bash"