shlint 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/checkbashisms +19 -6
- metadata +7 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2013c0961be2fbc1b5172a88f2829a98e4ef32c5
|
4
|
+
data.tar.gz: 73cac37e561784d853daba5fa34e67228cbf0f41
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9fc2aeb052d8f79fa0f53b11b7deca6ed005692d40a87ac0b727078146ea35a72f7bf6012f3143d1563f64b51a12d37b178d8760b682fad939856ff98d1be0da
|
7
|
+
data.tar.gz: bb7085b3ba647a5d11da3b3538e27c64389e753ccd6d1447546e4d082f77e4dd7ca6f6368f9c043b4da58a1ec3df647559b8bb00f031e883c0f9de7109ac82b4
|
data/lib/checkbashisms
CHANGED
@@ -33,7 +33,7 @@ Usage: $progname [-n] [-f] [-x] script ...
|
|
33
33
|
or: $progname --help
|
34
34
|
or: $progname --version
|
35
35
|
This script performs basic checks for the presence of bashisms
|
36
|
-
in /bin/sh scripts.
|
36
|
+
in /bin/sh scripts and the lack of bashisms in /bin/bash ones.
|
37
37
|
EOF
|
38
38
|
|
39
39
|
my $version = <<"EOF";
|
@@ -74,6 +74,8 @@ if ($opt_version) { print $version; exit 0; }
|
|
74
74
|
|
75
75
|
$opt_echo = 1 if $opt_posix;
|
76
76
|
|
77
|
+
my $mode = 0;
|
78
|
+
my $issues = 0;
|
77
79
|
my $status = 0;
|
78
80
|
my $makefile = 0;
|
79
81
|
my (%bashisms, %string_bashisms, %singlequote_bashisms);
|
@@ -116,6 +118,8 @@ foreach my $filename (@ARGV) {
|
|
116
118
|
next;
|
117
119
|
}
|
118
120
|
|
121
|
+
$issues = 0;
|
122
|
+
$mode = 0;
|
119
123
|
my $cat_string = "";
|
120
124
|
my $cat_indented = 0;
|
121
125
|
my $quote_string = "";
|
@@ -143,9 +147,7 @@ foreach my $filename (@ARGV) {
|
|
143
147
|
next if $opt_force;
|
144
148
|
|
145
149
|
if ($interpreter =~ m,/bash$,) {
|
146
|
-
|
147
|
-
$status |= 2;
|
148
|
-
last; # end this file
|
150
|
+
$mode = 1;
|
149
151
|
}
|
150
152
|
elsif ($interpreter !~ m,/(sh|posh)$,) {
|
151
153
|
### ksh/zsh?
|
@@ -476,6 +478,11 @@ foreach my $filename (@ARGV) {
|
|
476
478
|
if ($buffered_line ne '');
|
477
479
|
|
478
480
|
close C;
|
481
|
+
|
482
|
+
if ($mode && !$issues) {
|
483
|
+
warn "could not find any possible bashisms in bash script $filename\n";
|
484
|
+
$status |= 4;
|
485
|
+
}
|
479
486
|
}
|
480
487
|
|
481
488
|
exit $status;
|
@@ -483,8 +490,14 @@ exit $status;
|
|
483
490
|
sub output_explanation {
|
484
491
|
my ($filename, $line, $explanation) = @_;
|
485
492
|
|
486
|
-
|
487
|
-
|
493
|
+
if ($mode) {
|
494
|
+
# When examining a bash script, just flag that there are indeed
|
495
|
+
# bashisms present
|
496
|
+
$issues = 1;
|
497
|
+
} else {
|
498
|
+
warn "possible bashism in $filename line $. ($explanation):\n$line\n";
|
499
|
+
$status |= 1;
|
500
|
+
}
|
488
501
|
}
|
489
502
|
|
490
503
|
# Returns non-zero if the given file is not actually a shell script,
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ross Duggan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Checks the syntax of your shellscript against known and available shells.
|
15
14
|
email:
|
@@ -28,26 +27,25 @@ files:
|
|
28
27
|
- README.md
|
29
28
|
homepage: http://github.com/duggan/shlint
|
30
29
|
licenses: []
|
30
|
+
metadata: {}
|
31
31
|
post_install_message:
|
32
32
|
rdoc_options: []
|
33
33
|
require_paths:
|
34
34
|
- lib
|
35
35
|
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
-
none: false
|
37
36
|
requirements:
|
38
|
-
- -
|
37
|
+
- - '>='
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '0'
|
41
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
41
|
requirements:
|
44
|
-
- -
|
42
|
+
- - '>='
|
45
43
|
- !ruby/object:Gem::Version
|
46
44
|
version: 1.3.6
|
47
45
|
requirements: []
|
48
46
|
rubyforge_project:
|
49
|
-
rubygems_version:
|
47
|
+
rubygems_version: 2.0.0
|
50
48
|
signing_key:
|
51
|
-
specification_version:
|
49
|
+
specification_version: 4
|
52
50
|
summary: A linting tool for shell.
|
53
51
|
test_files: []
|