ezcater_rubocop 0.58.1 → 0.58.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/ezcater_rubocop.gemspec +1 -0
- data/lib/ezcater_rubocop/version.rb +1 -1
- data/lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb +19 -5
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e151dd4b27ee7e5bcddac56133f15076fae095c805b8eeae79c0f31bb670eb08
|
4
|
+
data.tar.gz: ba22adef7ce8f2ab6a9b2459a1c0b10b519ad2ae4aa7d414c3f53a8552b9d57a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fd3c2e43cf638746b08a07886ee0bcd136583bee145c60cea0cb3d4853a6a1789a978bd993a4f438610f3a72331527a928b2772015ee765d96202a1731b39fa
|
7
|
+
data.tar.gz: 57a591efffc15e96abc89621b7912f73dc1c6eb6d327142fa0e753e4067e8083a654eb296bbc4009babccd10af00d0aa2d6c757d0f2e509848542cb380b610b5
|
data/README.md
CHANGED
@@ -83,10 +83,11 @@ the latest compatible version each time that the MAJOR.MINOR version of `rubocop
|
|
83
83
|
is updated.
|
84
84
|
|
85
85
|
## Custom Cops
|
86
|
+
|
86
87
|
1. [PrivateAttr](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/private_attr.rb) - Require methods from the `private_attr` gem.
|
87
88
|
1. [RailsConfiguration](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rails_configuration.rb) - Enforce use of `Rails.configuration` instead of `Rails.application.config`.
|
88
89
|
1. [RequireGqlErrorHelpers](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/require_gql_error_helpers.rb) - Use the helpers provided by `GQLErrors` instead of raising `GraphQL::ExecutionError` directly.
|
89
|
-
1. [RspecDotNotSelfDot](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb) - Enforce ".<class method>" instead of "self.<class method>" for example group description.
|
90
|
+
1. [RspecDotNotSelfDot](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb) - Enforce ".<class method>" instead of "self.<class method>" and "::<class method>" for example group description.
|
90
91
|
1. [RspecMatchOrderedArray](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_match_ordered_array.rb) - Enforce use of `match_ordered_array` matcher instead of `eq` matcher. This matcher comes from the [ezcater_matchers](https://github.com/ezcater/ezcater_matchers) gem.
|
91
92
|
1. [RspecRequireBrowserMock](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_require_browser_mock.rb) - Enforce use of `mock_ezcater_app`, `mock_chrome_browser` & `mock_custom_browser` helpers instead of mocking `Browser` or `EzBrowser` directly.
|
92
93
|
1. [RspecRequireFeatureFlagMock](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/rspec_require_feature_flag_mock.rb) - Enforce use of `mock_feature_flag` helper instead of mocking `FeatureFlag.is_active?` directly.
|
data/ezcater_rubocop.gemspec
CHANGED
@@ -47,6 +47,7 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.add_development_dependency "rake", "~> 10.0"
|
48
48
|
spec.add_development_dependency "rspec", "~> 3.0"
|
49
49
|
spec.add_development_dependency "rspec_junit_formatter"
|
50
|
+
spec.add_development_dependency "simplecov"
|
50
51
|
|
51
52
|
spec.add_runtime_dependency "parser", "!= 2.5.1.1"
|
52
53
|
spec.add_runtime_dependency "rubocop", "~> 0.58.2"
|
@@ -17,9 +17,18 @@ module RuboCop
|
|
17
17
|
# describe "self.does_stuff" do
|
18
18
|
# ...
|
19
19
|
# end
|
20
|
+
#
|
21
|
+
# # bad
|
22
|
+
# describe "::does_stuff" do
|
23
|
+
# ...
|
24
|
+
# end
|
25
|
+
|
20
26
|
class RspecDotNotSelfDot < Cop
|
21
27
|
SELF_DOT_REGEXP = /["']self\./
|
22
|
-
|
28
|
+
COLON_COLON_REGEXP = /["'](\:\:)/
|
29
|
+
|
30
|
+
SELF_DOT_MSG = 'Use ".<class method>" instead of "self.<class method>" for example group description.'
|
31
|
+
COLON_COLON_MSG = 'Use ".<class method>" instead of "::<class method>" for example group description.'
|
23
32
|
|
24
33
|
def_node_matcher :example_group_match, <<-PATTERN
|
25
34
|
(send _ #{RuboCop::RSpec::Language::ExampleGroups::ALL.node_pattern_union} $_ ...)
|
@@ -27,15 +36,20 @@ module RuboCop
|
|
27
36
|
|
28
37
|
def on_send(node)
|
29
38
|
example_group_match(node) do |doc|
|
30
|
-
|
39
|
+
if doc.source.match?(SELF_DOT_REGEXP)
|
40
|
+
add_offense(doc, location: :expression, message: SELF_DOT_MSG)
|
41
|
+
elsif doc.source.match?(COLON_COLON_REGEXP)
|
42
|
+
add_offense(doc, location: :expression, message: COLON_COLON_MSG)
|
43
|
+
end
|
31
44
|
end
|
32
45
|
end
|
33
46
|
|
34
47
|
def autocorrect(node)
|
35
48
|
lambda do |corrector|
|
36
|
-
|
37
|
-
|
38
|
-
|
49
|
+
experession_end = node.source.match?(COLON_COLON_REGEXP) ? 3 : 6
|
50
|
+
corrector.replace(Parser::Source::Range.new(node.source_range.source_buffer,
|
51
|
+
node.source_range.begin_pos + 1,
|
52
|
+
node.source_range.begin_pos + experession_end), ".")
|
39
53
|
end
|
40
54
|
end
|
41
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezcater_rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.58.
|
4
|
+
version: 0.58.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ezCater, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: parser
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|