simplycop 2.6.0 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simplycop/custom_cops/constantize.rb +2 -2
- data/lib/simplycop/custom_cops/define_method.rb +2 -2
- data/lib/simplycop/custom_cops/dont_print_all_env.rb +2 -2
- data/lib/simplycop/custom_cops/instance_eval.rb +2 -2
- data/lib/simplycop/custom_cops/method_missing.rb +1 -1
- data/lib/simplycop/custom_cops/no_foreground_indices.rb +2 -2
- data/lib/simplycop/custom_cops/timecop_without_block.rb +2 -2
- data/lib/simplycop/custom_cops/variable_name_shadowing_method.rb +1 -1
- data/lib/simplycop/security/check_for_vulnerable_code.rb +2 -2
- data/lib/simplycop/security/csrf_token_validation.rb +2 -2
- data/lib/simplycop/security/reject_all_requests_local.rb +2 -2
- data/lib/simplycop/version.rb +1 -1
- data/simplycop.gemspec +3 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: addd86c30008da3c05703d7425093665642488dd01313ae74b513d7bb12bad7c
|
4
|
+
data.tar.gz: 6f67fcf433f36ff863141309a8ae2911f0ffd127bbf7d1d7c84d6ed67054f343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b7f121afc3c949f8f2b0f00f628b2c2c81701562bf5b4ddf22523a5536df66b8fff238b57228be904404bc5b6be48005de9863d569263feb2aae3c59ea82755
|
7
|
+
data.tar.gz: adbdc7be387f16f662fc89c53d2668aee70f43fe08b787dab7fa71387455456e0d26328496632e9b595e1ad6c39f6014dcf1f14b1dc5f19a83626dcfae325862
|
@@ -10,7 +10,7 @@ module CustomCops
|
|
10
10
|
# #good
|
11
11
|
# FOO_BAR
|
12
12
|
#
|
13
|
-
class Constantize < RuboCop::Cop::
|
13
|
+
class Constantize < RuboCop::Cop::Base
|
14
14
|
MSG = 'Avoid dynamically creating constants.'
|
15
15
|
|
16
16
|
def_node_matcher :constantizing?, '(send ... :constantize)'
|
@@ -18,7 +18,7 @@ module CustomCops
|
|
18
18
|
def on_send(node)
|
19
19
|
return unless constantizing?(node)
|
20
20
|
|
21
|
-
add_offense(node
|
21
|
+
add_offense(node.loc.selector)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -15,7 +15,7 @@ module CustomCops
|
|
15
15
|
# end
|
16
16
|
# end
|
17
17
|
#
|
18
|
-
class DefineMethod < RuboCop::Cop::
|
18
|
+
class DefineMethod < RuboCop::Cop::Base
|
19
19
|
MSG = 'Avoid define_method.'
|
20
20
|
|
21
21
|
def_node_matcher :defining_method?, '(send _ :define_method ...)'
|
@@ -23,7 +23,7 @@ module CustomCops
|
|
23
23
|
def on_send(node)
|
24
24
|
return unless defining_method?(node)
|
25
25
|
|
26
|
-
add_offense(node
|
26
|
+
add_offense(node.loc.selector)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module CustomCops
|
4
|
-
class DontPrintAllEnv < RuboCop::Cop::
|
4
|
+
class DontPrintAllEnv < RuboCop::Cop::Base
|
5
5
|
# This cop checks if someone accidentally print all environment variables
|
6
6
|
# because some of them may contain secrets.
|
7
7
|
#
|
@@ -30,7 +30,7 @@ module CustomCops
|
|
30
30
|
def on_send(node)
|
31
31
|
return unless convert_env_to_hash_or_array?(node) || print_all_env_shell?(node)
|
32
32
|
|
33
|
-
add_offense(node
|
33
|
+
add_offense(node.loc.selector)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -21,7 +21,7 @@ module CustomCops
|
|
21
21
|
# end
|
22
22
|
# end
|
23
23
|
#
|
24
|
-
class InstanceEval < RuboCop::Cop::
|
24
|
+
class InstanceEval < RuboCop::Cop::Base
|
25
25
|
MSG = 'Avoid instance_eval.'
|
26
26
|
|
27
27
|
def_node_matcher :instance_evaling?, '(send _ :instance_eval ...)'
|
@@ -29,7 +29,7 @@ module CustomCops
|
|
29
29
|
def on_send(node)
|
30
30
|
return unless instance_evaling?(node)
|
31
31
|
|
32
|
-
add_offense(node
|
32
|
+
add_offense(node.loc.selector)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -11,7 +11,7 @@ module CustomCops
|
|
11
11
|
# #good
|
12
12
|
# index({ reference: 1 }, { background: true })
|
13
13
|
#
|
14
|
-
class NoForegroundIndices < RuboCop::Cop::
|
14
|
+
class NoForegroundIndices < RuboCop::Cop::Base
|
15
15
|
MSG = 'Do not create indices that lack the background flag.'
|
16
16
|
|
17
17
|
def_node_matcher :model_index?, <<~PATTERN
|
@@ -31,7 +31,7 @@ module CustomCops
|
|
31
31
|
|
32
32
|
def on_send(node)
|
33
33
|
model_index?(node) do |_fields, options|
|
34
|
-
add_offense(node
|
34
|
+
add_offense(node.loc.selector) unless background_enabled?(options)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module CustomCops
|
4
|
-
class TimecopWithoutBlock < RuboCop::Cop::
|
4
|
+
class TimecopWithoutBlock < RuboCop::Cop::Base
|
5
5
|
MSG = 'Avoid using `Timecop.%<method>s` without providing a block.'
|
6
6
|
|
7
7
|
def_node_matcher :timecop_method, '(send (const nil? :Timecop) ${:travel :freeze} ...)'
|
@@ -10,7 +10,7 @@ module CustomCops
|
|
10
10
|
timecop_method(node) do |method_name|
|
11
11
|
return if !method_name || first_child_of_block?(node) || last_child_is_a_block(node)
|
12
12
|
|
13
|
-
add_offense(node
|
13
|
+
add_offense(node.loc.selector, message: format(MSG, method: method_name))
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module CustomCops
|
4
|
-
class VariableNameShadowingMethod < RuboCop::Cop::
|
4
|
+
class VariableNameShadowingMethod < RuboCop::Cop::Base
|
5
5
|
# For each source file, Rubocop calls on_new_investigation, then walks the abstract syntax
|
6
6
|
# tree calling on_foo methods for each "foo" AST node - e.g on_begin, on_def, on_args,
|
7
7
|
# on_int, etc.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Security
|
2
|
-
class CheckForVulnerableCode < RuboCop::Cop::
|
2
|
+
class CheckForVulnerableCode < RuboCop::Cop::Base
|
3
3
|
RESULT = {}
|
4
4
|
|
5
5
|
def self.read_file
|
@@ -27,7 +27,7 @@ module Security
|
|
27
27
|
if (info = RESULT[method])
|
28
28
|
message = "Rails: Possible vulnerability found, CVE Details - #{info} "
|
29
29
|
|
30
|
-
add_offense(node
|
30
|
+
add_offense(node.loc.selector, message: message)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Security
|
2
|
-
class CSRFTokenValidation < RuboCop::Cop::
|
2
|
+
class CSRFTokenValidation < RuboCop::Cop::Base
|
3
3
|
MSG = 'Do not disable authenticity token validation'
|
4
4
|
def_node_matcher :skip_before_action, '(send _ :skip_before_action _)'
|
5
5
|
|
@@ -8,7 +8,7 @@ module Security
|
|
8
8
|
|
9
9
|
_, _, parts = *node
|
10
10
|
method = parts.node_parts
|
11
|
-
add_offense(node
|
11
|
+
add_offense(node.loc.selector) if found_match(method[0])
|
12
12
|
end
|
13
13
|
|
14
14
|
def found_match(method)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Security
|
2
|
-
class RejectAllRequestsLocal < RuboCop::Cop::
|
2
|
+
class RejectAllRequestsLocal < RuboCop::Cop::Base
|
3
3
|
RAILS_ENV = ['integration', 'staging', 'production']
|
4
4
|
|
5
5
|
MSG = "RAILS CONFIG: Restrict usage of option 'consider_all_requests_local' on #{RAILS_ENV.join(', ')} envs"
|
@@ -9,7 +9,7 @@ module Security
|
|
9
9
|
source = node.source
|
10
10
|
file_name = node.loc.operator.to_s
|
11
11
|
|
12
|
-
add_offense(node
|
12
|
+
add_offense(node.loc.selector) if found_match(source) && block_listed?(file_name)
|
13
13
|
end
|
14
14
|
|
15
15
|
def block_listed?(string)
|
data/lib/simplycop/version.rb
CHANGED
data/simplycop.gemspec
CHANGED
@@ -18,12 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.add_dependency 'rubocop', '1.67.0'
|
21
|
-
spec.add_dependency 'rubocop-ast', '1.
|
21
|
+
spec.add_dependency 'rubocop-ast', '1.33.0'
|
22
22
|
spec.add_dependency 'rubocop-capybara', '2.21.0'
|
23
23
|
spec.add_dependency 'rubocop-factory_bot', '2.26.1'
|
24
24
|
spec.add_dependency 'rubocop-performance', '1.22.1'
|
25
|
-
spec.add_dependency 'rubocop-rails', '2.
|
26
|
-
spec.add_dependency 'rubocop-rspec', '3.
|
25
|
+
spec.add_dependency 'rubocop-rails', '2.27.0'
|
26
|
+
spec.add_dependency 'rubocop-rspec', '3.2.0'
|
27
27
|
spec.add_dependency 'rubocop-rspec_rails', '2.30.0'
|
28
28
|
spec.add_development_dependency 'bundler', '>= 2.2.15'
|
29
29
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
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: 2.
|
4
|
+
version: 2.7.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: 2024-10-
|
11
|
+
date: 2024-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.33.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.33.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-capybara
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.
|
89
|
+
version: 2.27.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.
|
96
|
+
version: 2.27.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop-rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 3.
|
103
|
+
version: 3.2.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 3.
|
110
|
+
version: 3.2.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubocop-rspec_rails
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|