chefstyle 1.6.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chefstyle.gemspec +1 -1
- data/config/chefstyle.yml +11 -1
- data/config/disable_all.yml +14 -0
- data/config/upstream.yml +98 -19
- data/lib/chefstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/ruby/gemspec_license.rb +55 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfaf550a90523d1a1e85918799f651126cd16bb603107f9b7a9937dca76ef09e
|
4
|
+
data.tar.gz: 24f53e6cbb1c4a98b7fe26a1df6daec6ecb7f91e42433743e0a2335abfadc186
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61a9ebc0f97446ca07997fc1c1ffebbbbb05b31d2e9f59fcad330fcbe356c78f324f1c616fe79cc2020abdf6133df009c9b6da350bcabf2840d11c51a19c8a02
|
7
|
+
data.tar.gz: 1a09934e30e114355c09e32314a9647fe065ace54acfb0ac38f9b680a15e7ef029585632eb3eaf9afb90982b655ff9a8d0c65b024f4e6c8932c853c79af08945
|
data/chefstyle.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = %q{RuboCop configuration for Chef's ruby projects}
|
13
13
|
spec.homepage = "https://github.com/chef/chefstyle"
|
14
14
|
spec.license = "Apache-2.0"
|
15
|
-
spec.required_ruby_version = ">= 2.
|
15
|
+
spec.required_ruby_version = ">= 2.5"
|
16
16
|
|
17
17
|
spec.files = %w{LICENSE chefstyle.gemspec} + Dir.glob("{bin,config,lib}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
|
18
18
|
spec.executables = %w{chefstyle}
|
data/config/chefstyle.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.5
|
3
3
|
SuggestExtensions: false
|
4
4
|
|
5
5
|
#
|
@@ -710,6 +710,16 @@ Chef/Ruby/GemspecRequireRubygems:
|
|
710
710
|
Include:
|
711
711
|
- '**/*.gemspec'
|
712
712
|
|
713
|
+
Chef/Ruby/GemspecLicense:
|
714
|
+
Description: 'All gemspec files should define their license.'
|
715
|
+
Enabled: true
|
716
|
+
VersionAdded: '1.7.0'
|
717
|
+
Include:
|
718
|
+
- '**/*.gemspec'
|
719
|
+
Exclude:
|
720
|
+
- '/**/spec/**/*'
|
721
|
+
- '/**/test/**/*'
|
722
|
+
|
713
723
|
Chef/Ruby/RequireNetHttps:
|
714
724
|
Description: net/https is deprecated and just includes net/http and openssl. We should include those directly instead
|
715
725
|
Enabled: true
|
data/config/disable_all.yml
CHANGED
@@ -5,10 +5,14 @@ Bundler/DuplicatedGem:
|
|
5
5
|
Enabled: false
|
6
6
|
Bundler/GemComment:
|
7
7
|
Enabled: false
|
8
|
+
Bundler/GemVersion:
|
9
|
+
Enabled: false
|
8
10
|
Bundler/InsecureProtocolSource:
|
9
11
|
Enabled: false
|
10
12
|
Bundler/OrderedGems:
|
11
13
|
Enabled: false
|
14
|
+
Gemspec/DateAssignment:
|
15
|
+
Enabled: false
|
12
16
|
Gemspec/DuplicatedAssignment:
|
13
17
|
Enabled: false
|
14
18
|
Gemspec/OrderedDependencies:
|
@@ -145,8 +149,12 @@ Layout/MultilineOperationIndentation:
|
|
145
149
|
Enabled: false
|
146
150
|
Layout/ParameterAlignment:
|
147
151
|
Enabled: false
|
152
|
+
Layout/RedundantLineBreak:
|
153
|
+
Enabled: false
|
148
154
|
Layout/RescueEnsureAlignment:
|
149
155
|
Enabled: false
|
156
|
+
Layout/SingleLineBlockChain:
|
157
|
+
Enabled: false
|
150
158
|
Layout/SpaceAfterColon:
|
151
159
|
Enabled: false
|
152
160
|
Layout/SpaceAfterComma:
|
@@ -631,6 +639,8 @@ Style/GuardClause:
|
|
631
639
|
Enabled: false
|
632
640
|
Style/HashAsLastArrayItem:
|
633
641
|
Enabled: false
|
642
|
+
Style/HashConversion:
|
643
|
+
Enabled: false
|
634
644
|
Style/HashEachMethods:
|
635
645
|
Enabled: false
|
636
646
|
Style/HashExcept:
|
@@ -847,6 +857,8 @@ Style/StabbyLambdaParentheses:
|
|
847
857
|
Enabled: false
|
848
858
|
Style/StderrPuts:
|
849
859
|
Enabled: false
|
860
|
+
Style/StringChars:
|
861
|
+
Enabled: false
|
850
862
|
Style/StringConcatenation:
|
851
863
|
Enabled: false
|
852
864
|
Style/StringHashKeys:
|
@@ -893,6 +905,8 @@ Style/TrivialAccessors:
|
|
893
905
|
Enabled: false
|
894
906
|
Style/UnlessElse:
|
895
907
|
Enabled: false
|
908
|
+
Style/UnlessLogicalOperators:
|
909
|
+
Enabled: false
|
896
910
|
Style/UnpackFirst:
|
897
911
|
Enabled: false
|
898
912
|
Style/VariableInterpolation:
|
data/config/upstream.yml
CHANGED
@@ -130,7 +130,7 @@ AllCops:
|
|
130
130
|
# What MRI version of the Ruby interpreter is the inspected code intended to
|
131
131
|
# run on? (If there is more than one, set this to the lowest version.)
|
132
132
|
# If a value is specified for TargetRubyVersion then it is used. Acceptable
|
133
|
-
# values are specificed as a float (i.e.
|
133
|
+
# values are specificed as a float (i.e. 3.0); the teeny version of Ruby
|
134
134
|
# should not be included. If the project specifies a Ruby version in the
|
135
135
|
# .tool-versions or .ruby-version files, Gemfile or gems.rb file, RuboCop will
|
136
136
|
# try to determine the desired version of Ruby by inspecting the
|
@@ -138,7 +138,7 @@ AllCops:
|
|
138
138
|
# or gems.locked file. (Although the Ruby version is specified in the Gemfile
|
139
139
|
# or gems.rb file, RuboCop reads the final value from the lock file.) If the
|
140
140
|
# Ruby version is still unresolved, RuboCop will use the oldest officially
|
141
|
-
# supported Ruby version (currently Ruby 2.
|
141
|
+
# supported Ruby version (currently Ruby 2.5).
|
142
142
|
TargetRubyVersion: ~
|
143
143
|
# Determines if a notification for extension libraries should be shown when
|
144
144
|
# rubocop is run. Keys are the name of the extension, and values are an array
|
@@ -174,6 +174,20 @@ Bundler/GemComment:
|
|
174
174
|
IgnoredGems: []
|
175
175
|
OnlyFor: []
|
176
176
|
|
177
|
+
Bundler/GemVersion:
|
178
|
+
Description: 'Requires or forbids specifying gem versions.'
|
179
|
+
Enabled: false
|
180
|
+
VersionAdded: '1.14'
|
181
|
+
EnforcedStyle: 'required'
|
182
|
+
SupportedStyles:
|
183
|
+
- 'required'
|
184
|
+
- 'forbidden'
|
185
|
+
Include:
|
186
|
+
- '**/*.gemfile'
|
187
|
+
- '**/Gemfile'
|
188
|
+
- '**/gems.rb'
|
189
|
+
AllowedGems: []
|
190
|
+
|
177
191
|
Bundler/InsecureProtocolSource:
|
178
192
|
Description: >-
|
179
193
|
The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
|
@@ -203,6 +217,13 @@ Bundler/OrderedGems:
|
|
203
217
|
|
204
218
|
#################### Gemspec ###############################
|
205
219
|
|
220
|
+
Gemspec/DateAssignment:
|
221
|
+
Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
|
222
|
+
Enabled: pending
|
223
|
+
VersionAdded: '1.10'
|
224
|
+
Include:
|
225
|
+
- '**/*.gemspec'
|
226
|
+
|
206
227
|
Gemspec/DuplicatedAssignment:
|
207
228
|
Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
|
208
229
|
Enabled: true
|
@@ -1094,11 +1115,24 @@ Layout/ParameterAlignment:
|
|
1094
1115
|
# But it can be overridden by setting this parameter
|
1095
1116
|
IndentationWidth: ~
|
1096
1117
|
|
1118
|
+
Layout/RedundantLineBreak:
|
1119
|
+
Description: >-
|
1120
|
+
Do not break up an expression into multiple lines when it fits
|
1121
|
+
on a single line.
|
1122
|
+
Enabled: false
|
1123
|
+
InspectBlocks: false
|
1124
|
+
VersionAdded: '1.13'
|
1125
|
+
|
1097
1126
|
Layout/RescueEnsureAlignment:
|
1098
1127
|
Description: 'Align rescues and ensures correctly.'
|
1099
1128
|
Enabled: true
|
1100
1129
|
VersionAdded: '0.49'
|
1101
1130
|
|
1131
|
+
Layout/SingleLineBlockChain:
|
1132
|
+
Description: 'Put method call on a separate line if chained to a single line block.'
|
1133
|
+
Enabled: false
|
1134
|
+
VersionAdded: '1.14'
|
1135
|
+
|
1102
1136
|
Layout/SpaceAfterColon:
|
1103
1137
|
Description: 'Use spaces after colons.'
|
1104
1138
|
StyleGuide: '#spaces-operators'
|
@@ -1373,6 +1407,8 @@ Lint/AmbiguousBlockAssociation:
|
|
1373
1407
|
StyleGuide: '#syntax'
|
1374
1408
|
Enabled: true
|
1375
1409
|
VersionAdded: '0.48'
|
1410
|
+
VersionChanged: '1.13'
|
1411
|
+
IgnoredMethods: []
|
1376
1412
|
|
1377
1413
|
Lint/AmbiguousOperator:
|
1378
1414
|
Description: >-
|
@@ -1446,23 +1482,31 @@ Lint/Debugger:
|
|
1446
1482
|
Description: 'Check for debugger calls.'
|
1447
1483
|
Enabled: true
|
1448
1484
|
VersionAdded: '0.14'
|
1449
|
-
VersionChanged: '
|
1450
|
-
DebuggerReceivers:
|
1451
|
-
- binding
|
1452
|
-
- Kernel
|
1453
|
-
- Pry
|
1485
|
+
VersionChanged: '1.10'
|
1486
|
+
DebuggerReceivers: [] # deprecated
|
1454
1487
|
DebuggerMethods:
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1488
|
+
# Groups are available so that a specific group can be disabled in
|
1489
|
+
# a user's configuration, but are otherwise not significant.
|
1490
|
+
Kernel:
|
1491
|
+
- binding.irb
|
1492
|
+
Byebug:
|
1493
|
+
- byebug
|
1494
|
+
- remote_byebug
|
1495
|
+
- Kernel.byebug
|
1496
|
+
- Kernel.remote_byebug
|
1497
|
+
Capybara:
|
1498
|
+
- save_and_open_page
|
1499
|
+
- save_and_open_screenshot
|
1500
|
+
Pry:
|
1501
|
+
- binding.pry
|
1502
|
+
- binding.remote_pry
|
1503
|
+
- binding.pry_remote
|
1504
|
+
- Pry.rescue
|
1505
|
+
Rails:
|
1506
|
+
- debugger
|
1507
|
+
- Kernel.debugger
|
1508
|
+
WebConsole:
|
1509
|
+
- binding.console
|
1466
1510
|
|
1467
1511
|
Lint/DeprecatedClassMethods:
|
1468
1512
|
Description: 'Check for deprecated class method calls.'
|
@@ -2040,13 +2084,18 @@ Lint/SuppressedException:
|
|
2040
2084
|
StyleGuide: '#dont-hide-exceptions'
|
2041
2085
|
Enabled: true
|
2042
2086
|
AllowComments: true
|
2087
|
+
AllowNil: true
|
2043
2088
|
VersionAdded: '0.9'
|
2044
|
-
VersionChanged: '
|
2089
|
+
VersionChanged: '1.12'
|
2045
2090
|
|
2046
2091
|
Lint/SymbolConversion:
|
2047
2092
|
Description: 'Checks for unnecessary symbol conversions.'
|
2048
2093
|
Enabled: pending
|
2049
2094
|
VersionAdded: '1.9'
|
2095
|
+
EnforcedStyle: strict
|
2096
|
+
SupportedStyles:
|
2097
|
+
- strict
|
2098
|
+
- consistent
|
2050
2099
|
|
2051
2100
|
Lint/Syntax:
|
2052
2101
|
Description: 'Checks for syntax errors.'
|
@@ -2474,6 +2523,7 @@ Naming/MemoizedInstanceVariableName:
|
|
2474
2523
|
- disallowed
|
2475
2524
|
- required
|
2476
2525
|
- optional
|
2526
|
+
Safe: false
|
2477
2527
|
|
2478
2528
|
Naming/MethodName:
|
2479
2529
|
Description: 'Use the configured style when naming methods.'
|
@@ -3087,6 +3137,8 @@ Style/ConstantVisibility:
|
|
3087
3137
|
visibility declarations.
|
3088
3138
|
Enabled: false
|
3089
3139
|
VersionAdded: '0.66'
|
3140
|
+
VersionChanged: '1.10'
|
3141
|
+
IgnoreModules: false
|
3090
3142
|
|
3091
3143
|
# Checks that you have put a copyright in a comment before any code.
|
3092
3144
|
#
|
@@ -3157,6 +3209,7 @@ Style/Documentation:
|
|
3157
3209
|
Description: 'Document classes and non-namespace modules.'
|
3158
3210
|
Enabled: true
|
3159
3211
|
VersionAdded: '0.9'
|
3212
|
+
AllowedConstants: []
|
3160
3213
|
Exclude:
|
3161
3214
|
- 'spec/**/*'
|
3162
3215
|
- 'test/**/*'
|
@@ -3425,6 +3478,13 @@ Style/HashAsLastArrayItem:
|
|
3425
3478
|
- braces
|
3426
3479
|
- no_braces
|
3427
3480
|
|
3481
|
+
Style/HashConversion:
|
3482
|
+
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
3483
|
+
Enabled: pending
|
3484
|
+
VersionAdded: '1.10'
|
3485
|
+
VersionChanged: '1.11'
|
3486
|
+
AllowSplatArgument: true
|
3487
|
+
|
3428
3488
|
Style/HashEachMethods:
|
3429
3489
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
3430
3490
|
StyleGuide: '#hash-each'
|
@@ -3648,6 +3708,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3648
3708
|
AllowParenthesesInMultilineCall: false
|
3649
3709
|
AllowParenthesesInChaining: false
|
3650
3710
|
AllowParenthesesInCamelCaseMethod: false
|
3711
|
+
AllowParenthesesInStringInterpolation: false
|
3651
3712
|
EnforcedStyle: require_parentheses
|
3652
3713
|
SupportedStyles:
|
3653
3714
|
- require_parentheses
|
@@ -4467,6 +4528,13 @@ Style/StderrPuts:
|
|
4467
4528
|
Enabled: true
|
4468
4529
|
VersionAdded: '0.51'
|
4469
4530
|
|
4531
|
+
Style/StringChars:
|
4532
|
+
Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
|
4533
|
+
StyleGuide: '#string-chars'
|
4534
|
+
Enabled: pending
|
4535
|
+
Safe: false
|
4536
|
+
VersionAdded: '1.12'
|
4537
|
+
|
4470
4538
|
Style/StringConcatenation:
|
4471
4539
|
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4472
4540
|
StyleGuide: '#string-interpolation'
|
@@ -4564,6 +4632,7 @@ Style/SymbolProc:
|
|
4564
4632
|
Safe: false
|
4565
4633
|
VersionAdded: '0.26'
|
4566
4634
|
VersionChanged: '1.5'
|
4635
|
+
AllowMethodsWithArguments: false
|
4567
4636
|
# A list of method names to be ignored by the check.
|
4568
4637
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4569
4638
|
IgnoredMethods:
|
@@ -4716,6 +4785,16 @@ Style/UnlessElse:
|
|
4716
4785
|
Enabled: true
|
4717
4786
|
VersionAdded: '0.9'
|
4718
4787
|
|
4788
|
+
Style/UnlessLogicalOperators:
|
4789
|
+
Description: >-
|
4790
|
+
Checks for use of logical operators in an unless condition.
|
4791
|
+
Enabled: false
|
4792
|
+
VersionAdded: '1.11'
|
4793
|
+
EnforcedStyle: forbid_mixed_logical_operators
|
4794
|
+
SupportedStyles:
|
4795
|
+
- forbid_mixed_logical_operators
|
4796
|
+
- forbid_logical_operators
|
4797
|
+
|
4719
4798
|
Style/UnpackFirst:
|
4720
4799
|
Description: >-
|
4721
4800
|
Checks for accessing the first element of `String#unpack`
|
data/lib/chefstyle/version.rb
CHANGED
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright:: Chef Software, Inc.
|
4
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
module RuboCop
|
20
|
+
module Cop
|
21
|
+
module Chef
|
22
|
+
module Ruby
|
23
|
+
# All gemspec files should define their license.
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
#
|
27
|
+
# # good
|
28
|
+
# spec.license = "Apache-2.0"
|
29
|
+
#
|
30
|
+
class GemspecLicense < Base
|
31
|
+
include RangeHelp
|
32
|
+
|
33
|
+
MSG = "All gemspec files should define their license."
|
34
|
+
|
35
|
+
def_node_search :license, <<~PATTERN
|
36
|
+
(send _ {:license= :licenses=} _)
|
37
|
+
PATTERN
|
38
|
+
|
39
|
+
def_node_search :eval_method, <<~PATTERN
|
40
|
+
(send nil? {:eval :instance_eval} ... )
|
41
|
+
PATTERN
|
42
|
+
|
43
|
+
def on_new_investigation
|
44
|
+
# exit if we find a license statement or any eval since that usually happens
|
45
|
+
# when we have a windows platform gem that evals the main gemspec
|
46
|
+
return if license(processed_source.ast).first || eval_method(processed_source.ast).first
|
47
|
+
|
48
|
+
range = source_range(processed_source.buffer, 1, 0)
|
49
|
+
add_offense(range, message: MSG, severity: :warning)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chefstyle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-05 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.
|
19
|
+
version: 1.14.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.
|
26
|
+
version: 1.14.0
|
27
27
|
description:
|
28
28
|
email:
|
29
29
|
- oss@chef.io
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/chefstyle.rb
|
43
43
|
- lib/chefstyle/version.rb
|
44
44
|
- lib/rubocop/chef.rb
|
45
|
+
- lib/rubocop/cop/chef/ruby/gemspec_license.rb
|
45
46
|
- lib/rubocop/cop/chef/ruby/gemspec_require_rubygems.rb
|
46
47
|
- lib/rubocop/cop/chef/ruby/legacy_powershell_out_methods.rb
|
47
48
|
- lib/rubocop/cop/chef/ruby/require_net_https.rb
|
@@ -59,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
60
|
requirements:
|
60
61
|
- - ">="
|
61
62
|
- !ruby/object:Gem::Version
|
62
|
-
version: '2.
|
63
|
+
version: '2.5'
|
63
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
65
|
requirements:
|
65
66
|
- - ">="
|