chefstyle 1.6.2 → 1.7.1

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: 6d8cb295371355b2366f70ad030e7d6aa1d5f300f39c16f21198cc93b878898c
4
- data.tar.gz: 31b65eb4a0f60baf333369f8e6374029e57d03750db142afcc34e74b8c45b276
3
+ metadata.gz: 83ab4efcaac7ca6e5d7d3d2453685273ac015024fd39d0ef1db3a1f2a1e8d84f
4
+ data.tar.gz: ba401d9837304e9327bd6c6749ffbdd34ba76790c967cb4dd6989fa2a354595c
5
5
  SHA512:
6
- metadata.gz: 736367eff801ef343b7f6bcd67b5896c9343913ac2de3620748a99814f1714d5b5db78ea4e8e743abe6447d5ca30dceb7dd813b79c7c8b45788ecf0bdbbe76c0
7
- data.tar.gz: 313c8f7ad2918ed7c839cb7dbe5e87e8810b3ac266c8ae2b7c4ffacb9efb6fdd820c04e1b55d552fbde0fb309053c3c82664b57fa8ecf3a42dc6bb67d1bf45cf
6
+ metadata.gz: a6ec0f6ea2b3ec795bc4762b7944945754690babae83889a49f281b6683282653ec4b2cc955a0868ef13c6ee57451242c67e1fd07587a7222436bb1220a0c7c1
7
+ data.tar.gz: d7ec55522948386fd693fda2c3c3a5e81b69c07217c0e42216374237da42f1aeedf30c2f3b8f176ee0f92e6202da094ad3996083c67511aa84dffedbf811a9a4
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
@@ -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:
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: '0.49'
1450
- DebuggerReceivers:
1451
- - binding
1452
- - Kernel
1453
- - Pry
1456
+ VersionChanged: '1.10'
1457
+ DebuggerReceivers: [] # deprecated
1454
1458
  DebuggerMethods:
1455
- - debugger
1456
- - byebug
1457
- - remote_byebug
1458
- - pry
1459
- - remote_pry
1460
- - pry_remote
1461
- - console
1462
- - rescue
1463
- - save_and_open_page
1464
- - save_and_open_screenshot
1465
- - irb
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.'
@@ -3087,6 +3102,8 @@ Style/ConstantVisibility:
3087
3102
  visibility declarations.
3088
3103
  Enabled: false
3089
3104
  VersionAdded: '0.66'
3105
+ VersionChanged: '1.10'
3106
+ IgnoreModules: false
3090
3107
 
3091
3108
  # Checks that you have put a copyright in a comment before any code.
3092
3109
  #
@@ -3425,6 +3442,11 @@ Style/HashAsLastArrayItem:
3425
3442
  - braces
3426
3443
  - no_braces
3427
3444
 
3445
+ Style/HashConversion:
3446
+ Description: 'Avoid Hash[] in favor of ary.to_h or literal hashes.'
3447
+ Enabled: pending
3448
+ VersionAdded: '1.10'
3449
+
3428
3450
  Style/HashEachMethods:
3429
3451
  Description: 'Use Hash#each_key and Hash#each_value.'
3430
3452
  StyleGuide: '#hash-each'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Chefstyle
3
- VERSION = "1.6.2"
4
- RUBOCOP_VERSION = "1.9.1"
3
+ VERSION = "1.7.1"
4
+ RUBOCOP_VERSION = "1.10.0"
5
5
  end
@@ -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.6.2
4
+ version: 1.7.1
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-02-01 00:00:00.000000000 Z
11
+ date: 2021-02-15 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.9.1
19
+ version: 1.10.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.9.1
26
+ version: 1.10.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