ezcater_rubocop 0.61.1 → 1.0.0

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
  SHA256:
3
- metadata.gz: 1dd63f47a3bcd703e5aa60616979f405bda811f12de11488f001b16fb0898ae9
4
- data.tar.gz: 3d49e4d9d83e11e04672e52ac3a8c66234d517683842b6d2a91ae63b72880aad
3
+ metadata.gz: 8e1c304030fe5da5102a86e477882fa12f9132b1896f0d7b24aff2ea70a99cab
4
+ data.tar.gz: 3aa1c18e629184ba97669e1f5a095dd932e1f8b59196627e62a94a5144c10fc6
5
5
  SHA512:
6
- metadata.gz: 636d2d18f91cb5f8ca0293a88cdb3c2a5222bbf12c8969996e3e78f50c662a0037e8ad66825e2dc6ebbe4e648f37334f13fce3003042cc7eec8b7ef26f2a8a1c
7
- data.tar.gz: c300ccec1951724482cc508b82b0f5aa7453d566c3a0f84ab89b4b58a62059e501d1fd3f580c9a4b4765de993eb2bfec367389010e28e28ade9cd3c23acd7ee3
6
+ metadata.gz: 99ee7e614217065e3d9e47a442e06924e2ab53b2ccddf79ac1edbeb429a55ef4333fe9868d23f136bf8ff78aff4f163d210b52f248cf6ab9e9a03190a51bef62
7
+ data.tar.gz: c09be310e90746bae51e5858f3fef846de23c11fee2944774855b5d869639a9bb5ebc78435f8b2408dc7cafc7f1927fd7b249afba7190e3cc738ad08a312f72b
data/CHANGELOG.md CHANGED
@@ -2,9 +2,16 @@
2
2
 
3
3
  # Versioning
4
4
 
