betterlint 1.31.0 → 1.32.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/README.md +13 -0
- data/config/default.yml +5 -0
- data/lib/betterlint/version.rb +1 -1
- data/lib/rubocop/cop/betterment/no_not_implemented_error.rb +18 -0
- data/lib/rubocop/cop/betterment.rb +1 -0
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 255b819071945ceaf2a26dd9897a310a52a04bb79c67a06b87195257938e5812
|
|
4
|
+
data.tar.gz: d1b308edd9873869d15a079934dd04ac9cf0d883909cea13eacec04b582eecbd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a253ddffc5c77897adf1d17dc59e684b702dfdc6329adb7f5acaf8b75d2b4e6d70cf6775e1728113f88bca797dc1e73003f1eace2acb5dbdff9a9b5d55baf388
|
|
7
|
+
data.tar.gz: 7b26e11e5d09c6b5a5d823c02225a81c15c196630781e220b968e0f11ad23930622702e2d731b28b5b0f7758c305463bde614813c81cb274cfb2179200b86521
|
data/README.md
CHANGED
|
@@ -471,6 +471,19 @@ end
|
|
|
471
471
|
|
|
472
472
|
This cop is disabled by default, because it reports many offenses in applications with older specs. To use it, enable it in your `.rubocop.yml`. By default it examines all files in `spec/`, except for the `features`, `requests`, `routing`, `system`, and `views` directories, where integration style tests that don't test one class and method are common. Examples in shared example groups are also ignored.
|
|
473
473
|
|
|
474
|
+
### Betterment/NoNotImplementedError
|
|
475
|
+
|
|
476
|
+
Ruby's [`NotImplementedError`](https://docs.ruby-lang.org/en/3.4/NotImplementedError.html) signals a feature unavailable on the current platform. It inherits from `ScriptError`, so a bare `rescue` won't catch it.
|
|
477
|
+
This cop flags direct references to the exception in application code, including in `raise`, `rescue`, and inheritance. It does not autocorrect, because the replacement depends on what failed.
|
|
478
|
+
If you need to handle a genuine platform limitation, scope the rescue to the platform call and disable the cop on that line.
|
|
479
|
+
|
|
480
|
+
The cop is disabled by default. To enable it:
|
|
481
|
+
|
|
482
|
+
```yaml
|
|
483
|
+
Betterment/NoNotImplementedError:
|
|
484
|
+
Enabled: true
|
|
485
|
+
```
|
|
486
|
+
|
|
474
487
|
### Betterment/NoSend
|
|
475
488
|
|
|
476
489
|
This cop flags calls to `send`, `public_send`, and `__send__`. Dynamic dispatch hides the call from Sorbet and code search, and `send` also reaches private methods. Call the method directly instead.
|
data/config/default.yml
CHANGED
|
@@ -70,6 +70,11 @@ Betterment/NoDownMigrations:
|
|
|
70
70
|
Include:
|
|
71
71
|
- db/migrate/**/*.rb
|
|
72
72
|
|
|
73
|
+
Betterment/NoNotImplementedError:
|
|
74
|
+
Description: Disallows direct references to Ruby's NotImplementedError in application code.
|
|
75
|
+
Enabled: false
|
|
76
|
+
StyleGuide: '#bettermentnonotimplementederror'
|
|
77
|
+
|
|
73
78
|
Betterment/NoSend:
|
|
74
79
|
Description: Detects dynamic method calls through send, public_send and __send__.
|
|
75
80
|
StyleGuide: '#bettermentnosend'
|
data/lib/betterlint/version.rb
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
module Betterment
|
|
6
|
+
class NoNotImplementedError < Base
|
|
7
|
+
MSG = 'Ruby reserves `NotImplementedError` for platform limitations. Use an abstract method or a specific application error.'
|
|
8
|
+
|
|
9
|
+
# @!method not_implemented_error?(node)
|
|
10
|
+
def_node_matcher :not_implemented_error?, '(const {nil? (cbase) (const {nil? (cbase)} :Object)} :NotImplementedError)'
|
|
11
|
+
|
|
12
|
+
def on_const(node)
|
|
13
|
+
add_offense(node) if not_implemented_error?(node)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -13,6 +13,7 @@ require 'rubocop/cop/betterment/implicit_redirect_type'
|
|
|
13
13
|
require 'rubocop/cop/betterment/internals_protection'
|
|
14
14
|
require 'rubocop/cop/betterment/memoization_with_arguments'
|
|
15
15
|
require 'rubocop/cop/betterment/no_down_migrations'
|
|
16
|
+
require 'rubocop/cop/betterment/no_not_implemented_error'
|
|
16
17
|
require 'rubocop/cop/betterment/no_send'
|
|
17
18
|
require 'rubocop/cop/betterment/non_namespaced_class'
|
|
18
19
|
require 'rubocop/cop/betterment/non_standard_actions'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: betterlint
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.32.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Development
|
|
@@ -180,6 +180,7 @@ files:
|
|
|
180
180
|
- lib/rubocop/cop/betterment/internals_protection.rb
|
|
181
181
|
- lib/rubocop/cop/betterment/memoization_with_arguments.rb
|
|
182
182
|
- lib/rubocop/cop/betterment/no_down_migrations.rb
|
|
183
|
+
- lib/rubocop/cop/betterment/no_not_implemented_error.rb
|
|
183
184
|
- lib/rubocop/cop/betterment/no_send.rb
|
|
184
185
|
- lib/rubocop/cop/betterment/non_namespaced_class.rb
|
|
185
186
|
- lib/rubocop/cop/betterment/non_standard_actions.rb
|
|
@@ -205,10 +206,10 @@ licenses:
|
|
|
205
206
|
- MIT
|
|
206
207
|
metadata:
|
|
207
208
|
homepage_uri: https://github.com/Betterment/betterlint
|
|
208
|
-
source_code_uri: https://github.com/Betterment/betterlint/tree/v1.
|
|
209
|
-
changelog_uri: https://github.com/Betterment/betterlint/blob/v1.
|
|
209
|
+
source_code_uri: https://github.com/Betterment/betterlint/tree/v1.32.0
|
|
210
|
+
changelog_uri: https://github.com/Betterment/betterlint/blob/v1.32.0/CHANGELOG.md
|
|
210
211
|
bug_tracker_uri: https://github.com/Betterment/betterlint/issues
|
|
211
|
-
documentation_uri: https://www.rubydoc.info/gems/betterlint/1.
|
|
212
|
+
documentation_uri: https://www.rubydoc.info/gems/betterlint/1.32.0
|
|
212
213
|
rubygems_mfa_required: 'true'
|
|
213
214
|
default_lint_roller_plugin: Betterlint::Plugin
|
|
214
215
|
rdoc_options: []
|
|
@@ -225,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
225
226
|
- !ruby/object:Gem::Version
|
|
226
227
|
version: '0'
|
|
227
228
|
requirements: []
|
|
228
|
-
rubygems_version: 4.0.
|
|
229
|
+
rubygems_version: 4.0.21
|
|
229
230
|
specification_version: 4
|
|
230
231
|
summary: Betterment rubocop configuration
|
|
231
232
|
test_files: []
|