chefstyle 1.6.1 → 1.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/chefstyle.yml +10 -0
- data/config/disable_all.yml +8 -0
- data/config/upstream.yml +70 -17
- data/lib/chefstyle/version.rb +2 -2
- data/lib/rubocop/cop/chef/ruby/gemspec_license.rb +55 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09a2d85cec7f3a532f6250d345830f02aa055bac86a47e98dccd5689e4ad6995'
|
4
|
+
data.tar.gz: 59258f38316e7318f3749f1b6442cdbb4d8b03ded3992ba3495c9b35d40f9f33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63847b6d6f35f95b6a8b05564ac4bbb0dbc52d254783a9c0e8c7141948ab5dce16e90d300cdad141375b1315a89f93a35969155ddb8eb7762793fa7fa78f192c
|
7
|
+
data.tar.gz: dce84385ebd605042d0854d73cf096c915f66fba8d1a2b1c2cc595b3e1062b34eddddce4645f50bd779feaf7bad8ad5e6a341ec22c724f5bda076506a03393fa
|
data/config/chefstyle.yml
CHANGED
@@ -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
@@ -9,6 +9,8 @@ Bundler/InsecureProtocolSource:
|
|
9
9
|
Enabled: false
|
10
10
|
Bundler/OrderedGems:
|
11
11
|
Enabled: false
|
12
|
+
Gemspec/DateAssignment:
|
13
|
+
Enabled: false
|
12
14
|
Gemspec/DuplicatedAssignment:
|
13
15
|
Enabled: false
|
14
16
|
Gemspec/OrderedDependencies:
|
@@ -631,6 +633,8 @@ Style/GuardClause:
|
|
631
633
|
Enabled: false
|
632
634
|
Style/HashAsLastArrayItem:
|
633
635
|
Enabled: false
|
636
|
+
Style/HashConversion:
|
637
|
+
Enabled: false
|
634
638
|
Style/HashEachMethods:
|
635
639
|
Enabled: false
|
636
640
|
Style/HashExcept:
|
@@ -847,6 +851,8 @@ Style/StabbyLambdaParentheses:
|
|
847
851
|
Enabled: false
|
848
852
|
Style/StderrPuts:
|
849
853
|
Enabled: false
|
854
|
+
Style/StringChars:
|
855
|
+
Enabled: false
|
850
856
|
Style/StringConcatenation:
|
851
857
|
Enabled: false
|
852
858
|
Style/StringHashKeys:
|
@@ -893,6 +899,8 @@ Style/TrivialAccessors:
|
|
893
899
|
Enabled: false
|
894
900
|
Style/UnlessElse:
|
895
901
|
Enabled: false
|
902
|
+
Style/UnlessLogicalOperators:
|
903
|
+
Enabled: false
|
896
904
|
Style/UnpackFirst:
|
897
905
|
Enabled: false
|
898
906
|
Style/VariableInterpolation:
|
data/config/upstream.yml
CHANGED
@@ -203,6 +203,13 @@ Bundler/OrderedGems:
|
|
203
203
|
|
204
204
|
#################### Gemspec ###############################
|
205
205
|
|
206
|
+
Gemspec/DateAssignment:
|
207
|
+
Description: 'Checks that `date =` is not used in gemspec file, it is set automatically when the gem is packaged.'
|
208
|
+
Enabled: pending
|
209
|
+
VersionAdded: '1.10'
|
210
|
+
Include:
|
211
|
+
- '**/*.gemspec'
|
212
|
+
|
206
213
|
Gemspec/DuplicatedAssignment:
|
207
214
|
Description: 'An attribute assignment method calls should be listed only once in a gemspec.'
|
208
215
|
Enabled: true
|
@@ -1446,23 +1453,31 @@ Lint/Debugger:
|
|
1446
1453
|
Description: 'Check for debugger calls.'
|
1447
1454
|
Enabled: true
|
1448
1455
|
VersionAdded: '0.14'
|
1449
|
-
VersionChanged: '
|
1450
|
-
DebuggerReceivers:
|
1451
|
-
- binding
|
1452
|
-
- Kernel
|
1453
|
-
- Pry
|
1456
|
+
VersionChanged: '1.10'
|
1457
|
+
DebuggerReceivers: [] # deprecated
|
1454
1458
|
DebuggerMethods:
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1459
|
+
# Groups are available so that a specific group can be disabled in
|
1460
|
+
# a user's configuration, but are otherwise not significant.
|
1461
|
+
Kernel:
|
1462
|
+
- binding.irb
|
1463
|
+
Byebug:
|
1464
|
+
- byebug
|
1465
|
+
- remote_byebug
|
1466
|
+
- Kernel.byebug
|
1467
|
+
- Kernel.remote_byebug
|
1468
|
+
Capybara:
|
1469
|
+
- save_and_open_page
|
1470
|
+
- save_and_open_screenshot
|
1471
|
+
Pry:
|
1472
|
+
- binding.pry
|
1473
|
+
- binding.remote_pry
|
1474
|
+
- binding.pry_remote
|
1475
|
+
- Pry.rescue
|
1476
|
+
Rails:
|
1477
|
+
- debugger
|
1478
|
+
- Kernel.debugger
|
1479
|
+
WebConsole:
|
1480
|
+
- binding.console
|
1466
1481
|
|
1467
1482
|
Lint/DeprecatedClassMethods:
|
1468
1483
|
Description: 'Check for deprecated class method calls.'
|
@@ -2040,13 +2055,18 @@ Lint/SuppressedException:
|
|
2040
2055
|
StyleGuide: '#dont-hide-exceptions'
|
2041
2056
|
Enabled: true
|
2042
2057
|
AllowComments: true
|
2058
|
+
AllowNil: true
|
2043
2059
|
VersionAdded: '0.9'
|
2044
|
-
VersionChanged: '
|
2060
|
+
VersionChanged: '1.12'
|
2045
2061
|
|
2046
2062
|
Lint/SymbolConversion:
|
2047
2063
|
Description: 'Checks for unnecessary symbol conversions.'
|
2048
2064
|
Enabled: pending
|
2049
2065
|
VersionAdded: '1.9'
|
2066
|
+
EnforcedStyle: strict
|
2067
|
+
SupportedStyles:
|
2068
|
+
- strict
|
2069
|
+
- consistent
|
2050
2070
|
|
2051
2071
|
Lint/Syntax:
|
2052
2072
|
Description: 'Checks for syntax errors.'
|
@@ -2474,6 +2494,7 @@ Naming/MemoizedInstanceVariableName:
|
|
2474
2494
|
- disallowed
|
2475
2495
|
- required
|
2476
2496
|
- optional
|
2497
|
+
Safe: false
|
2477
2498
|
|
2478
2499
|
Naming/MethodName:
|
2479
2500
|
Description: 'Use the configured style when naming methods.'
|
@@ -3087,6 +3108,8 @@ Style/ConstantVisibility:
|
|
3087
3108
|
visibility declarations.
|
3088
3109
|
Enabled: false
|
3089
3110
|
VersionAdded: '0.66'
|
3111
|
+
VersionChanged: '1.10'
|
3112
|
+
IgnoreModules: false
|
3090
3113
|
|
3091
3114
|
# Checks that you have put a copyright in a comment before any code.
|
3092
3115
|
#
|
@@ -3157,6 +3180,7 @@ Style/Documentation:
|
|
3157
3180
|
Description: 'Document classes and non-namespace modules.'
|
3158
3181
|
Enabled: true
|
3159
3182
|
VersionAdded: '0.9'
|
3183
|
+
AllowedConstants: []
|
3160
3184
|
Exclude:
|
3161
3185
|
- 'spec/**/*'
|
3162
3186
|
- 'test/**/*'
|
@@ -3425,6 +3449,13 @@ Style/HashAsLastArrayItem:
|
|
3425
3449
|
- braces
|
3426
3450
|
- no_braces
|
3427
3451
|
|
3452
|
+
Style/HashConversion:
|
3453
|
+
Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
|
3454
|
+
Enabled: pending
|
3455
|
+
VersionAdded: '1.10'
|
3456
|
+
VersionChanged: '1.11'
|
3457
|
+
AllowSplatArgument: true
|
3458
|
+
|
3428
3459
|
Style/HashEachMethods:
|
3429
3460
|
Description: 'Use Hash#each_key and Hash#each_value.'
|
3430
3461
|
StyleGuide: '#hash-each'
|
@@ -3521,6 +3552,9 @@ Style/IfWithBooleanLiteralBranches:
|
|
3521
3552
|
Description: 'Checks for redundant `if` with boolean literal branches.'
|
3522
3553
|
Enabled: pending
|
3523
3554
|
VersionAdded: '1.9'
|
3555
|
+
SafeAutoCorrect: false
|
3556
|
+
AllowedMethods:
|
3557
|
+
- nonzero?
|
3524
3558
|
|
3525
3559
|
Style/IfWithSemicolon:
|
3526
3560
|
Description: 'Do not use if x; .... Use the ternary operator instead.'
|
@@ -3645,6 +3679,7 @@ Style/MethodCallWithArgsParentheses:
|
|
3645
3679
|
AllowParenthesesInMultilineCall: false
|
3646
3680
|
AllowParenthesesInChaining: false
|
3647
3681
|
AllowParenthesesInCamelCaseMethod: false
|
3682
|
+
AllowParenthesesInStringInterpolation: false
|
3648
3683
|
EnforcedStyle: require_parentheses
|
3649
3684
|
SupportedStyles:
|
3650
3685
|
- require_parentheses
|
@@ -4464,6 +4499,13 @@ Style/StderrPuts:
|
|
4464
4499
|
Enabled: true
|
4465
4500
|
VersionAdded: '0.51'
|
4466
4501
|
|
4502
|
+
Style/StringChars:
|
4503
|
+
Description: 'Checks for uses of `String#split` with empty string or regexp literal argument.'
|
4504
|
+
StyleGuide: '#string-chars'
|
4505
|
+
Enabled: pending
|
4506
|
+
Safe: false
|
4507
|
+
VersionAdded: '1.12'
|
4508
|
+
|
4467
4509
|
Style/StringConcatenation:
|
4468
4510
|
Description: 'Checks for places where string concatenation can be replaced with string interpolation.'
|
4469
4511
|
StyleGuide: '#string-interpolation'
|
@@ -4561,6 +4603,7 @@ Style/SymbolProc:
|
|
4561
4603
|
Safe: false
|
4562
4604
|
VersionAdded: '0.26'
|
4563
4605
|
VersionChanged: '1.5'
|
4606
|
+
AllowMethodsWithArguments: false
|
4564
4607
|
# A list of method names to be ignored by the check.
|
4565
4608
|
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
4566
4609
|
IgnoredMethods:
|
@@ -4713,6 +4756,16 @@ Style/UnlessElse:
|
|
4713
4756
|
Enabled: true
|
4714
4757
|
VersionAdded: '0.9'
|
4715
4758
|
|
4759
|
+
Style/UnlessLogicalOperators:
|
4760
|
+
Description: >-
|
4761
|
+
Checks for use of logical operators in an unless condition.
|
4762
|
+
Enabled: false
|
4763
|
+
VersionAdded: '1.11'
|
4764
|
+
EnforcedStyle: forbid_mixed_logical_operators
|
4765
|
+
SupportedStyles:
|
4766
|
+
- forbid_mixed_logical_operators
|
4767
|
+
- forbid_logical_operators
|
4768
|
+
|
4716
4769
|
Style/UnpackFirst:
|
4717
4770
|
Description: >-
|
4718
4771
|
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: 1.
|
4
|
+
version: 1.7.5
|
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-04-17 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.12.1
|
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.12.1
|
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
|