rubocop-pixelforce 2.1.0 → 2.3.1

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: 5dc1398a26eafed01afb1086e384b88c2517c59aea472adf10bf00fa7a926b32
4
- data.tar.gz: d34ff5b7a043877d940f5ab0a6ff23b6f6912d3107ab7dc26f0b9b3950a1b4d5
3
+ metadata.gz: a3bf4cf21ebe62ac220d7b9d1680012d752dac36847cfe25b7c6d33289d443b6
4
+ data.tar.gz: 6e58b8b12acdd347e4c01d60654fb1f8c74aef0ab4cb376399234a62e2135d26
5
5
  SHA512:
6
- metadata.gz: ba321811d6aea779cb44df0d90043a710b0c2d59def640d93b04a41bf4556694e82492223b9cb5c2945f9ea0a11736607785a7f048b81045cdc8e72f3f3e1cc7
7
- data.tar.gz: 2714bc7fda30fd45e994616096752dd2549e92dd114fd022a7d6f4c53f298973e4dee549071ce1a227210082bdfa054eea37b17a0f81f458418d28b3543a29f7
6
+ metadata.gz: 53afe4fe5851388b42f4a7de1c5d7cd18e1c16b843253460291ef7f8a87079201d07ce1e364ae107cbf45a1e2eabe347437d91f6af782017c650b46b781e7fac
7
+ data.tar.gz: 405f9dcfe2dfe223738fa888985767631d63b64c834471cd44d2f540828b422879f74f3ebf33424c955e0bff16f7d74bd1858f1c9aaafb204f30ce3958d90b65
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-pixelforce (2.1.0)
5
- rubocop (~> 1.21)
4
+ rubocop-pixelforce (2.3.1)
5
+ rubocop (~> 1.75)
6
6
  rubocop-performance
7
7
  rubocop-rails
8
8
 
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Rubocop::Pixelforce
2
2
 
3
- Custom Rubocop cop for PixlForce
4
-
3
+ Custom Rubocop cop for PixelForce
5
4
 
6
5
  ## Installation
7
6
 
@@ -15,14 +14,24 @@ And then execute:
15
14
 
16
15
  $ bundle
17
16
 
18
- and create .rubocop file like this
17
+ Create a `.rubocop.yml` file in your project root:
19
18
 
20
- ```
19
+ ```yaml
21
20
  inherit_gem:
22
21
  rubocop-pixelforce: default.yml
23
22
  ```
24
23
 
25
- ## Pixelforce/ClassStructure: Don't Use empty lines between same categories.
24
+ ### Dependencies
25
+
26
+ This gem automatically includes the following dependencies:
27
+ - `rubocop-performance` - for performance-related cops
28
+ - `rubocop-rails` - for Rails-specific cops
29
+
30
+ If you encounter any issues with missing cops, make sure these gems are properly installed.
31
+
32
+ ## Usage
33
+
34
+ ### Pixelforce/EmptyLineBetweenCategories: Don't Use empty lines between same categories.
26
35
 
27
36
  ```ruby
28
37
  # bad
@@ -39,7 +48,7 @@ belongs_to :category
39
48
  after_commit :update_geo_location
40
49
  ```
41
50
 
42
- ## Pixelforce/ClassStructure: Use empty lines between categories.
51
+ ### Pixelforce/EmptyLineBetweenCategories: Use empty lines between categories.
43
52
 
44
53
  ```ruby
45
54
  # bad
@@ -57,6 +66,27 @@ belongs_to :category
57
66
  after_commit :update_geo_location
