bashcov 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +0 -1
- data/lib/bashcov/detective.rb +17 -5
- data/lib/bashcov/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e093e8ccb4452695d43f5ffed178b51f7234288858e5a3534fb5aab92f6aba35
|
4
|
+
data.tar.gz: 4f53989ea9d994c75df3ce5bf0b518902fa77f833995515123f85581ab57473f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73f0e0d86193102a73999020b4027253e3642ed935fb4b3a42c594b79fa86553c908e4bfb8c3b904197a6e52ff2a7925ffe5fbbf56c63c882ce35dae289fd611
|
7
|
+
data.tar.gz: c82225c38c2287a914623cd732d0c5e612dfc2f864b028d340246727fbf03755bd26bfcd3f212a361a22fa369ca5f70e9a637b34bf67c7ba45b98cf71943a4ff
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v3.0.
|
1
|
+
## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v3.0.3...master))
|
2
2
|
|
3
3
|
* TBD
|
4
4
|
|
5
|
+
## v3.0.3, 2023-07-14 ([changes](https://github.com/infertux/bashcov/compare/v3.0.2...v3.0.3))
|
6
|
+
|
7
|
+
* [BUGFIX] Improve shebang detection (#74)
|
8
|
+
|
5
9
|
## v3.0.2, 2023-04-18 ([changes](https://github.com/infertux/bashcov/compare/v3.0.1...v3.0.2))
|
6
10
|
|
7
11
|
* [BUGFIX] Match function names containing digits and colons
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Bashcov
|
2
2
|
|
3
3
|
[![Funding](https://img.shields.io/liberapay/patrons/infertux.svg?logo=liberapay)](https://liberapay.com/infertux/donate)
|
4
|
-
[![Sponsors](https://img.shields.io/liberapay/patrons/infertux)](https://liberapay.com/infertux)
|
5
4
|
[![Gem Version](https://img.shields.io/gem/v/bashcov.svg)](https://rubygems.org/gems/bashcov)
|
6
5
|
[![Build Status](https://gitlab.com/infertux/bashcov/badges/master/pipeline.svg)](https://gitlab.com/infertux/bashcov/-/pipelines)
|
7
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/083fdbba795049cd5f06/maintainability)](https://codeclimate.com/github/infertux/bashcov/maintainability)
|
data/lib/bashcov/detective.rb
CHANGED
@@ -38,8 +38,6 @@ module Bashcov
|
|
38
38
|
(shellscript_extension?(filename) && shellscript_syntax?(filename))
|
39
39
|
end
|
40
40
|
|
41
|
-
private
|
42
|
-
|
43
41
|
# @param [String,Pathname] filename the name of the file to be checked
|
44
42
|
# @return [Boolean] whether +filename+'s first line is a valid shell
|
45
43
|
# shebang
|
@@ -52,13 +50,27 @@ module Bashcov
|
|
52
50
|
return false
|
53
51
|
end
|
54
52
|
|
55
|
-
|
53
|
+
shellscript_shebang_line?(shebang)
|
54
|
+
end
|
55
|
+
|
56
|
+
# @param [String] shebang a line to test for shell shebang-itude
|
57
|
+
# @return [Boolean] whether the line is a valid shell shebang
|
58
|
+
def shellscript_shebang_line?(shebang)
|
59
|
+
scanner = StringScanner.new(shebang)
|
60
|
+
|
61
|
+
return false if scanner.scan(/#!\s*/).nil?
|
62
|
+
|
63
|
+
shell = scanner.scan(/\S+/)
|
64
|
+
|
65
|
+
return false if shell.nil?
|
66
|
+
|
67
|
+
args = scanner.skip(/\s+/).nil? ? [] : scanner.rest.split(/\s+/)
|
56
68
|
|
57
|
-
shell, arg = shebang[2..].split(/\s+/, 2)
|
58
69
|
shell_basename = File.basename(shell)
|
59
70
|
|
60
71
|
SHELL_BASENAMES.include?(shell_basename) ||
|
61
|
-
(OTHER_BASENAMES.include?(shell_basename) &&
|
72
|
+
(OTHER_BASENAMES.include?(shell_basename) &&
|
73
|
+
args.any? { |arg| SHELL_BASENAMES.include?(File.basename(arg)) })
|
62
74
|
end
|
63
75
|
|
64
76
|
# @param [String,Pathname] filename the name of the file to be checked
|
data/lib/bashcov/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bashcov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cédric Félizard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|