Conversation
This also makes it easier to exclude files, you just put the paths space separated, without any regex in `filter_out`. Also add files to general exceptions and for specific checks.
|
Some codes are contained in code comments. Some of them explain wrong codes intentionally (which should anyway be excluded), but some valid codes might also be contained in code comments for descriptions. I'm unsure if we should skip such embedded codes for linting. Maybe OK? Or can we instead check the previous word to see whether it is a valid context for a command name? Most of the false positives in code comments are in the English description, where the previous word does not introduce a command context. The previous-word check should also be useful to reduce the false positives outside the code comments. Also, I've been recently thinking that we may remove the restriction on the use of here strings and documents. The temporary files are also used by the function/value substitutions ( |
These are false positives found by runLint. These are harmless but can be updated not to be captured as false positive. * The command list for _comp_complete_longopt has not been properly folded at column 79. We can update the line breaking. As a result, "grep" does not appear at the beginning of the line, which is accidental but fine. * Prefixing "command" should be harmless because "command" is POSIX.
I removed the check for here strings in commit 0807337.
I added a change in --- a.txt 2026-03-08 23:01:16.794864360 +0900
+++ b.txt 2026-03-08 23:01:27.867875611 +0900
@@ -8,33 +8,15 @@
***** invoke grep, ls, sed, and cd through "command", e.g. "command grep"
bash_completion:3235: grep grub head irb ld ldd less ln ls m4 mkdir mkfifo mknod \
-bash_completion:3237: readlink realpath rm rmdir sed seq shar shred \
-bash_completion.d/000_bash_completion_compat.bash:277: declare -F _comp_cmd_cd &>/dev/null || __load_completion cd
completions-core/Makefile.am:848: $(ss) cd \
completions-core/ccze.bash:33: sed -ne 's/^\([a-z0-9]\{1,\}\)[[:space:]]\{1,\}|.*/\1/p')"
-completions-core/cd.bash:77: _comp_compgen -ai cd cdpath
-completions-core/cd.bash:80:complete -F _comp_cmd_cd -o nospace cd pushd
-completions-core/mdadm.bash:47: right-asymmetric right-symmetric la ra ls rs'
-completions-core/svk.bash:12: describe desc diff di help h ? import info list ls log merge mirror mi
-completions-fallback/svn.bash:14: info list ls lock log merge mkdir move mv rename ren \
-test/t/test_grep.py:14: Not really a grep option, but tests _comp_complete_longopt.
-test/t/test_grep.py:23: Not really a grep specific, but good to test somewhere.
test/t/test_help.py:15: skipif="! compgen -A helptopic | grep -qxF '(( ... ))'", # bash 4.2
test/t/test_ip.py:43: skipif="ip neigh help 2>&1 | grep 'STATE :=' > /dev/null; (( $? != 0 ))",
-test/t/test_ls.py:12: "ls --", require_cmd=True, xfail="! ls --help &>/dev/null"
test/t/test_man.py:21: assert_bash_exec(bash, "uname -s 2>&1 | grep -qiF cygwin")
-test/t/test_modinfo.py:14: xfail="! ls /lib/modules/%s &>/dev/null"
-test/t/test_modprobe.py:14: xfail="! ls /lib/modules/%s &>/dev/null"
-test/t/test_sudo.py:11: @pytest.mark.complete("sudo cd foo", cwd="shared/default")
-test/t/unit/test_unit_quote_compgen.py:76: $ ls -- '${[TAB]
test/update-test-cmd-list:5: cd "$(dirname "$0")"
test/update-test-cmd-list:11: grep -Eo '@pytest.mark.complete\(([^)]*\<require_(cmd|longopt) *= *True\>[^)]*)\)' |
test/update-test-cmd-list:12: sed -ne 's/^[^"]*"\\\{0,1\}\([^_][^[:space:]"]*\)[[:space:]"].*/\1/p' |
***** invoke awk/tail through "_comp_{awk,tail}"
-bash_completion:2988: local i tail
-bash_completion:3233: a2ps awk base{32,64,nc} bash bc bison cat chroot colordiff comm cp \
-bash_completion:3238: shuf sort split stat strip sum sync tac tail tee \
test/t/test_cancel.py:29: bash, "lpstat | awk '{print $1}'", want_output=True
-test/t/unit/test_unit_quote_compgen.py:108: $ awk '$1 > 1.0[TAB]I added further adjustments at the code side to reduce the false positives in commit 2b19d2a. |
|
Regarding the here strings, one problem it can cause is when there isn't any space left on the disk, and that can make completions not work if they use them. One other thing is if stale tempfiles can be left over, but I don't know if that can really happen. |
|
I think commit 2b19d2a could be better submitted as a separate PR and removed from here, as it's not really that related to the rest of the work here (maybe apart from the bash_completion wrapping-only changes), that way we could get that out of the way from the remaining things here. |
This removes around 50 false positives from the output.