#2976 PR merged
: Add .shellcheckrc adapted for ReaR¶
Labels: enhancement
, fixed / solved / done
, ReaR Project
antonvoznia opened issue at 2023-04-28 15:11:¶
- enable/disable SC2168 (local is only valid in functions) because scripts under lib/ are always sourced from functions, so "local" is valid inside them.
- set shell=bash because ReaR uses bash but the scripts don't have shebangs.
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#L1Example 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/files
https://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/files
https://github.com/antonvoznia/rear/pull/341/files
pcahyna commented at 2023-04-28 15:31:¶
@antonvoznia thanks - I have one comment - you show two example PRs,
both are generated with severity: style
. But that's not the shellcheck
severity we are using - we are using severity: error
:
https://github.com/rear/rear/commit/966379ef1f83071f381ef4fbf8c03a6aeaa782a0#diff-eace62a8ebcdafd0f6975200d68cbf851300952aae47db07e71f383038a368b3R29
. Can you please update the example PR links to PRs generated with the
same severity level?
antonvoznia commented at 2023-04-28 21:23:¶
@antonvoznia thanks - I have one comment - you show two example PRs, both are generated with
severity: style
. But that's not the shellcheck severity we are using - we are usingseverity: error
: 966379e#diff-eace62a8ebcdafd0f6975200d68cbf851300952aae47db07e71f383038a368b3R29 . Can you please update the example PR links to PRs generated with the same severity level?
Hi @pcahyna , I'm sorry for the mistake.
I've updated it.
Thanks,
Anton
pcahyna commented at 2023-04-28 23:15:¶
thank you, merging!
[Export of Github issue for rear/rear.]