bashate: skip non sh/bash files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash8 |
New
|
Undecided
|
Unassigned |
Bug Description
Bashate currently tries to scan non shell scripts if passed in. It would be nice to bail out and warn the user properly. I.e., compare shellcheck and bashate, on a perl script:
austin@austin2:~$ file foo.pl
foo.pl: Perl script text executable
austin@austin2:~$ head -n 1 foo.pl
#!/usr/bin/env perl
austin@austin2:~$ shellcheck foo.pl
In foo.pl line 1:
#!/usr/bin/env perl
^-- SC1071: ShellCheck only supports sh/bash/dash/ksh scripts. Sorry!
austin@austin2:~$ echo $?
1
austin@austin2:~$ bashate foo.pl
E010: Do not on same line as while: ' while (<FILE>) {'
- foo.pl : L10
1 bashate error(s) found
austin@austin2:~$ echo $?
1
Bashate only fails because it thought there was a style issue, but it is not correct for perl ;)
As a workaround, the "stank" program can quickly identify shell script files, which can be piped to xargs bashate in order to lint just the shell scripts.
https:/ /github. com/mcandre/ stank