-
Notifications
You must be signed in to change notification settings - Fork 12
Add shellcheck action #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Ah interesting. Some GitHub wizardry. |
I think you will need to enable/allow GH actions first and then all PRs will use |
Thing is, shellcheck is not very flexible. adblock-lean currently has 66 warnings and 33 infos from shellcheck. I am fairly certain that all of them are either irrelevant or completely benign. We disabled some shellcheck warnings globally via directives, but that's not enough to make it completely warning-free. I wouldn't want to disable every shellcheck warning currently showing up because in some cases same shellcheck warnings are actually helpful and relevant. For example, it complains about the The "proper" way to deal with this (AFAIK) is adding a specific shellcheck directive before the line where a warning should be ignored. However this solution has the downside of increasing the script size and lines count, while adding nothing to the functionality. Ideas are welcome. |
Hmm yes in cake-autorate we just added this: https://github.com/lynxthecat/cake-autorate/blob/master/.shellcheckrc So really only for the benefit of those with a working directory and making commits. I found shellcheck helpful but end up ignoring a lot of the warnings. |
I'm thinking that perhaps a good middle-ground would be calling |
|
another idea i had: if the size of the script is critical and the amount of shellcheck pragmas is an issue: |
@friendly-bits Is it normal that all files are reported with multiple errors SC1017 when the repo is cloned locally? |
This is definitely not normal. Unix scripts should have Unix-style newlines. adblock-lean even checks the newline style of the config file because at some point we've had users copy-pasting config from Windows with Windows-style newlines (CR) which would cause config load failure. While I am working on adblock-lean on Windows (in VS Code), the editor is configured to use Unix-style newlines (LF). Moreover, I just verified (on my Linux machine) that the files do not have any CR newlines:
So I believe it's something in your setup. I can try help with troubleshooting this if you like but perhaps it's better done with PM's in the forum. |
P.s. I aplogize to @benjaminfrank for not merging this PR. The reason is that currently I don't feel like this is needed. Personally, I'm using shellcheck plugin in VS Code which provides real-time feedback, so I already know everything shellcheck has to say about the scripts. Perhaps if more people get involved in active development, merging this PR will start to make sense. |
You're right. The issue was on my end and for some reason, the |
Perhaps we should add .gitattributes file in order to explicitly tell git to use LF newlines, like so. Probably this should prevent such issues. |
Maybe it'll be a better way to set it as auto in .gitattributes and to define different file types. This will give you a more granular solution.
You can find here also a few examples: gitattributes |
I really don't know much about gitattributes so I'm not sure what all this does and why it's needed. For instance, what's wrong with having
And this:
|
The second one was just an example if you want to apply different rules for different file types. |
the action ran properly in my forks PR: benjaminfrank#1
there are some findings though.
main question: is this desirable? if yes i could work on getting rid of the findings and update this PR accordingly over the weekend