rubocop-ordered_methods 0.13 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4d888d565f892bba920e148aa967920188045908a193d44a7a1e672fc713a66
4
- data.tar.gz: 70396bfc0679f49119a78b1e6e62d6b85492c308b93e31738c4148117a3ec6ec
3
+ metadata.gz: 0d24c41c59e9fe17e2a3332f1c05f5aa0794d33c5c5f7160fd04a5ad6f202cf6
4
+ data.tar.gz: 61222af4166b815ced54dbfa44b68243b47add3cc06d72d08e7ad19380cb40f0
5
5
  SHA512:
6
- metadata.gz: e41e772f903aae3b9d92278bd09d3568ccb189c56a5c0ffece2d0b79eb97b3e7f6f03142d04d2bef61265717b2253c4c825d9bb953d042b45bb8124aef30a99e
7
- data.tar.gz: 82ef17c01433200a393bed3fa2c812addaeb059ffc99b76b9c85287b972618f32e2b62acdbbeabe014e61dff597a490519835ab8118f7a65ae9a2123e4418e48
6
+ metadata.gz: ffee19b6a626df2c740a60b3fed5be2a3b7efbf62160ff277b771f70e4d3c3848f1f1056f3b96028043d254408eb3b67524912891ed9eb00dccec70d028ee394
7
+ data.tar.gz: e79fdf0f77a109507437bafbdf03f20debcc3e270a51a34a997ae9d46464b3f06fca2261097a4f69595a454c7df2addb0e1544cc98460dcf17f8551aecaadd83
@@ -2,9 +2,14 @@ name: CI
2
2
 
3
3
  on:
4
4
  pull_request:
5
+ paths-ignore:
6
+ - '**.md'
5
7
  push:
6
8
  branches:
7
9
  - master
10
+ paths-ignore:
11
+ - '**.md'
12
+ workflow_dispatch:
8
13
 
9
14
  jobs:
10
15
  rspec:
@@ -18,6 +23,7 @@ jobs:
18
23
  - "3.2"
19
24
  - "3.3"
20
25
  - "3.4"
26
+ - "4.0"
21
27
 
22
28
  name: "Ruby ${{ matrix.ruby }}: run rspec"
23
29
  steps:
@@ -39,6 +45,7 @@ jobs:
39
45
  - "3.2"
40
46
  - "3.3"
41
47
  - "3.4"
48
+ - "4.0"
42
49
 
43
50
  name: "Ruby ${{ matrix.ruby }}: run rubocop"
44
51
  steps:
data/.rubocop.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- require: rubocop-ordered_methods
3
+ plugins:
4
+ - rubocop-ordered_methods
4
5
 
5
6
  AllCops:
6
7
  NewCops: enable
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.14] - 2025-05-02
10
+
11
+ ### Fixed
12
+
13
+ - rubocop-ordered_methods ignores outer classes when inspecting files [#19](https://github.com/shanecav84/rubocop-ordered_methods/pull/19). Thanks, @ShkumbinDelija.
14
+
9
15
  ## [0.13] - 2024-10-01
10
16
 
11
17
  ### Fixed
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/rubocop-ordered_methods.svg)](https://badge.fury.io/rb/rubocop-ordered_methods)
2
- [![Build Status](https://travis-ci.org/shanecav84/rubocop-ordered_methods.svg?branch=master)](https://travis-ci.org/shanecav84/rubocop-ordered_methods)
2
+ [![Build Status](https://github.com/shanecav84/rubocop-ordered_methods/actions/workflows/main.yml/badge.svg)](https://github.com/shanecav84/rubocop-ordered_methods/actions)
3
3
 
4
4
  # RuboCop OrderedMethods
5
5
 
@@ -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. There are two
54
- ways to do this:
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
- ### RuboCop configuration file
56
+ ### Plugin
57
57
 
58
- Put this into your `.rubocop.yml`.
58
+ In `.rubocop.yml`, add `rubocop-ordered_methods` to `plugins`.
59
59
 
60
60
  ```
61
- require: rubocop-ordered_methods
61
+ plugins:
62
+ - rubocop-ordered_methods
62
63
  ```
63
64
 
64
- Now you can run `rubocop` and it will automatically load the RuboCop OrderedMethods
65
- cops together with the standard cops.
65
+ #### Command line
66
+
67
+ ```bash
68
+ rubocop --plugin rubocop-ordered_methods
69
+ ```
66
70
 
67
- ### Command line
71
+ ### Require (deprecated)
72
+
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)
@@ -171,6 +185,12 @@ with `Signature: sorbet`.
171
185
  def a; end
172
186
  ```
173
187
 
188
+ ## Project status
189
+
190
+ Development is ongoing. There might be extended periods between releases.
191
+ The maintenance goal is to add features as needed and to maintain compatibility
192
+ with Ruby and rubocop updates.
193
+
174
194
  ## Development
175
195
 
176
196
  ### Setup
@@ -49,8 +49,9 @@ module RuboCop
49
49
  end
50
50
 
51
51
  def on_begin(node)
52
- start_node = node.children.find(&:class_type?)&.children&.last || node
53
- check(start_node)
52
+ check(node)
53
+
54
+ node.each_descendant(:class, :module) { |descendant| check(descendant) }
54
55
  end
55
56
 
56
57
  private
@@ -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
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module OrderedMethods
5
+ VERSION = '0.15'
6
+ end
7
+ 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
- RuboCop::OrderedMethods.inject_defaults!
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 = '0.13'
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.13'
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: 2024-10-01 00:00:00.000000000 Z
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: []
@@ -33,10 +45,8 @@ extra_rdoc_files: []
33
45
  files:
34
46
  - ".github/workflows/main.yml"
35
47
  - ".gitignore"
36
- - ".rakeTasks"
37
48
  - ".rubocop.yml"
38
49
  - ".rubocop_todo.yml"
39
- - ".travis.yml"
40
50
  - CHANGELOG.md
41
51
  - CODE_OF_CONDUCT.md
42
52
  - Gemfile
@@ -51,13 +61,15 @@ files:
51
61
  - lib/rubocop/cop/layout/ordered_methods.rb
52
62
  - lib/rubocop/cop/qualifier_node_matchers.rb
53
63
  - lib/rubocop/ordered_methods.rb
64
+ - lib/rubocop/ordered_methods/plugin.rb
65
+ - lib/rubocop/ordered_methods/version.rb
54
66
  - rubocop-ordered_methods.gemspec
55
67
  homepage: https://github.com/shanecav84/rubocop-ordered_methods
56
68
  licenses:
57
69
  - MIT
58
70
  metadata:
59
71
  rubygems_mfa_required: 'true'
60
- post_install_message:
72
+ default_lint_roller_plugin: RuboCop::OrderedMethods::Plugin
61
73
  rdoc_options: []
62
74
  require_paths:
63
75
  - lib
@@ -72,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
84
  - !ruby/object:Gem::Version
73
85
  version: '0'
74
86
  requirements: []
75
- rubygems_version: 3.5.11
76
- signing_key:
87
+ rubygems_version: 3.6.2
77
88
  specification_version: 4
78
89
  summary: Checks that methods are ordered alphabetically.
79
90
  test_files: []
data/.rakeTasks DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Settings><!--This file was automatically generated by Ruby plugin.
3
- You are allowed to:
4
- 1. Remove rake task
5
- 2. Add existing rake tasks
6
- To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build rubocop-ordered_methods-0.5.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install rubocop-ordered_methods-0.5.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install rubocop-ordered_methods-0.5.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.5 and build and push rubocop-ordered_methods-0.5.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RuboCop" fullCmd="rubocop" taksId="rubocop" /><RakeGroup description="" fullCmd="" taksId="rubocop"><RakeTask description="Auto-correct RuboCop offenses" fullCmd="rubocop:auto_correct" taksId="auto_correct" /></RakeGroup><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.4
7
- - 2.5
8
- - 2.6
9
- - 2.7
10
- script: bundle exec rake
11
- before_install:
12
- - gem install bundler || gem install bundler --version '< 2'