danger-spec_postfix 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acf829f0845c574d42a1fb15cc83470b25574042efd05749ec3b533bde18dcaf
4
- data.tar.gz: fc48c175541ec881fc91779b353201bfa7556b0a51ec4dd673db0d37724a1478
3
+ metadata.gz: f0f6f2a6016004d0a1dbd87a388a82c9c90762b8e0027ac441026b8a38c378c0
4
+ data.tar.gz: c290351a4a5144ce5c947a69b6f3fa7aabe0374f6bfa64ac355212debece48ff
5
5
  SHA512:
6
- metadata.gz: 4a629d1298c250bbcfdebb1d117a021de6760d23b6e5081110e9b36e9dc46f480eb2e449ae53fb534ceb286a71456c1ce2d2f76401719ba5df45f2fcf1c86d8d
7
- data.tar.gz: cd7976ffc6b336ad6293dba8fc7bafe1962d85426b6833d86e245ad014c7bb2e590f07dbb80ff6f2d6263922356410f0f81578236cd79e8681146c21c1cdacbf
6
+ metadata.gz: 6ba21b99a4badcc2238550178d38d8e93117cfb653187fa745527dc910cf30999b25bcc519fc26fbdec351e7e9812d43c664f58ae226c263256b02b08ac951a2
7
+ data.tar.gz: 7dd9481581cca7d5082595919538f1a9cc1d8da4ac9e34f110ebc78db054964a45508f8c0cff9a7c3273a3c687cc970e9e44a2a73a1d8eab22d9d89ebc46df52
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danger-spec_postfix (0.0.6)
4
+ danger-spec_postfix (0.0.7)
5
5
  danger-plugin-api (~> 1.0)
6
6
 
7
7
  GEM
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
- scope: %r{spec/},
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 `exceptions` param in order to skip irrelevant files or directories:
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
- scope: %r{spec/},
29
+ include_path: %r{spec/},
30
30
  match: %r{_spec.rb$}
31
- exception: Regexp.union(%r{rails_helper.rb}, %r{rails_helper.rb}, %{spec/factories/}, %r{spec/support/})
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
  ```
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SpecPostfix
4
- VERSION = '0.0.6'
4
+ VERSION = '0.0.7'
5
5
  end
@@ -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 scope [Regexp] Scope of check
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 exception [Regexp] Not required. In case you want to get some directories or files out of scope.
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(scope:, match:, message:, exception: nil)
18
- wrong_files = changed_files.select { |f| f.match?(scope) }.reject { |f| f.match?(match) }
19
- wrong_files = wrong_files.reject { |f| f.match?(exception) } if exception
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
 
@@ -15,12 +15,12 @@ module Danger
15
15
  end
16
16
 
17
17
  let(:message) { 'Tests should have `_spec` postfix' }
18
- let(:scope) { %r{spec/} }
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
- scope: scope,
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
- scope: scope,
50
+ include_path: include_path,
51
51
  match: match,
52
- exception: exception
52
+ exclude_path: exclude_path
53
53
  }
54
54
  end
55
55
  let(:file_path) { 'spec/spec_helper.rb' }
56
- let(:exception) { Regexp.union(%r{spec/factories}, %r{spec_helper.rb}) }
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.6
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-20 00:00:00.000000000 Z
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