simplycop 1.7.3 → 1.8.1
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: a1826e5017b51de501d8edc54dd6100d4d561855cab74f820e3cc05cfc3e634f
|
4
|
+
data.tar.gz: c893eea27d6d1c111c6534e8eac64a14a152d460c14968fd86749a936efae52a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 127c38e256808577ec45d688b603b51ef65cb9e17c70e235b1475a7d302f6965f4a692cc28817c6c08755faa6d8a976a9abde92103faaf6376a857f9a855e055
|
7
|
+
data.tar.gz: a01b1754ebcb30bbaaa1393c084949f8846eccb787073c6b75e57d995ca4a2680854d95482e3e6feceb6ee13c6ae8cecbf7ebaeaad877f8ca455e44ca2db70b2
|
data/.custom_simplycop.yml
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
name: "Dobby action"
|
2
3
|
on:
|
3
4
|
issue_comment:
|
4
5
|
types: [created]
|
@@ -6,10 +7,20 @@ jobs:
|
|
6
7
|
pr_commented:
|
7
8
|
runs-on: ubuntu-20.04
|
8
9
|
if: startsWith(github.event.comment.body, '/dobby')
|
9
|
-
|
10
|
+
env:
|
11
|
+
BUNDLE_WITHOUT: "development:test"
|
10
12
|
steps:
|
11
|
-
- name:
|
12
|
-
uses:
|
13
|
+
- name: Chekcout action
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
with:
|
16
|
+
repository: 'simplybusiness/dobby'
|
17
|
+
ref: 'v3.0.0'
|
18
|
+
- name: Set up ruby
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
bundler-cache: true
|
22
|
+
- name: Bump version
|
23
|
+
uses: simplybusiness/dobby@v3.0.0
|
13
24
|
env:
|
14
25
|
DOBBY_APP_ID: ${{ secrets.DOBBY_APP_ID }}
|
15
26
|
DOBBY_PRIVATE_KEY: ${{ secrets.DOBBY_PRIVATE_KEY }}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CustomCops
|
4
|
+
class VariableNameShadowingMethod < RuboCop::Cop::Cop
|
5
|
+
# For each source file, Rubocop calls on_new_investigation, then walks the abstract syntax
|
6
|
+
# tree calling on_foo methods for each "foo" AST node - e.g on_begin, on_def, on_args,
|
7
|
+
# on_int, etc.
|
8
|
+
|
9
|
+
# We need to do two passes over the source so that we can find all the method names before
|
10
|
+
# we start looking at the nodes that assign local variables (some methods may be defined
|
11
|
+
# _after_ code that assigns shadowing local variables. We do the first one in
|
12
|
+
# on_new_investigation
|
13
|
+
|
14
|
+
def_node_search :method_names, <<~PATTERN
|
15
|
+
(:def $_ ...)
|
16
|
+
PATTERN
|
17
|
+
|
18
|
+
def on_new_investigation
|
19
|
+
ast = processed_source.ast
|
20
|
+
@declared_method_names = ast ? method_names(processed_source.ast).to_a : []
|
21
|
+
end
|
22
|
+
|
23
|
+
def on_lvasgn(node)
|
24
|
+
if @declared_method_names.include?(node.name)
|
25
|
+
add_offense(
|
26
|
+
node,
|
27
|
+
message: "Shadowing method name - `#{node.name}`."
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/simplycop/version.rb
CHANGED
data/simplycop.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_dependency 'rubocop', '~> 1.12.1'
|
21
21
|
spec.add_dependency 'rubocop-rails', '~> 2.9.0'
|
22
22
|
spec.add_dependency 'rubocop-rspec', '~> 2.2.0'
|
23
|
-
spec.add_development_dependency 'bundler'
|
23
|
+
spec.add_development_dependency 'bundler', '>= 2.2.15'
|
24
24
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplycop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simply Business
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.2.15
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.2.15
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/simplycop/custom_cops/instance_eval.rb
|
133
133
|
- lib/simplycop/custom_cops/method_missing.rb
|
134
134
|
- lib/simplycop/custom_cops/timecop_without_block.rb
|
135
|
+
- lib/simplycop/custom_cops/variable_name_shadowing_method.rb
|
135
136
|
- lib/simplycop/security/check_for_vulnerable_code.rb
|
136
137
|
- lib/simplycop/security/csrf_token_validation.rb
|
137
138
|
- lib/simplycop/security/reject_all_requests_local.rb
|