simplycop 2.5.1 → 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: 32233ac04e05b8eaa2eacd1a2ed2dc38981c8ef4725b41d073f219b080e0b7ba
4
- data.tar.gz: 85951b31a81a50dc644f84db1ab954f302a0962d000eadd3a1174fd060418f13
3
+ metadata.gz: 36e026ec123305bd1dce6bc595faed54010680db307d41e2117e93b311b97b60
4
+ data.tar.gz: 1f7ad07a49455a49db38ce0497950617287cea5c492257978a8b6a2522ae1fc5
5
5
  SHA512:
6
- metadata.gz: bea04e7808dc0a45505501df3bbb446439d794924f165917bf3996e4f708e398879674fc54dadb12e71fb0828b8fbee6c6c8d31727bfdff5ddcd53c974692adc
7
- data.tar.gz: 3c9579c9ef3ae908af9172059867142d71800ee005f5da567eb751a1a1ea88ac63d7f59e2502a1b1298b87899108946dc9e95794c44565a85b5a48461540c969
6
+ metadata.gz: cedf098a9adbfdcb240bd45bbd8bd8ac09d6383b6d621aac6f7a3be968c2b81644886d50034c689cca00b4aafa821275eb040e103678bc14caad864431281742
7
+ data.tar.gz: 6ada823832266850960170c3ae3847dd9b3c0dd207b8f34e79d0ef1216d16d9fab30444d152f060de7044ab4fac2e54d0e3a2dc271e8415cef67c61e654170da
data/.simplycop_lint.yml CHANGED
@@ -93,6 +93,9 @@ Lint/DuplicateRequire:
93
93
  Lint/DuplicateRescueException:
94
94
  Enabled: true
95
95
 
96
+ Lint/DuplicateSetElement:
97
+ Enabled: true
98
+
96
99
  Lint/EachWithObjectArgument:
97
100
  Enabled: true
98
101
 
data/.simplycop_rspec.yml CHANGED
@@ -314,10 +314,8 @@ RSpec/SpecFilePathFormat:
314
314
  RSpec/SpecFilePathSuffix:
315
315
  Enabled: true
316
316
 
317
- # Added in Rubocop RSpec 3.1.0 but no docs available at that point
318
- # so avoid enabling until consequences and default config are clearly documented
319
- # RSpec/StringAsInstanceDoubleConstant:
320
- # Enabled: true
317
+ RSpec/StringAsInstanceDoubleConstant:
318
+ Enabled: true
321
319
 
322
320
  RSpec/StubbedMock:
323
321
  Enabled: false
@@ -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.5.1'
10
+ VERSION = '2.7.0'
11
11
  end
data/simplycop.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_dependency 'rubocop', '1.66.1'
20
+ spec.add_dependency 'rubocop', '1.67.0'
21
21
  spec.add_dependency 'rubocop-ast', '1.32.3'
22
22
  spec.add_dependency 'rubocop-capybara', '2.21.0'
23
23
  spec.add_dependency 'rubocop-factory_bot', '2.26.1'
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.5.1
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-07 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
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.66.1
19
+ version: 1.67.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.66.1
26
+ version: 1.67.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-ast
29
29
  requirement: !ruby/object:Gem::Requirement