simplycop 2.6.0 → 2.7.0
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
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36e026ec123305bd1dce6bc595faed54010680db307d41e2117e93b311b97b60
|
4
|
+
data.tar.gz: 1f7ad07a49455a49db38ce0497950617287cea5c492257978a8b6a2522ae1fc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cedf098a9adbfdcb240bd45bbd8bd8ac09d6383b6d621aac6f7a3be968c2b81644886d50034c689cca00b4aafa821275eb040e103678bc14caad864431281742
|
7
|
+
data.tar.gz: 6ada823832266850960170c3ae3847dd9b3c0dd207b8f34e79d0ef1216d16d9fab30444d152f060de7044ab4fac2e54d0e3a2dc271e8415cef67c61e654170da
|
@@ -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
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.0
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|