danger-spec_postfix 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -4
- data/lib/spec_postfix/gem_version.rb +1 -1
- data/lib/spec_postfix/plugin.rb +5 -5
- data/spec/spec_postfix_spec.rb +5 -5
- 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: f0f6f2a6016004d0a1dbd87a388a82c9c90762b8e0027ac441026b8a38c378c0
|
4
|
+
data.tar.gz: c290351a4a5144ce5c947a69b6f3fa7aabe0374f6bfa64ac355212debece48ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ba21b99a4badcc2238550178d38d8e93117cfb653187fa745527dc910cf30999b25bcc519fc26fbdec351e7e9812d43c664f58ae226c263256b02b08ac951a2
|
7
|
+
data.tar.gz: 7dd9481581cca7d5082595919538f1a9cc1d8da4ac9e34f110ebc78db054964a45508f8c0cff9a7c3273a3c687cc970e9e44a2a73a1d8eab22d9d89ebc46df52
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -15,20 +15,20 @@ Danger plugin to validate files (or directories) naming.
|
|
15
15
|
```
|
16
16
|
options = {
|
17
17
|
message: 'Tests should have `_spec` postfix',
|
18
|
-
|
18
|
+
include_path: %r{spec/},
|
19
19
|
match: %r{_spec.rb$}
|
20
20
|
}
|
21
21
|
spec_postfix.lint(options)
|
22
22
|
```
|
23
23
|
|
24
|
-
You can also pass `
|
24
|
+
You can also pass `exclude_path` param in order to skip irrelevant files or directories:
|
25
25
|
|
26
26
|
```
|
27
27
|
options = {
|
28
28
|
message: 'Tests should have `_spec` postfix',
|
29
|
-
|
29
|
+
include_path: %r{spec/},
|
30
30
|
match: %r{_spec.rb$}
|
31
|
-
|
31
|
+
exclude_path: Regexp.union(%r{rails_helper.rb}, %r{rails_helper.rb}, %{spec/factories/}, %r{spec/support/})
|
32
32
|
}
|
33
33
|
spec_postfix.lint(options)
|
34
34
|
```
|
data/lib/spec_postfix/plugin.rb
CHANGED
@@ -7,16 +7,16 @@ module Danger
|
|
7
7
|
# @param [Array<String>] files
|
8
8
|
# A globbed string which should return the files that you want to lint, defaults to nil.
|
9
9
|
# if nil, modified and added files from the diff will be used.
|
10
|
-
# @param
|
10
|
+
# @param include_path [Regexp] Scope of check
|
11
11
|
# @param match [Regexp] Pattern to match
|
12
12
|
# @param message [String] Warn message
|
13
|
-
# @param
|
13
|
+
# @param exclude_path [Regexp] Not required. In case you want to have some directories or files exceptions.
|
14
14
|
# @return [void]
|
15
15
|
#
|
16
16
|
class DangerSpecPostfix < Plugin
|
17
|
-
def lint(
|
18
|
-
wrong_files = changed_files.select { |f| f.match?(
|
19
|
-
wrong_files = wrong_files.reject { |f| f.match?(
|
17
|
+
def lint(include_path:, match:, message:, exclude_path: nil)
|
18
|
+
wrong_files = changed_files.select { |f| f.match?(include_path) }.reject { |f| f.match?(match) }
|
19
|
+
wrong_files = wrong_files.reject { |f| f.match?(exclude_path) } if exclude_path
|
20
20
|
wrong_files.each { |f| warn("#{message}: #{f}") }
|
21
21
|
end
|
22
22
|
|
data/spec/spec_postfix_spec.rb
CHANGED
@@ -15,12 +15,12 @@ module Danger
|
|
15
15
|
end
|
16
16
|
|
17
17
|
let(:message) { 'Tests should have `_spec` postfix' }
|
18
|
-
let(:
|
18
|
+
let(:include_path) { %r{spec/} }
|
19
19
|
let(:match) { %r{_spec.rb$} }
|
20
20
|
let(:options) do
|
21
21
|
{
|
22
22
|
message: message,
|
23
|
-
|
23
|
+
include_path: include_path,
|
24
24
|
match: match
|
25
25
|
}
|
26
26
|
end
|
@@ -47,13 +47,13 @@ module Danger
|
|
47
47
|
let(:options) do
|
48
48
|
{
|
49
49
|
message: message,
|
50
|
-
|
50
|
+
include_path: include_path,
|
51
51
|
match: match,
|
52
|
-
|
52
|
+
exclude_path: exclude_path
|
53
53
|
}
|
54
54
|
end
|
55
55
|
let(:file_path) { 'spec/spec_helper.rb' }
|
56
|
-
let(:
|
56
|
+
let(:exclude_path) { Regexp.union(%r{spec/factories}, %r{spec_helper.rb}) }
|
57
57
|
|
58
58
|
it { is_expected.to be_empty }
|
59
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-spec_postfix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Udalov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|