rubocop-openproject 0.3.0 → 0.4.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9cfe3bab3bbbc3032190c71f7e824eb2d451f854248d076aca30db79723f346b
|
|
4
|
+
data.tar.gz: b265782c32033cd8315f9a0b3bef3cb4cf7c0bdcf01d3fb85de59559fa9a9935
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cde9e717e29db386ab61514b4533f0861956fe2aefe5eeadc9b5baf0c12fb4fa3851f565c0cab2ca9919ed652c27623a45ef1f41ed9c6f2f9bce81fcf2f9aff7
|
|
7
|
+
data.tar.gz: 690ebd432e8719ba28f5bd2e146304883626dde1cdd8fab45a6dc518cf16401615c3cdab7382c258db7cc166b40baac9e512c915a26a59aafe5fbb0897d74d22
|
data/CHANGELOG.md
CHANGED
data/config/default.yml
CHANGED
|
@@ -8,6 +8,11 @@ OpenProject/NoDoEndBlockWithRSpecCapybaraMatcherInExpect:
|
|
|
8
8
|
Enabled: true
|
|
9
9
|
VersionAdded: '0.1.0'
|
|
10
10
|
|
|
11
|
+
OpenProject/NoNotImplementedError:
|
|
12
|
+
Description: 'Do not raise `NotImplementedError` to signal an unimplemented abstract method.'
|
|
13
|
+
Enabled: true
|
|
14
|
+
VersionAdded: '0.4.0'
|
|
15
|
+
|
|
11
16
|
OpenProject/NoSleepInFeatureSpecs:
|
|
12
17
|
Description: 'Avoid using `sleep` greater than 1 second in feature specs.'
|
|
13
18
|
Enabled: true
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
module OpenProject
|
|
6
|
+
# Warns against using a `NotImplementedError` exception when a method
|
|
7
|
+
# should be implemented by a subclass or including module. Ruby's
|
|
8
|
+
# `NotImplementedError` is reserved for platform-specific missing
|
|
9
|
+
# features (e.g., methods depending on `fsync` or `fork`), not for
|
|
10
|
+
# abstract method patterns.
|
|
11
|
+
#
|
|
12
|
+
# @example
|
|
13
|
+
# # bad
|
|
14
|
+
# raise NotImplementedError
|
|
15
|
+
#
|
|
16
|
+
# # bad
|
|
17
|
+
# raise NotImplementedError, "Subclasses must implement #foo"
|
|
18
|
+
#
|
|
19
|
+
# # bad
|
|
20
|
+
# raise NotImplementedError.new("Subclasses must implement #foo")
|
|
21
|
+
#
|
|
22
|
+
# # bad
|
|
23
|
+
# fail NotImplementedError
|
|
24
|
+
#
|
|
25
|
+
# # good
|
|
26
|
+
# raise NotYetImplementedError
|
|
27
|
+
#
|
|
28
|
+
# # good
|
|
29
|
+
# raise SubclassResponsibilityError, "#{self.class} must implement #foo"
|
|
30
|
+
#
|
|
31
|
+
class NoNotImplementedError < Base
|
|
32
|
+
MSG = "Do not raise `NotImplementedError` to signal an unimplemented abstract method. " \
|
|
33
|
+
"Ruby's `NotImplementedError` is reserved for platform-specific missing features. " \
|
|
34
|
+
"Raise a descriptive custom error class instead."
|
|
35
|
+
|
|
36
|
+
RESTRICT_ON_SEND = %i[raise fail].freeze
|
|
37
|
+
|
|
38
|
+
def_node_matcher :raises_not_implemented_error?, <<~PATTERN
|
|
39
|
+
{
|
|
40
|
+
(send nil? {:raise :fail} (const nil? :NotImplementedError) ...)
|
|
41
|
+
(send nil? {:raise :fail} (send (const nil? :NotImplementedError) :new ...) ...)
|
|
42
|
+
}
|
|
43
|
+
PATTERN
|
|
44
|
+
|
|
45
|
+
def on_send(node)
|
|
46
|
+
return unless raises_not_implemented_error?(node)
|
|
47
|
+
|
|
48
|
+
add_offense(node)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "open_project/add_preview_for_view_component"
|
|
4
|
+
require_relative "open_project/no_not_implemented_error"
|
|
4
5
|
require_relative "open_project/use_service_result_factory_methods"
|
|
5
6
|
require_relative "open_project/no_sleep_in_feature_specs"
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubocop-openproject
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenProject GmbH
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rubocop
|
|
@@ -40,6 +39,7 @@ files:
|
|
|
40
39
|
- config/default.yml
|
|
41
40
|
- lib/rubocop-openproject.rb
|
|
42
41
|
- lib/rubocop/cop/open_project/add_preview_for_view_component.rb
|
|
42
|
+
- lib/rubocop/cop/open_project/no_not_implemented_error.rb
|
|
43
43
|
- lib/rubocop/cop/open_project/no_sleep_in_feature_specs.rb
|
|
44
44
|
- lib/rubocop/cop/open_project/use_service_result_factory_methods.rb
|
|
45
45
|
- lib/rubocop/cop/open_project_cops.rb
|
|
@@ -54,7 +54,6 @@ metadata:
|
|
|
54
54
|
source_code_uri: https://github.com/opf/rubocop-openproject
|
|
55
55
|
changelog_uri: https://github.com/opf/rubocop-openproject/blob/main/CHANGELOG.md
|
|
56
56
|
rubygems_mfa_required: 'true'
|
|
57
|
-
post_install_message:
|
|
58
57
|
rdoc_options: []
|
|
59
58
|
require_paths:
|
|
60
59
|
- lib
|
|
@@ -69,8 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
69
68
|
- !ruby/object:Gem::Version
|
|
70
69
|
version: '0'
|
|
71
70
|
requirements: []
|
|
72
|
-
rubygems_version: 3.
|
|
73
|
-
signing_key:
|
|
71
|
+
rubygems_version: 3.6.9
|
|
74
72
|
specification_version: 4
|
|
75
73
|
summary: RuboCop cops for OpenProject
|
|
76
74
|
test_files: []
|