5
- NB: This gem is versioned based on the `MAJOR`.`MINOR` version of rubocop. The first release of the
5
+ This gem is moving onto its own [Semantic Versioning](https://semver.org/) scheme starting with v1.0.0. All version bumps moving forward should increment using `MAJOR.MINOR.PATCH` based on changes.
6
+
7
+ Prior to v1.0.0 this gem was versioned based on the `MAJOR`.`MINOR` version of RuboCop. The first release of the
6
8
  ezcater_rubocop gem was `v0.49.0`.
7
9
 
10
+ ## v1.0.0
11
+
12
+ - Begin using Semantic Versioning
13
+ - Delete `Ezcater/PrivateAttr`
14
+
8
15
  ## v0.61.1
9
16
  - `Layout/IndentHash` enforces consistent style
10
17
  - `Layout/IndentArray` enforces consistent style
data/README.md CHANGED
@@ -70,21 +70,10 @@ running rubocop.
70
70
 
71
71
  ## Versioning
72
72
 
73
- This gem is versioned based on the MAJOR.MINOR version of `rubocop`. The first
74
- release of the `ezcater_rubocop` gem was v0.49.0.
75
-
76
- The patch version for this gem does _not_ correspond to the patch version of
77
- `rubocop`. The patch version for this gem will change any time that one of its
78
- configurations is modified _or_ its dependency on `rubocop` is changed to require
79
- a different patch version.
80
-
81
- This gem also includes a dependency on `rubocop-rspec` that will be updated to
82
- the latest compatible version each time that the MAJOR.MINOR version of `rubocop`
83
- is updated.
73
+ This gem is using [Semantic Versioning](https://semver.org/). All version bumps should increment using `MAJOR.MINOR.PATCH` based on changes.
84
74
 
85
75
  ## Custom Cops
86
76
 
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.
88
77
  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`.
89
78
  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.
90
79
  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.
data/config/default.yml CHANGED
@@ -1,7 +1,3 @@
1
- Ezcater/PrivateAttr:
2
- Description: 'Require methods from the private_attr gem'
3
- Enabled: true
4
-
5
1
  Ezcater/RailsConfiguration:
6
2
  Description: 'Enforce the use of `Rails.configuration` instead of `Rails.application.config`.'
7
3
  Enabled: true
@@ -14,7 +14,6 @@ puts "configuration from #{DEFAULT_FILES}" if RuboCop::ConfigLoader.debug?
14
14
  config = RuboCop::ConfigLoader.merge_with_default(config, path)
15
15
  RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
16
16
 
17
- require "rubocop/cop/ezcater/private_attr"
18
17
  require "rubocop/cop/ezcater/rails_configuration"
19
18
  require "rubocop/cop/ezcater/require_gql_error_helpers"
20
19
  require "rubocop/cop/ezcater/rspec_match_ordered_array"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EzcaterRubocop
4
- VERSION = "0.61.1"
4
+ VERSION = "1.0.0"
5
5
  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.61.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ezCater, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -157,7 +157,6 @@ files:
157
157
  - ezcater_rubocop.gemspec
158
158
  - lib/ezcater_rubocop.rb
159
159
  - lib/ezcater_rubocop/version.rb
160
- - lib/rubocop/cop/ezcater/private_attr.rb
161
160
  - lib/rubocop/cop/ezcater/rails_configuration.rb
162
161
  - lib/rubocop/cop/ezcater/require_gql_error_helpers.rb
163
162
  - lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb
@@ -1,93 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RuboCop
4
- module Cop
5
- module Ezcater
6
- # This cop checks for the use of `attr_accessor`, `attr_reader`, `attr_writer`
7
- # and `alias_method` after the access modifiers `private` and `protected`
8
- # and requires the use of methods from the private_attr gem instead.
9
- #
10
- # @example
11
- #
12
- # # bad
13
- #
14
- # class C
15
- # private
16
- #
17
- # attr_accessor :foo
18
- # attr_reader :bar
19
- # attr_writer :baz
20
- # alias_method :foobar, foo
21
- # end
22
- #
23
- #
24
- # @example
25
- #
26
- # # good
27
- #
28
- # class C
29
- # private_attr_accessor :foo
30
- # private_attr_reader :bar
31
- # private_attr_writer :baz
32
- # private_alias_method :foobar, :foo
33
- #
34
- # private
35
- #
36
- # def shy
37
- # puts "hi"
38
- # end
39
- # end
40
- class PrivateAttr < Cop
41
- ATTR_METHODS = %i(attr_accessor
42
- attr_reader
43
- attr_writer).freeze
44
-
45
- ACCESS_AFFECTED_METHODS = (ATTR_METHODS + %i(alias_method)).to_set.freeze
46
-
47
- MSG = "Use `%<visibility>s_%<method_name>s` instead"
48
-
49
- def on_class(node)
50
- check_node(node.children[2]) # class body
51
- end
52
-
53
- def on_module(node)
54
- check_node(node.children[1]) # module body
55
- end
56
-
57
- private
58
-
59
- def check_node(node)
60
- return unless node&.begin_type?
61
-
62
- check_scope(node)
63
- end
64
-
65
- def format_message(visibility, method_name)
66
- format(MSG, visibility: visibility, method_name: method_name)
67
- end
68
-
69
- def check_scope(node, current_visibility = :public)
70
- node.children.reduce(current_visibility) do |visibility, child|
71
- check_child_scope(child, visibility)
72
- end
73
- end
74
-
75
- def check_child_scope(node, current_visibility)
76
- if node.send_type?
77
- if node.access_modifier? && !node.method?(:module_function)
78
- current_visibility = node.method_name
79
- elsif ACCESS_AFFECTED_METHODS.include?(node.method_name) && current_visibility != :public
80
- add_offense(node,
81
- location: :expression,
82
- message: format_message(current_visibility, node.method_name))
83
- end
84
- elsif node.kwbegin_type?
85
- check_scope(node, current_visibility)
86
- end
87
-
88
- current_visibility
89
- end
90
- end
91
- end
92
- end
93
- end