rc lint: Address code-review comments.

This commit is contained in:
Tim Allen 2020-02-09 13:23:58 +11:00
parent 51fcea7ce0
commit 673d081823

View File

@ -115,8 +115,9 @@ define-command \
done done
# Load all the linter messages into Kakoune options. # Load all the linter messages into Kakoune options.
# Yes, shellcheck, we do want line-continuation backslashes # shellcheck warns us that the shell doesn't need
# inside the string. # backslash-continuation chars in a single-quoted string,
# but awk still needs them.
# shellcheck disable=SC1004 # shellcheck disable=SC1004
awk -v file="$kak_buffile" -v client="$kak_client" ' awk -v file="$kak_buffile" -v client="$kak_client" '
function kakquote(text) { function kakquote(text) {
@ -160,10 +161,9 @@ define-command \
# so that information is not lost. # so that information is not lost.
msg = msg "(col " $3 ")" msg = msg "(col " $3 ")"
# FIXME: I *think* this line is left over from a time # Messages will be stored in a line-specs option,
# when Kakoune used pipes to delimit items in a list # and each record in the option uses "|"
# option. If so, it is entirely useless now... but I # as a field delimiter, so we need to escape them.
# am not 100% sure.
gsub(/\|/, "\\|", msg) gsub(/\|/, "\\|", msg)
if ($2 in messages_by_line) { if ($2 in messages_by_line) {
@ -282,7 +282,7 @@ define-command \
lintcmd="$kak_opt_lintcmd" lintcmd="$kak_opt_lintcmd"
fi fi
printf '%s\n' "lint-cleaned-selections $(kakquote "$lintcmd")" printf 'lint-cleaned-selections %s\n' "$(kakquote "$lintcmd")"
} }
} }
} }
@ -380,10 +380,6 @@ define-command \
} }
} }
# lint-next-message was previously known as lint-next-error,
# but it includes warnings too, not just errors.
alias global lint-next-error lint-next-message
# FIXME: Is there some way we can re-use make-previous-error # FIXME: Is there some way we can re-use make-previous-error
# instead of re-implementing it? # instead of re-implementing it?
define-command \ define-command \
@ -422,7 +418,3 @@ define-command \
# FIXME: should we wrap around like make-previous-error? # FIXME: should we wrap around like make-previous-error?
} }
} }
# lint-previous-message was previously known as lint-previous-error,
# but it includes warnings too, not just errors.
alias global lint-previous-error lint-previous-message