zsh-sweep icon indicating copy to clipboard operation
zsh-sweep copied to clipboard

Document Error Codes like Shellcheck

Open jordantrizz opened this issue 1 year ago • 0 comments

This was proposed on Reddit.

https://www.reddit.com/r/zsh/comments/10nb0y0/announcing_zshscan_a_zshlinter_zsh/

I like how shellcheck assigns each type of error or warning with a code, that optimistically corresponds to a page on their wiki to read more about it.

So for example with zsh-sweep, it tells me:

Notice: running check: CHECK_ZERO_ASSIGNMENT…
[ZSweep][zscan:125]: Warning: $0 assignment is missing, it should be:
·0=${${(M)${0::=${(%):-%x}}:#/*}:-$PWD/$0}
Notice: running check: CHECK_ZERO_ASSIGNMENT_STD…
[ZSweep][zscan:125]: Warning: $0 setting isn't the standard one, it's best if it's:
·0=${${(M)${0::=${(%):-%x}}:#/*}:-$PWD/$0}

It would be great if the project had wiki pages or readme sections or something corresponding to CHECK_ZERO_ASSIGNMENT and CHECK_ZERO_ASSIGNMENT_STD, where a user can learn more about the what and why of those warnings and suggested solutions.

Then there are a bunch of lines like:

[ZSweep][zsfilt:184]: Error: near line #2399 ↔  words=(pip-compile $words):
but it doesn't identify the error by a code or name or description, so I can't tell what's wrong.

EDIT:

Then there are some warnings like:

[ZSweep][zscan:125]: Warning: Incorrect array append, it should say: arr+=(elem) not: arr+=elem which doesn't work on various occasions.

and

[ZSweep][zscan:125]: Warning: A global variable has been created without declaration, by assignment. Add a line like local VAR or typeset -g VAR so that the variable is defined before use.

but they don't seem to indicate where in my source these issues are encountered.

jordantrizz avatar May 18 '23 18:05 jordantrizz