simplycop 2.6.0 → 2.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
  SHA256:
3
- metadata.gz: a0cb7a711b5e42ab90f75fd7970bf21c73b99e6638a9febb22810cc423481862
4
- data.tar.gz: 0377e50028a4e49a9a2001ed284d894311145793c577b59b2e9951f09e115f83
3
+ metadata.gz: 36e026ec123305bd1dce6bc595faed54010680db307d41e2117e93b311b97b60
4
+ data.tar.gz: 1f7ad07a49455a49db38ce0497950617287cea5c492257978a8b6a2522ae1fc5
5
5
  SHA512:
6
- metadata.gz: bdc980bd992ad243766ab1f20e6a9f07fb1a86dac83686b052371be3d747ab8b1e995840370cdbc357710c8a00de697967d8c203a25afbda3a0844aeecbd606f
7
- data.tar.gz: b3422fb61497052d234aa062b678e1dea9fb32d835891dbabb1ee3f527eb7cae85021ed11912c5c876a457c13f8b7bc8c86236ad3f05ffc8dd37f7d02dc0ab56
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::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, location: :selector)
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::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, location: :selector)
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::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, location: :selector)
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::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, location: :selector)
32
+ add_offense(node.loc.selector)
33
33
  end
34
34
  end
35
35
  end
@@ -12,7 +12,7 @@ module CustomCops
12
12
  #
13
13
  # not using method missing
14
14
  #
15
- class MethodMissing < RuboCop::Cop::Cop
15
+ class MethodMissing < RuboCop::Cop::Base
16
16
  MSG = 'Avoid method missing.'
17
17
 
18
18
  def on_def(node)
@@ -11,7 +11,7 @@ module CustomCops
11
11
  # #good
12
12
  # index({ reference: 1 }, { background: true })
13
13
  #
14
- class NoForegroundIndices < RuboCop::Cop::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, location: :selector) unless background_enabled?(options)
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::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, location: :selector, message: format(MSG, method: method_name))
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::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::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, location: :selector, message: message)
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::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, location: :selector) if found_match(method[0])
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::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, location: :selector) if found_match(source) && block_listed?(file_name)
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)
@@ -7,5 +7,5 @@
7
7
  #
8
8
 
9
9
  module Simplycop
10
- VERSION = '2.6.0'
10
+ VERSION = '2.7.0'
11
11
  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: 2.6.0
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-28 00:00:00.000000000 Z
11
+ date: 2024-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop