rubocop-ordered_methods 0.14 → 0.15
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/.github/workflows/main.yml +2 -0
- data/.rubocop.yml +2 -1
- data/README.md +22 -8
- data/lib/rubocop/ordered_methods/plugin.rb +31 -0
- data/lib/rubocop/ordered_methods/version.rb +7 -0
- data/lib/rubocop/ordered_methods.rb +5 -0
- data/lib/rubocop-ordered_methods.rb +3 -4
- data/rubocop-ordered_methods.gemspec +5 -1
- metadata +20 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0d24c41c59e9fe17e2a3332f1c05f5aa0794d33c5c5f7160fd04a5ad6f202cf6
|
|
4
|
+
data.tar.gz: 61222af4166b815ced54dbfa44b68243b47add3cc06d72d08e7ad19380cb40f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffee19b6a626df2c740a60b3fed5be2a3b7efbf62160ff277b771f70e4d3c3848f1f1056f3b96028043d254408eb3b67524912891ed9eb00dccec70d028ee394
|
|
7
|
+
data.tar.gz: e79fdf0f77a109507437bafbdf03f20debcc3e270a51a34a997ae9d46464b3f06fca2261097a4f69595a454c7df2addb0e1544cc98460dcf17f8551aecaadd83
|
data/.github/workflows/main.yml
CHANGED
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
|
@@ -50,21 +50,33 @@ Or install it yourself as:
|
|
|
50
50
|
|
|
51
51
|
## Usage
|
|
52
52
|
|
|
53
|
-
You need to tell RuboCop to load the OrderedMethods extension.
|
|
54
|
-
|
|
53
|
+
You need to tell RuboCop to load the OrderedMethods extension. We support RuboCop's official plugin system as well as
|
|
54
|
+
the old `require` system.
|
|
55
55
|
|
|
56
|
-
###
|
|
56
|
+
### Plugin
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
In `.rubocop.yml`, add `rubocop-ordered_methods` to `plugins`.
|
|
59
59
|
|
|
60
60
|
```
|
|
61
|
-
|
|
61
|
+
plugins:
|
|
62
|
+
- rubocop-ordered_methods
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Command line
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
rubocop --plugin rubocop-ordered_methods
|
|
62
69
|
```
|
|
63
70
|
|
|
64
|
-
|
|
65
|
-
cops together with the standard cops.
|
|
71
|
+
### Require (deprecated)
|
|
66
72
|
|
|
67
|
-
|
|
73
|
+
In `.rubocop.yml`, add `rubocop-ordered_methods` to `require`.
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
require: rubocop-ordered_methods
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Command line
|
|
68
80
|
|
|
69
81
|
```bash
|
|
70
82
|
rubocop --require rubocop-ordered_methods
|
|
@@ -94,6 +106,8 @@ Layout/OrderedMethods:
|
|
|
94
106
|
|
|
95
107
|
### Corrector
|
|
96
108
|
|
|
109
|
+
See [Caveats](#caveats).
|
|
110
|
+
|
|
97
111
|
The corrector will attempt to order methods based on the `EnforcedStyle`. It attempts to
|
|
98
112
|
include surrounding comments and the qualifiers (e.g., aliases) listed in
|
|
99
113
|
`::RuboCop::Cop::OrderedMethodsCorrector::QUALIFIERS`. The following (monstrous)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'lint_roller'
|
|
4
|
+
|
|
5
|
+
module RuboCop
|
|
6
|
+
module OrderedMethods
|
|
7
|
+
# Official plugin system for Rubocop
|
|
8
|
+
class Plugin < LintRoller::Plugin
|
|
9
|
+
def about
|
|
10
|
+
LintRoller::About.new(
|
|
11
|
+
name: 'rubocop-ordered_methods',
|
|
12
|
+
version: RuboCop::OrderedMethods::VERSION,
|
|
13
|
+
homepage: 'https://github.com/shanecav84/rubocop-ordered_methods',
|
|
14
|
+
description: 'Check that methods are defined alphabetically per access modifier block.'
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def rules(_context)
|
|
19
|
+
LintRoller::Rules.new(
|
|
20
|
+
type: :path,
|
|
21
|
+
config_format: :rubocop,
|
|
22
|
+
value: Pathname.new(__dir__).join('../../../config/default.yml')
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def supported?(context)
|
|
27
|
+
context.engine == :rubocop
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'rubocop'
|
|
4
|
+
require_relative 'cop/layout/ordered_methods'
|
|
5
|
+
require_relative 'cop/correctors/ordered_methods_corrector'
|
|
6
|
+
require_relative 'ordered_methods/plugin'
|
|
7
|
+
|
|
3
8
|
module RuboCop
|
|
4
9
|
# Our namespace
|
|
5
10
|
module OrderedMethods
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'rubocop'
|
|
4
3
|
require_relative 'rubocop/ordered_methods'
|
|
5
|
-
require_relative 'rubocop/cop/layout/ordered_methods'
|
|
6
|
-
require_relative 'rubocop/cop/correctors/ordered_methods_corrector'
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
# We support both the old, unsupported `require` and the new, supported `plugins`
|
|
6
|
+
rubocop_version = Gem::Specification.find_by_name('rubocop').version.to_s
|
|
7
|
+
RuboCop::OrderedMethods.inject_defaults! if Gem::Version.new(rubocop_version) < Gem::Version.new('1.72')
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
lib = File.expand_path('lib', __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
|
6
|
+
require_relative 'lib/rubocop/ordered_methods/version'
|
|
7
|
+
|
|
6
8
|
Gem::Specification.new do |spec|
|
|
7
9
|
spec.name = 'rubocop-ordered_methods'
|
|
8
|
-
spec.version =
|
|
10
|
+
spec.version = RuboCop::OrderedMethods::VERSION
|
|
9
11
|
spec.authors = ['Shane Cavanaugh']
|
|
10
12
|
spec.email = ['shane@shanecav.net']
|
|
11
13
|
|
|
@@ -26,7 +28,9 @@ Gem::Specification.new do |spec|
|
|
|
26
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
27
29
|
spec.require_paths = ['lib']
|
|
28
30
|
|
|
31
|
+
spec.add_dependency 'lint_roller', '~> 1.0'
|
|
29
32
|
spec.add_dependency 'rubocop', '>= 1.0'
|
|
30
33
|
|
|
31
34
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
35
|
+
spec.metadata['default_lint_roller_plugin'] = 'RuboCop::OrderedMethods::Plugin'
|
|
32
36
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubocop-ordered_methods
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.15'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shane Cavanaugh
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-05-29 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: lint_roller
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.0'
|
|
13
26
|
- !ruby/object:Gem::Dependency
|
|
14
27
|
name: rubocop
|
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -24,7 +37,6 @@ dependencies:
|
|
|
24
37
|
- - ">="
|
|
25
38
|
- !ruby/object:Gem::Version
|
|
26
39
|
version: '1.0'
|
|
27
|
-
description:
|
|
28
40
|
email:
|
|
29
41
|
- shane@shanecav.net
|
|
30
42
|
executables: []
|
|
@@ -49,13 +61,15 @@ files:
|
|
|
49
61
|
- lib/rubocop/cop/layout/ordered_methods.rb
|
|
50
62
|
- lib/rubocop/cop/qualifier_node_matchers.rb
|
|
51
63
|
- lib/rubocop/ordered_methods.rb
|
|
64
|
+
- lib/rubocop/ordered_methods/plugin.rb
|
|
65
|
+
- lib/rubocop/ordered_methods/version.rb
|
|
52
66
|
- rubocop-ordered_methods.gemspec
|
|
53
67
|
homepage: https://github.com/shanecav84/rubocop-ordered_methods
|
|
54
68
|
licenses:
|
|
55
69
|
- MIT
|
|
56
70
|
metadata:
|
|
57
71
|
rubygems_mfa_required: 'true'
|
|
58
|
-
|
|
72
|
+
default_lint_roller_plugin: RuboCop::OrderedMethods::Plugin
|
|
59
73
|
rdoc_options: []
|
|
60
74
|
require_paths:
|
|
61
75
|
- lib
|
|
@@ -70,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
70
84
|
- !ruby/object:Gem::Version
|
|
71
85
|
version: '0'
|
|
72
86
|
requirements: []
|
|
73
|
-
rubygems_version: 3.
|
|
74
|
-
signing_key:
|
|
87
|
+
rubygems_version: 3.6.2
|
|
75
88
|
specification_version: 4
|
|
76
89
|
summary: Checks that methods are ordered alphabetically.
|
|
77
90
|
test_files: []
|