simplycop 2.3.2 → 2.5.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 +4 -4
- data/.custom_simplycop.yml +8 -0
- data/.simplycop_lint.yml +0 -2
- data/.simplycop_security.yml +0 -1
- data/.simplycop_style.yml +0 -2
- data/lib/simplycop/custom_cops/no_foreground_indices.rb +46 -0
- data/lib/simplycop/version.rb +1 -1
- data/simplycop.gemspec +2 -2
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd09f4e7858d5143a39f3666e79cb20bf1f458720decf82b23149d4f7aba71e1
|
4
|
+
data.tar.gz: b35dc71c87ff97229dda37d0daa3e2c1c5f5003b52b4d3c6649bcde166c9bb7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 006b209f8bf36036bf7a902c7377793c8b73c2d7683ff94dd5d175dd93f94ccef005f9fc40c8cc6e3401c24874f357c83dbaf221097be62f8e1cee7d1bc39d57
|
7
|
+
data.tar.gz: 99e00ad5963e97f95041879c72e37e34b1fb7412706d547e90652408337c62143a334dd8a6202dac9ae55c8d2f6d964f0d08ace104ec00fc7276a45183486cd7
|
data/.custom_simplycop.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require:
|
2
2
|
- './lib/simplycop/custom_cops/timecop_without_block.rb'
|
3
3
|
- './lib/simplycop/custom_cops/dont_print_all_env.rb'
|
4
|
+
- './lib/simplycop/custom_cops/no_foreground_indices.rb'
|
4
5
|
|
5
6
|
AllCops:
|
6
7
|
ExtraDetails: true
|
@@ -15,3 +16,10 @@ CustomCops/DontPrintAllEnv:
|
|
15
16
|
Enabled: true
|
16
17
|
Details: >-
|
17
18
|
This cop checks if someone accidentally print all environment variables as they may contain secrets.
|
19
|
+
|
20
|
+
CustomCops/NoForegroundIndices:
|
21
|
+
Enabled: true
|
22
|
+
Details: We want to prevent adding Mongoid indices that are not in background, otherwise the collection will lock during indexing.
|
23
|
+
|
24
|
+
Include:
|
25
|
+
- app/models/*
|
data/.simplycop_lint.yml
CHANGED
@@ -212,7 +212,6 @@ Lint/NextWithoutAccumulator:
|
|
212
212
|
Lint/NoReturnInBeginEndBlocks:
|
213
213
|
Enabled: true
|
214
214
|
|
215
|
-
# Overridden to false in Chopin
|
216
215
|
Lint/NonAtomicFileOperation:
|
217
216
|
Enabled: true
|
218
217
|
|
@@ -294,7 +293,6 @@ Lint/RequireParentheses:
|
|
294
293
|
Lint/RequireRangeParentheses:
|
295
294
|
Enabled: true
|
296
295
|
|
297
|
-
# Overridden to false in Chopin
|
298
296
|
Lint/RequireRelativeSelfPath:
|
299
297
|
Enabled: true
|
300
298
|
|
data/.simplycop_security.yml
CHANGED
data/.simplycop_style.yml
CHANGED
@@ -16,7 +16,6 @@ Style/ArgumentsForwarding:
|
|
16
16
|
Style/ArrayCoercion:
|
17
17
|
Enabled: true
|
18
18
|
|
19
|
-
# Overridden to false in Chopin
|
20
19
|
Style/ArrayIntersect:
|
21
20
|
Enabled: true
|
22
21
|
|
@@ -825,7 +824,6 @@ Style/WhileUntilDo:
|
|
825
824
|
Style/WhileUntilModifier:
|
826
825
|
Enabled: true
|
827
826
|
|
828
|
-
# Overridden to false in Chopin
|
829
827
|
Style/WordArray:
|
830
828
|
EnforcedStyle: brackets
|
831
829
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CustomCops
|
4
|
+
# This cop checks for the presence of Mongoid indexes that have not been
|
5
|
+
# flagged with the flag `background: true`.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# #bad
|
9
|
+
# index(reference: 1)
|
10
|
+
#
|
11
|
+
# #good
|
12
|
+
# index({ reference: 1 }, { background: true })
|
13
|
+
#
|
14
|
+
class NoForegroundIndices < RuboCop::Cop::Cop
|
15
|
+
MSG = 'Do not create indices that lack the background flag.'
|
16
|
+
|
17
|
+
def_node_matcher :model_index?, <<~PATTERN
|
18
|
+
(send nil? :index $...)
|
19
|
+
PATTERN
|
20
|
+
|
21
|
+
def_node_matcher :hash?, <<~PATTERN
|
22
|
+
(hash $...)
|
23
|
+
PATTERN
|
24
|
+
|
25
|
+
def_node_matcher :background_pair?, <<~PATTERN
|
26
|
+
(pair
|
27
|
+
(sym :background)
|
28
|
+
(:true)
|
29
|
+
)
|
30
|
+
PATTERN
|
31
|
+
|
32
|
+
def on_send(node)
|
33
|
+
model_index?(node) do |_fields, options|
|
34
|
+
add_offense(node, location: :selector) unless background_enabled?(options)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def background_enabled?(hash)
|
41
|
+
return false if hash.nil? || !hash?(hash)
|
42
|
+
|
43
|
+
hash.pairs.any? { |pair| background_pair?(pair) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/simplycop/version.rb
CHANGED
data/simplycop.gemspec
CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
|
|
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'
|
24
|
-
spec.add_dependency 'rubocop-performance', '1.
|
25
|
-
spec.add_dependency 'rubocop-rails', '2.26.
|
24
|
+
spec.add_dependency 'rubocop-performance', '1.22.1'
|
25
|
+
spec.add_dependency 'rubocop-rails', '2.26.2'
|
26
26
|
spec.add_dependency 'rubocop-rspec', '3.0.5'
|
27
27
|
spec.add_dependency 'rubocop-rspec_rails', '2.30.0'
|
28
28
|
spec.add_development_dependency 'bundler', '>= 2.2.15'
|
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.5.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-09-
|
11
|
+
date: 2024-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.22.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.22.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop-rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.26.
|
89
|
+
version: 2.26.2
|
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.26.
|
96
|
+
version: 2.26.2
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop-rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,6 +218,7 @@ files:
|
|
218
218
|
- lib/simplycop/custom_cops/dont_print_all_env.rb
|
219
219
|
- lib/simplycop/custom_cops/instance_eval.rb
|
220
220
|
- lib/simplycop/custom_cops/method_missing.rb
|
221
|
+
- lib/simplycop/custom_cops/no_foreground_indices.rb
|
221
222
|
- lib/simplycop/custom_cops/timecop_without_block.rb
|
222
223
|
- lib/simplycop/custom_cops/variable_name_shadowing_method.rb
|
223
224
|
- lib/simplycop/security/check_for_vulnerable_code.rb
|