ezcater_rubocop 0.51.5 → 0.51.6

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
  SHA1:
3
- metadata.gz: 2e1e4b74af46fc4543ab92ab20a575118a881c72
4
- data.tar.gz: 864de83177e58cdcb3af668d6e10feb53dd1f2ae
3
+ metadata.gz: cb603231a4a17aa675551667fb1f67f0b876414f
4
+ data.tar.gz: 819384ef596abaea34c4b50ca2286710c86fe338
5
5
  SHA512:
6
- metadata.gz: 3efb0a9492f109fa603cab846955dcf90265b3c0f93213ecba47dbc63cf0ec4ca95691aa69f30ea423130be54d3b8010e3951343de43b17567125045a4d72cf3
7
- data.tar.gz: d3bb33303ea534109ff12c212ac32cfc70282a364f2bfb49328a6358f06cb5474a226655dea568d1e93e2e8edb4e0e122568ca98f1e0b4e5b5284e8d95fa161f
6
+ metadata.gz: ee79e5b54329bb19650f9c2c6edc5c1850abf2f167faf9103ad69192178296ba3f3612da5fef786ebe5fbdeb5b80dc907213427c9872cd1e70d03ea07cf7a2ad
7
+ data.tar.gz: 6a0302fdae0d7174034bf7e2543d5b11258c6d7201f9fad2de6245c692a488cf06d25eb6dd99e7724b4eaf797c668c36014c467969f4bd9eeeec0424051448ff
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # ezcater_rubocop
2
2
 
3
+ ## v0.51.6
4
+ - Add `Ezcater/RailsConfiguration` cop.
5
+ - Exclude `config/environments/*.rb` for the `Metrics/BlockLength` cop.
6
+
3
7
  ## v0.51.5
4
8
  - Add `Ezcater/RspecRequireGqlErrorHelpers` cop.
5
9
 
data/README.md CHANGED
@@ -83,6 +83,7 @@ is updated.
83
83
 
84
84
  ## Custom Cops
85
85
  1. [PrivateAttr](https://github.com/ezcater/ezcater_rubocop/blob/master/lib/rubocop/cop/ezcater/private_attr.rb) - Require methods from the `private_attr` gem.
86
+ 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`.
86
87
  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.
87
88
  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.
88
89
  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/conf/rubocop.yml CHANGED
@@ -14,6 +14,7 @@ Metrics/BlockLength:
14
14
  - "*.gemspec"
15
15
  - "spec/**/*.rb"
16
16
  - "lib/tasks/**/*.rake"
17
+ - "config/environments/*.rb"
17
18
 
18
19
  Metrics/CyclomaticComplexity:
19
20
  Enabled: false
data/config/default.yml CHANGED
@@ -2,6 +2,10 @@ Ezcater/PrivateAttr:
2
2
  Description: 'Require methods from the private_attr gem'
3
3
  Enabled: true
4
4
 
5
+ Ezcater/RailsConfiguration:
6
+ Description: 'Enforce the use of `Rails.configuration` instead of `Rails.application.config`.'
7
+ Enabled: true
8
+
5
9
  Ezcater/RspecDotNotSelfDot:
6
10
  Description: 'Enforce ".<class method>" instead of "self.<class method>" for example group description.'
7
11
  Enabled: true
@@ -13,6 +13,7 @@ config = RuboCop::ConfigLoader.merge_with_default(config, path)
13
13
  RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
14
14
 
15
15
  require "rubocop/cop/ezcater/private_attr"
16
+ require "rubocop/cop/ezcater/rails_configuration"
16
17
  require "rubocop/cop/ezcater/rspec_require_browser_mock"
17
18
  require "rubocop/cop/ezcater/rspec_require_feature_flag_mock"
18
19
  require "rubocop/cop/ezcater/rspec_require_gql_error_helpers"
@@ -1,3 +1,3 @@
1
1
  module EzcaterRubocop
2
- VERSION = "0.51.5".freeze
2
+ VERSION = "0.51.6".freeze
3
3
  end
@@ -0,0 +1,26 @@
1
+ module RuboCop
2
+ module Cop
3
+ module Ezcater
4
+ class RailsConfiguration < Cop
5
+ MSG = "Use `Rails.configuration` instead of `Rails.application.config`.".freeze
6
+ RAILS_CONFIGURATION = "Rails.configuration".freeze
7
+
8
+ def_node_matcher "rails_application_config", <<-PATTERN
9
+ (send (send (const _ :Rails) :application) :config)
10
+ PATTERN
11
+
12
+ def on_send(node)
13
+ rails_application_config(node) do
14
+ add_offense(node, location: :expression, message: MSG)
15
+ end
16
+ end
17
+
18
+ def autocorrect(node)
19
+ lambda do |corrector|
20
+ corrector.replace(node.source_range, RAILS_CONFIGURATION)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ 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.51.5
4
+ version: 0.51.6
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-01-15 00:00:00.000000000 Z
11
+ date: 2018-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,6 +128,7 @@ files:
128
128
  - lib/ezcater_rubocop.rb
129
129
  - lib/ezcater_rubocop/version.rb
130
130
  - lib/rubocop/cop/ezcater/private_attr.rb
131
+ - lib/rubocop/cop/ezcater/rails_configuration.rb
131
132
  - lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb
132
133
  - lib/rubocop/cop/ezcater/rspec_require_browser_mock.rb
133
134
  - lib/rubocop/cop/ezcater/rspec_require_feature_flag_mock.rb
@@ -155,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
156
  version: '0'
156
157
  requirements: []
157
158
  rubyforge_project:
158
- rubygems_version: 2.5.2
159
+ rubygems_version: 2.6.13
159
160
  signing_key:
160
161
  specification_version: 4
161
162
  summary: ezCater custom cops and shared configuration