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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8231d6219cf75be371db48df2d4d14f9db58401bc2636432a4b7352163bde782
4
- data.tar.gz: 63f184fb4d8c15008d74d0b5c466cabfc3c0bde5b6f5527a1a92727b4f373f39
3
+ metadata.gz: e093e8ccb4452695d43f5ffed178b51f7234288858e5a3534fb5aab92f6aba35
4
+ data.tar.gz: 4f53989ea9d994c75df3ce5bf0b518902fa77f833995515123f85581ab57473f
5
5
  SHA512:
6
- metadata.gz: 6217f58d4ad6eac425ba4dee9ae3144b4fdbd46d3f95bb5e63a02f67dd7d78f9442cae52879c0d73ad9b067fa873de5f3b0e6b331ab4a3edacbcd05f02de08c0
7
- data.tar.gz: 621c56636e5b2594c36a6bdcc71d5445b520bd17b23c12a69352a21fb7cebbc7cf2fff4901927a6f58142235db69978fb47fa0583b381b0826d28c642a0ee391
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.2...master))
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)
@@ -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
- return false unless shebang[0..1] == "#!"
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) && SHELL_BASENAMES.include?(arg))
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
@@ -3,5 +3,5 @@
3
3
  # :nodoc:
4
4
  module Bashcov
5
5
  # Current Bashcov version
6
- VERSION = "3.0.2"
6
+ VERSION = "3.0.3"
7
7
  end
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.2
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-04-18 00:00:00.000000000 Z
11
+ date: 2023-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov