bashcov 3.0.2 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -1
- data/README.md +0 -1
- data/lib/bashcov/detective.rb +25 -5
- data/lib/bashcov/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6b65a0c0d70e2ae93acb297d3d89fe9de010f4dbc63b92a025504c50bb1100b
|
4
|
+
data.tar.gz: 1cf1037ed383e6f4f0764f6991c0371326dcde1ebe340e5264aae855d5281174
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 596e7890b99b1fa1c23ecc42a64d092aeaaa9f03f5fb7181261df5d695405e33b1557de8c4218b591ded6aab4d0ecbaaae0929b4bc69bb83d43cc36d45df60d0
|
7
|
+
data.tar.gz: f442d9628a530ffad4058727c93eb25c30241f9a2c74199ab26ace4e704431e44e94f586df5a4fb1e7316f9c5800ab436014c16b203571e8f4625ffe17b42dbd
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,20 @@
|
|
1
|
-
## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v3.0
|
1
|
+
## Unreleased ([changes](https://github.com/infertux/bashcov/compare/v3.1.0...master))
|
2
2
|
|
3
3
|
* TBD
|
4
4
|
|
5
|
+
## v3.1.0, 2023-09-28 ([changes](https://github.com/infertux/bashcov/compare/v3.0.3...v3.1.0))
|
6
|
+
|
7
|
+
* [FEATURE] Better diagnostics for runner result specs
|
8
|
+
* [BUGFIX] Use `/usr/bin/env bash`
|
9
|
+
* [FEATURE] Initialize GitHub Actions workflow
|
10
|
+
* [MISC] Make `Detective#shellscript_syntax?` private
|
11
|
+
* [BUGFIX] Handle binary data
|
12
|
+
* [BUGFIX] Fix Rubocop violations
|
13
|
+
|
14
|
+
## v3.0.3, 2023-07-14 ([changes](https://github.com/infertux/bashcov/compare/v3.0.2...v3.0.3))
|
15
|
+
|
16
|
+
* [BUGFIX] Improve shebang detection (#74)
|
17
|
+
|
5
18
|
## v3.0.2, 2023-04-18 ([changes](https://github.com/infertux/bashcov/compare/v3.0.1...v3.0.2))
|
6
19
|
|
7
20
|
* [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,33 @@ 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
|
+
begin
|
62
|
+
return false if scanner.scan(/#!\s*/).nil?
|
63
|
+
|
64
|
+
shell = scanner.scan(/\S+/)
|
65
|
+
|
66
|
+
return false if shell.nil?
|
67
|
+
|
68
|
+
args = scanner.skip(/\s+/).nil? ? [] : scanner.rest.split(/\s+/)
|
69
|
+
rescue ArgumentError
|
70
|
+
# Handle "invalid byte sequence in UTF-8" from `StringScanner`. Can
|
71
|
+
# happen when trying to read binary data (e.g. .pngs).
|
72
|
+
return false
|
73
|
+
end
|
56
74
|
|
57
|
-
shell, arg = shebang[2..].split(/\s+/, 2)
|
58
75
|
shell_basename = File.basename(shell)
|
59
76
|
|
60
77
|
SHELL_BASENAMES.include?(shell_basename) ||
|
61
|
-
(OTHER_BASENAMES.include?(shell_basename) &&
|
78
|
+
(OTHER_BASENAMES.include?(shell_basename) &&
|
79
|
+
args.any? { |arg| SHELL_BASENAMES.include?(File.basename(arg)) })
|
62
80
|
end
|
63
81
|
|
64
82
|
# @param [String,Pathname] filename the name of the file to be checked
|
@@ -68,6 +86,8 @@ module Bashcov
|
|
68
86
|
SHELLSCRIPT_EXTENSIONS.include? File.extname(filename)
|
69
87
|
end
|
70
88
|
|
89
|
+
private
|
90
|
+
|
71
91
|
# @param [String,Pathname] filename the name of the file to be checked
|
72
92
|
# @return [Boolean] whether +filename+'s text matches valid shell syntax
|
73
93
|
# @note assumes that +filename+ is readable and refers to a regular file
|
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.1.0
|
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-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
|
-
rubygems_version: 3.4.
|
208
|
+
rubygems_version: 3.4.20
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Code coverage tool for Bash
|