rubocop-pixelforce 2.1.0 → 2.3.0
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 +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +37 -7
- data/default.yml +27 -13
- data/lib/rubocop/cop/pixelforce/empty_line_between_categories.rb +8 -0
- data/lib/rubocop/pixelforce/version.rb +1 -1
- data/rubocop-pixelforce.gemspec +20 -20
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd94f0a6e83044823c99b918495faa1a159e902995a358d642760eb89383140e
|
4
|
+
data.tar.gz: 254b7384bd4c79bea3e4406815619c0c96ad34efea1991934bd4827e2b854620
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 778cece340e324267da10f497def005ecc4dffbdad1d10c69aedf491e051c558cd9d83211c207238fd73173caea65448b2b960c4e96ffbfd86bbf9856a90944e
|
7
|
+
data.tar.gz: 1cf1db1efbb5fd26f86b1b7121bde6f31a6d3f33e96404549dcb08daaa2b8cd334c066fbb04cd142aa5fa522a0175805fd5282fc6273fbff3e9b939601d32a8f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Rubocop::Pixelforce
|
2
2
|
|
3
|
-
Custom Rubocop cop for
|
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
|
-
|
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
|
-
|
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
|
-
|
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/
|
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:
|
@@ -142,4 +139,21 @@ Style/GlobalVars:
|
|
142
139
|
Enabled: false
|
143
140
|
|
144
141
|
Metrics/ParameterLists:
|
142
|
+
Enabled: false
|
143
|
+
|
144
|
+
# Rails cops - these require the rubocop-rails plugin to be installed
|
145
|
+
# If you get an error about Rails cops being extracted, make sure you have
|
146
|
+
# 'rubocop-rails' gem installed and listed in the plugins section above
|
147
|
+
|
148
|
+
Rails/UnknownEnv:
|
149
|
+
Environments:
|
150
|
+
- production
|
151
|
+
- development
|
152
|
+
- test
|
153
|
+
- staging
|
154
|
+
|
155
|
+
Rails/HasManyOrHasOneDependent:
|
156
|
+
Enabled: false
|
157
|
+
|
158
|
+
Rails/FilePath:
|
145
159
|
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
|
data/rubocop-pixelforce.gemspec
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
lib = File.expand_path(
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require
|
3
|
+
require 'rubocop/pixelforce/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = 'rubocop-pixelforce'
|
7
7
|
spec.version = Rubocop::Pixelforce::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
8
|
+
spec.authors = ['Ben Zhang']
|
9
|
+
spec.email = ['bzbnhang@gmail.com']
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
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[
|
16
|
-
spec.metadata[
|
17
|
-
spec.metadata[
|
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
|
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 =
|
24
|
+
spec.bindir = 'exe'
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
-
spec.require_paths = [
|
26
|
+
spec.require_paths = ['lib']
|
27
27
|
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
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
|
33
|
-
spec.add_runtime_dependency
|
34
|
-
spec.add_runtime_dependency
|
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-pixelforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Zhang
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
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.
|
68
|
+
version: '1.75'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop-performance
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|