58
67
  ```
59
68
 
69
+ ## Troubleshooting
70
+
71
+ ### Error: "Rails cops have been extracted to the rubocop-rails gem"
72
+
73
+ If you see this error, it means the `rubocop-rails` plugin is not properly loaded. This gem automatically includes `rubocop-rails` as a dependency, but if you're still seeing this error:
74
+
75
+ 1. Make sure you're using the latest version of this gem
76
+ 2. Run `bundle update rubocop-pixelforce` to update to the latest version
77
+ 3. Ensure your `.rubocop.yml` inherits from this gem's configuration:
78
+ ```yaml
79
+ inherit_gem:
80
+ rubocop-pixelforce: default.yml
81
+ ```
82
+
83
+ ### Error: "unrecognized cop or department"
84
+
85
+ If you see errors about unrecognized cops, make sure you have the latest version of RuboCop and this gem installed:
86
+
87
+ ```bash
88
+ bundle update rubocop rubocop-pixelforce
89
+ ```
60
90
 
61
91
  ## Development
62
92
 
@@ -66,4 +96,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
66
96
 
67
97
  ## Contributing
68
98
 
69
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rubocop-pixelforce.
99
+ Bug reports and pull requests are welcome on GitHub at https://github.com/BenZhang/rubocop-pixelforce.
data/default.yml CHANGED
@@ -1,3 +1,13 @@
1
+ # RuboCop Pixelforce Configuration
2
+ #
3
+ # This configuration requires the following gems to be installed:
4
+ # - rubocop-performance
5
+ # - rubocop-rails
6
+ #
7
+ # Make sure these are included in your Gemfile:
8
+ # gem 'rubocop-performance', require: false
9
+ # gem 'rubocop-rails', require: false
10
+
1
11
  plugins:
2
12
  - rubocop-performance
3
13
  - rubocop-rails
@@ -13,19 +23,6 @@ AllCops:
13
23
  - 'config/**/*'
14
24
  - 'test/**/*'
15
25
 
16
- Rails/UnknownEnv:
17
- Environments:
18
- - production
19
- - development
20
- - test
21
- - staging
22
-
23
- Rails/HasManyOrHasOneDependent:
24
- Enabled: false
25
-
26
- Rails/FilePath:
27
- Enabled: false
28
-
29
26
  Layout/ClassStructure: &class_structures
30
27
  Enabled: true
31
28
  ExpectedOrder:
@@ -84,24 +81,33 @@ Pixelforce/EmptyLineBetweenCategories:
84
81
  <<: *class_structures
85
82
  Enabled: true
86
83
 
87
- Layout/HashAlignment:
88
- EnforcedColonStyle: table
84
+ Lint/UselessAccessModifier:
85
+ Enabled: false
89
86
 
90
- Metrics/ModuleLength:
87
+ Lint/EmptyWhen:
91
88
  Enabled: false
92
89
 
93
- Style/NestedTernaryOperator:
90
+ Lint/UselessAssignment:
94
91
  Enabled: false
95
92
 
96
- Style/FrozenStringLiteralComment:
93
+ Lint/UnderscorePrefixedVariableName:
97
94
  Enabled: false
98
95
 
99
- Style/Documentation:
96
+ Lint/ParenthesesAsGroupedExpression:
100
97
  Enabled: false
101
98
 
99
+ Lint/AmbiguousOperator:
100
+ Enabled: false
101
+
102
+ Layout/HashAlignment:
103
+ EnforcedColonStyle: table
104
+
102
105
  Layout/LineLength:
103
106
  Enabled: false
104
107
 
108
+ Metrics/ModuleLength:
109
+ Enabled: false
110
+
105
111
  Metrics/MethodLength:
106
112
  Enabled: false
107
113
 
@@ -117,15 +123,27 @@ Metrics/ClassLength:
117
123
  Metrics/BlockLength:
118
124
  Enabled: false
119
125
 
120
- Style/IfUnlessModifier:
121
- Enabled: false
122
-
123
126
  Metrics/CyclomaticComplexity:
124
127
  Enabled: false
125
128
 
126
129
  Metrics/PerceivedComplexity:
127
130
  Enabled: false
128
131
 
132
+ Metrics/ParameterLists:
133
+ Enabled: false
134
+
135
+ Style/NestedTernaryOperator:
136
+ Enabled: false
137
+
138
+ Style/FrozenStringLiteralComment:
139
+ Enabled: false
140
+
141
+ Style/Documentation:
142
+ Enabled: false
143
+
144
+ Style/IfUnlessModifier:
145
+ Enabled: false
146
+
129
147
  Style/GuardClause:
130
148
  Enabled: false
131
149
 
@@ -141,5 +159,71 @@ Style/TernaryParentheses:
141
159
  Style/GlobalVars:
142
160
  Enabled: false
143
161
 
144
- Metrics/ParameterLists:
162
+ Style/NumericPredicate:
163
+ Enabled: false
164
+
165
+ Style/AndOr:
166
+ EnforcedStyle: conditionals
167
+
168
+ Style/MixinUsage:
169
+ Enabled: false
170
+
171
+ Naming/PredicateName:
172
+ Enabled: false
173
+
174
+ Performance/Count:
175
+ Enabled: false
176
+
177
+ # Rails cops - these require the rubocop-rails plugin to be installed
178
+ # If you get an error about Rails cops being extracted, make sure you have
179
+ # 'rubocop-rails' gem installed and listed in the plugins section above
180
+
181
+ Rails/UnknownEnv:
182
+ Environments:
183
+ - production
184
+ - development
185
+ - test
186
+ - staging
187
+ Enabled: false
188
+
189
+ Rails/HasManyOrHasOneDependent:
190
+ Enabled: false
191
+
192
+ Rails/FilePath:
193
+ Enabled: false
194
+
195
+ Rails/LexicallyScopedActionFilter:
196
+ Enabled: false
197
+
198
+ Rails/HelperInstanceVariable:
199
+ Enabled: false
200
+
201
+ Rails/OutputSafety:
202
+ Enabled: false
203
+
204
+ Rails/ApplicationRecord:
205
+ Enabled: false
206
+
207
+ Rails/InverseOf:
208
+ Enabled: false
209
+
210
+ Rails/Present:
211
+ Enabled: false
212
+
213
+ Rails/SkipsModelValidations:
214
+ Enabled: false
215
+
216
+ Rails/ActiveRecordAliases:
217
+ Enabled: false
218
+
219
+ Rails/PluralizationGrammar:
220
+ Enabled: false
221
+
222
+ Rails/FindBy:
223
+ Enabled: false
224
+
225
+ Rails/Date:
226
+ Enabled: false
227
+
228
+ Rails/HttpPositionalArguments:
145
229
  Enabled: false
@@ -27,6 +27,9 @@ module RuboCop
27
27
  previous_category = nil
28
28
 
29
29
  walk_over_nested_class_definition(class_node) do |node, category|
30
+ # Skip empty line enforcement for method definitions
31
+ next if method_definition?(node)
32
+
30
33
  if previous_category && previous_category != category
31
34
  count = blank_lines_count_between(prev_node(node), node)
32
35
  if count < 2
@@ -57,6 +60,11 @@ module RuboCop
57
60
 
58
61
  private
59
62
 
63
+ # Check if a node is a method definition
64
+ def method_definition?(node)
65
+ node.def_type? || node.defs_type?
66
+ end
67
+
60
68
  # Classifies a node to match with something in the {expected_order}
61
69
  # @param node to be analysed
62
70
  # @return String when the node type is a `:block` then
@@ -1,5 +1,5 @@
1
1
  module Rubocop
2
2
  module Pixelforce
3
- VERSION = '2.1.0'
3
+ VERSION = '2.3.1'
4
4
  end
5
5
  end
@@ -1,35 +1,35 @@
1
- lib = File.expand_path("lib", __dir__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "rubocop/pixelforce/version"
3
+ require 'rubocop/pixelforce/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "rubocop-pixelforce"
6
+ spec.name = 'rubocop-pixelforce'
7
7
  spec.version = Rubocop::Pixelforce::VERSION
8
- spec.authors = ["Ben Zhang"]
9
- spec.email = ["bzbnhang@gmail.com"]
8
+ spec.authors = ['Ben Zhang']
9
+ spec.email = ['bzbnhang@gmail.com']
10
10
 
11
- spec.summary = %q{Custom Rubocop cop for PixelForce.}
12
- spec.description = %q{Use empty lines between categories and Don't Use empty lines between same categories.}
13
- spec.homepage = "https://github.com/BenZhang/rubocop-pixelforce"
11
+ spec.summary = 'Custom Rubocop cop for PixelForce.'
12
+ spec.description = "Use empty lines between categories and Don't Use empty lines between same categories."
13
+ spec.homepage = 'https://github.com/BenZhang/rubocop-pixelforce'
14
14
 
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = "https://github.com/BenZhang/rubocop-pixelforce"
17
- spec.metadata["changelog_uri"] = "https://github.com/BenZhang/rubocop-pixelforce"
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+ spec.metadata['source_code_uri'] = 'https://github.com/BenZhang/rubocop-pixelforce'
17
+ spec.metadata['changelog_uri'] = 'https://github.com/BenZhang/rubocop-pixelforce'
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
22
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
23
  end
24
- spec.bindir = "exe"
24
+ spec.bindir = 'exe'
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
- spec.require_paths = ["lib"]
26
+ spec.require_paths = ['lib']
27
27
 
28
- spec.add_development_dependency "bundler", "~> 2.0"
29
- spec.add_development_dependency "rake", "~> 13.0"
30
- spec.add_development_dependency "rspec", "~> 3.0"
28
+ spec.add_development_dependency 'bundler', '~> 2.0'
29
+ spec.add_development_dependency 'rake', '~> 13.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
31
 
32
- spec.add_runtime_dependency "rubocop", "~> 1.21"
33
- spec.add_runtime_dependency "rubocop-performance"
34
- spec.add_runtime_dependency "rubocop-rails"
32
+ spec.add_runtime_dependency 'rubocop', '~> 1.75'
33
+ spec.add_runtime_dependency 'rubocop-performance'
34
+ spec.add_runtime_dependency 'rubocop-rails'
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-pixelforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Zhang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-28 00:00:00.000000000 Z
11
+ date: 2025-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.21'
61
+ version: '1.75'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.21'
68
+ version: '1.75'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-performance
71
71
  requirement: !ruby/object:Gem::Requirement