rubocop-betterment 1.6.0 → 1.7.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe0109185da03f1c923006903de0336b09941de2
|
4
|
+
data.tar.gz: f7ce1a98024ba65910f624b84d4e316f47975ed6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60cffaab104cc7bcb8ac220073ed67a2c32b1f64758dafae509220ec6b213d40489a31c64c1a6bc0231242578a1fa1c70a8ef3288299d162f095b7c6ad6ed952
|
7
|
+
data.tar.gz: 08795fe114125cfa3dcc398756097394505393f85713be356847571608cf6e8612ff212e50541667bdc3688aed86643025948c83f80ff3706d35422b043deb1a
|
data/config/default.yml
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# please keep this file alphabetically ordered!
|
2
2
|
|
3
|
-
require:
|
4
|
-
|
3
|
+
require:
|
4
|
+
- rubocop/cop/betterment.rb
|
5
|
+
- rubocop-rspec
|
5
6
|
|
6
7
|
AllCops:
|
7
8
|
Exclude:
|
@@ -17,6 +18,11 @@ AllCops:
|
|
17
18
|
DisplayStyleGuide: true
|
18
19
|
DisplayCopNames: true
|
19
20
|
|
21
|
+
Betterment/SitePrismLoaded:
|
22
|
+
Include:
|
23
|
+
- 'spec/features/**/*_spec.rb'
|
24
|
+
- 'spec/system/**/*_spec.rb'
|
25
|
+
|
20
26
|
Capybara/FeatureMethods:
|
21
27
|
Enabled: false
|
22
28
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module RuboCop
|
2
|
+
module Cop
|
3
|
+
module Betterment
|
4
|
+
class SitePrismLoaded < Cop
|
5
|
+
MSG = 'Use `be_loaded` instead of `be_displayed`'.freeze
|
6
|
+
|
7
|
+
def_node_matcher :be_displayed_call?, <<-PATTERN
|
8
|
+
(send (send nil? :expect _) _ (send nil? :be_displayed))
|
9
|
+
PATTERN
|
10
|
+
|
11
|
+
def on_send(node)
|
12
|
+
return unless be_displayed_call?(node)
|
13
|
+
|
14
|
+
add_offense(node, location: node.children[2].loc.expression)
|
15
|
+
end
|
16
|
+
|
17
|
+
def autocorrect(node)
|
18
|
+
lambda do |corrector|
|
19
|
+
corrector.replace(node.children[2].loc.expression, 'be_loaded')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -4,13 +4,14 @@ module RuboCop
|
|
4
4
|
class Timeout < Cop
|
5
5
|
MSG = 'Using Timeout.timeout without a custom exception can prevent rescue blocks from executing'.freeze
|
6
6
|
|
7
|
+
def_node_matcher :timeout_call?, <<-PATTERN
|
8
|
+
(send (const nil? :Timeout) :timeout _)
|
9
|
+
PATTERN
|
10
|
+
|
7
11
|
def on_send(node)
|
8
|
-
|
9
|
-
target_method = :timeout
|
12
|
+
return unless timeout_call?(node)
|
10
13
|
|
11
|
-
|
12
|
-
add_offense(node, location: node.source_range)
|
13
|
-
end
|
14
|
+
add_offense(node)
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-betterment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Development
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- config/default.yml
|
93
93
|
- lib/rubocop/cop/betterment.rb
|
94
94
|
- lib/rubocop/cop/betterment/memoization_with_arguments.rb
|
95
|
+
- lib/rubocop/cop/betterment/site_prism_loaded.rb
|
95
96
|
- lib/rubocop/cop/betterment/timeout.rb
|
96
97
|
homepage:
|
97
98
|
licenses:
|