rubocop-on-rbs 1.4.2 → 1.5.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/CHANGELOG.md +2 -0
- data/README.md +7 -4
- data/lib/rubocop/rbs/plugin.rb +29 -0
- data/lib/rubocop/rbs/version.rb +1 -1
- data/lib/rubocop/rbs.rb +0 -6
- data/lib/rubocop-on-rbs.rb +1 -4
- metadata +30 -9
- data/lib/rubocop/rbs/inject.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb5ae6ae2ad5e254a1a024cd1ec1a929ffdee7b1177c7129242f102b1d8584f5
|
4
|
+
data.tar.gz: 5746b9cf392adf155904757a34a9cfb2a98e019a235a7cd59788242bfd2242e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9ed39b9d6efafc3c3b04e821bf9749c615898250ad2d03efde2a574db350fefe5e3580017632ae23121b952a9293a5e5fe2bd4575e0d87e7e3673c8a2aad9db
|
7
|
+
data.tar.gz: 5f113ba32e6e7a1e0fb5510ad3958000b28107920d85e2e94acc79feb96dd8d42172b6565c8902136871ba129f91f20dc461544ccaa542d23fb5f10a064b9090
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -137,13 +137,13 @@ ways to do this:
|
|
137
137
|
Put this into your `.rubocop.yml`.
|
138
138
|
|
139
139
|
```yaml
|
140
|
-
|
140
|
+
plugins: rubocop-on-rbs
|
141
141
|
```
|
142
142
|
|
143
143
|
Alternatively, use the following array notation when specifying multiple extensions.
|
144
144
|
|
145
145
|
```yaml
|
146
|
-
|
146
|
+
plugins:
|
147
147
|
- rubocop-other-extension
|
148
148
|
- rubocop-on-rbs
|
149
149
|
```
|
@@ -151,10 +151,13 @@ require:
|
|
151
151
|
Now you can run `rubocop` and it will automatically load the RuboCop on RBS
|
152
152
|
cops together with the standard cops.
|
153
153
|
|
154
|
+
> [!NOTE]
|
155
|
+
> The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
|
156
|
+
|
154
157
|
### Command line
|
155
158
|
|
156
159
|
```sh
|
157
|
-
$ rubocop --
|
160
|
+
$ rubocop --plugin rubocop-on-rbs
|
158
161
|
```
|
159
162
|
|
160
163
|
### Rake task
|
@@ -163,7 +166,7 @@ $ rubocop --require rubocop-on-rbs
|
|
163
166
|
require 'rubocop/rake_task'
|
164
167
|
|
165
168
|
RuboCop::RakeTask.new do |task|
|
166
|
-
task.
|
169
|
+
task.plugins << 'rubocop-on-rbs'
|
167
170
|
end
|
168
171
|
```
|
169
172
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lint_roller'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module RBS
|
7
|
+
# A plugin that integrates RuboCop on RBS with RuboCop's plugin system.
|
8
|
+
class Plugin < LintRoller::Plugin
|
9
|
+
def about
|
10
|
+
LintRoller::About.new(
|
11
|
+
name: 'rubocop-on-rbs',
|
12
|
+
version: RuboCop::RBS::VERSION,
|
13
|
+
homepage: 'https://github.com/ksss/rubocop-on-rbs',
|
14
|
+
description: 'A RuboCop extension focused on enforcing RBS best practices and coding conventions.'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def supported?(context)
|
19
|
+
context.engine == :rubocop
|
20
|
+
end
|
21
|
+
|
22
|
+
def rules(_context)
|
23
|
+
project_root = Pathname.new(__dir__).join('../../..')
|
24
|
+
|
25
|
+
LintRoller::Rules.new(type: :path, config_format: :rubocop, value: project_root.join('config', 'default.yml'))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/rubocop/rbs/version.rb
CHANGED
data/lib/rubocop/rbs.rb
CHANGED
@@ -5,11 +5,5 @@ require_relative 'rbs/version'
|
|
5
5
|
module RuboCop
|
6
6
|
module RBS
|
7
7
|
class Error < StandardError; end
|
8
|
-
|
9
|
-
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
|
10
|
-
CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
|
11
|
-
CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
|
12
|
-
|
13
|
-
private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
|
14
8
|
end
|
15
9
|
end
|
data/lib/rubocop-on-rbs.rb
CHANGED
@@ -6,9 +6,6 @@ require_relative 'rubocop/rbs'
|
|
6
6
|
require_relative 'rubocop/rbs/version'
|
7
7
|
require_relative 'rubocop/rbs/on_type_helper'
|
8
8
|
require_relative 'rubocop/rbs/cop_base'
|
9
|
-
require_relative 'rubocop/rbs/inject'
|
10
9
|
require_relative 'rubocop/rbs/processed_rbs_source'
|
11
|
-
|
12
|
-
RuboCop::RBS::Inject.defaults!
|
13
|
-
|
10
|
+
require_relative 'rubocop/rbs/plugin'
|
14
11
|
require_relative 'rubocop/cop/rbs_cops'
|
metadata
CHANGED
@@ -1,14 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-on-rbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-03-23 00:00:00.000000000 Z
|
11
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.1'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '1.1'
|
12
26
|
- !ruby/object:Gem::Dependency
|
13
27
|
name: rbs
|
14
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -27,16 +41,22 @@ dependencies:
|
|
27
41
|
name: rubocop
|
28
42
|
requirement: !ruby/object:Gem::Requirement
|
29
43
|
requirements:
|
30
|
-
- - "
|
44
|
+
- - ">="
|
31
45
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
46
|
+
version: 1.72.1
|
47
|
+
- - "<"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.0'
|
33
50
|
type: :runtime
|
34
51
|
prerelease: false
|
35
52
|
version_requirements: !ruby/object:Gem::Requirement
|
36
53
|
requirements:
|
37
|
-
- - "
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.72.1
|
57
|
+
- - "<"
|
38
58
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
59
|
+
version: '2.0'
|
40
60
|
- !ruby/object:Gem::Dependency
|
41
61
|
name: zlib
|
42
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,8 +128,8 @@ files:
|
|
108
128
|
- lib/rubocop/cop/rbs_cops.rb
|
109
129
|
- lib/rubocop/rbs.rb
|
110
130
|
- lib/rubocop/rbs/cop_base.rb
|
111
|
-
- lib/rubocop/rbs/inject.rb
|
112
131
|
- lib/rubocop/rbs/on_type_helper.rb
|
132
|
+
- lib/rubocop/rbs/plugin.rb
|
113
133
|
- lib/rubocop/rbs/processed_rbs_source.rb
|
114
134
|
- lib/rubocop/rbs/version.rb
|
115
135
|
homepage: https://github.com/ksss/rubocop-on-rbs
|
@@ -119,6 +139,7 @@ metadata:
|
|
119
139
|
homepage_uri: https://github.com/ksss/rubocop-on-rbs
|
120
140
|
source_code_uri: https://github.com/ksss/rubocop-on-rbs
|
121
141
|
changelog_uri: https://github.com/ksss/rubocop-on-rbs
|
142
|
+
default_lint_roller_plugin: RuboCop::RBS::Plugin
|
122
143
|
rubygems_mfa_required: 'true'
|
123
144
|
rdoc_options: []
|
124
145
|
require_paths:
|
@@ -127,14 +148,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
148
|
requirements:
|
128
149
|
- - ">="
|
129
150
|
- !ruby/object:Gem::Version
|
130
|
-
version: 3.
|
151
|
+
version: 3.2.0
|
131
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
153
|
requirements:
|
133
154
|
- - ">="
|
134
155
|
- !ruby/object:Gem::Version
|
135
156
|
version: '0'
|
136
157
|
requirements: []
|
137
|
-
rubygems_version: 3.6.
|
158
|
+
rubygems_version: 3.6.6
|
138
159
|
specification_version: 4
|
139
160
|
summary: RuboCop extension for RBS file.
|
140
161
|
test_files: []
|
data/lib/rubocop/rbs/inject.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# The original code is from https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
|
4
|
-
# See https://github.com/rubocop/rubocop-rspec/blob/master/MIT-LICENSE.md
|
5
|
-
module RuboCop
|
6
|
-
module RBS
|
7
|
-
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
8
|
-
# bit of our configuration.
|
9
|
-
module Inject
|
10
|
-
def self.defaults!
|
11
|
-
path = CONFIG_DEFAULT.to_s
|
12
|
-
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
13
|
-
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
14
|
-
puts "configuration from #{path}" if ConfigLoader.debug?
|
15
|
-
config = ConfigLoader.merge_with_default(config, path)
|
16
|
-
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|