Add .shellcheckrc adapted for ReaR #2976
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relax-and-Recover (ReaR) Pull Request Template
Please fill in the following items before submitting a new pull request:
Pull Request Details:
Type: Bug Fix
Impact: Low
Reference to related issue (URL):
How was this pull request tested?
Brief description of the changes in this pull request:
As a part of my master's thesis, I made a "research" about the Differential shellcheck usage.
I solved 2 problems in this PR:
unnecessary output of shellcheck "Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive."
Since the ReaR is written in bash and that is specified in the following line:
https://github.com/antonvoznia/rear/blob/master/usr/sbin/rear#L1
Example of such notice:
https://github.com/antonvoznia/rear/pull/100/files
Scripts outside the lib directory are handled from functions, so it's a valid usage of local variables in them. However, shellcheck "incorrectly" marks local variable usage in these scripts.
Example:
https://github.com/antonvoznia/rear/pull/100/files
These issues I described in my master's thesis, chapter 6.2
https://dspace.cvut.cz/bitstream/handle/10467/107238/F3-DP-2023-Voznia-Anton-dip_thesis-2.pdf?sequence=-1&isAllowed=y#toc%3A22
2 test examples with the fix:
The example with a newly added file without shebang and local variable usage without described above warning.
https://github.com/antonvoznia/rear/pull/357/fileshttps://github.com/antonvoznia/rear/pull/349/files
Another example with local variable usage in functions, and there is expected behaviour of the shellcheck/Differential shellcheck:
https://github.com/antonvoznia/rear/pull/352/fileshttps://github.com/antonvoznia/rear/pull/341/files