cookstyle 8.6.10 → 8.7.6
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/config/chefstyle.yml +36 -0
- data/config/cookstyle.yml +36 -0
- data/lib/cookstyle/version.rb +5 -2
- data/lib/cookstyle.rb +1 -0
- data/lib/rubocop/monkey_patches/comment_config.rb +20 -0
- data/lib/rubocop/monkey_patches/registry_cop.rb +4 -6
- 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: a181e0d054a32ed0c26adfaf90fdacaa4641d4f40f06ab5042aade9648879141
|
|
4
|
+
data.tar.gz: 825d1445e28601db25cddf29ad2421156edc618fef3c0af2b18cb925f9e9877d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dba569394dc9c18f79717c37e5de26581420a2136fa3bf8c26568286ad776b5ce8ecf13f596d339d9a0b0da485ea0a97443d9c205070806bee1d1d1213483c9f
|
|
7
|
+
data.tar.gz: 39660f1933a9bb99c5b99582facf640a05784c78ca5c3dc631dc281f9adce8c0aad2ac24e9d91baf020dfac8e0f0914ae346539f4a8d2d7f65b00032d26fda6d
|
data/config/chefstyle.yml
CHANGED
|
@@ -880,6 +880,42 @@ Style/ModuleMemberExistenceCheck:
|
|
|
880
880
|
Style/NegativeArrayIndex:
|
|
881
881
|
Enabled: true
|
|
882
882
|
|
|
883
|
+
# avoid a map to single and then a join when just a join would do
|
|
884
|
+
Style/MapJoin:
|
|
885
|
+
Enabled: true
|
|
886
|
+
|
|
887
|
+
# Use .partition instead of calls to both .select and .reject
|
|
888
|
+
Style/PartitionInsteadOfDoubleSelect:
|
|
889
|
+
Enabled: true
|
|
890
|
+
|
|
891
|
+
# avoid unecessary blocks
|
|
892
|
+
Style/PredicateWithKind:
|
|
893
|
+
Enabled: true
|
|
894
|
+
|
|
895
|
+
# Use .to_h instead of rolling your own hash construction
|
|
896
|
+
Style/ReduceToHash:
|
|
897
|
+
Enabled: true
|
|
898
|
+
|
|
899
|
+
# Use .max and .min instead of max_by and min_by with a block
|
|
900
|
+
Style/RedundantMinMaxBy:
|
|
901
|
+
Enabled: true
|
|
902
|
+
|
|
903
|
+
# avoid keyword_init when it's not necessary
|
|
904
|
+
Style/RedundantStructKeywordInit:
|
|
905
|
+
Enabled: true
|
|
906
|
+
|
|
907
|
+
# avoid select and reject with an uncessary block to select on class
|
|
908
|
+
Style/SelectByKind:
|
|
909
|
+
Enabled: true
|
|
910
|
+
|
|
911
|
+
# use .grep and .grep_v for simple ranges
|
|
912
|
+
Style/SelectByRange:
|
|
913
|
+
Enabled: true
|
|
914
|
+
|
|
915
|
+
# Use new .tally method that is much simpler that group_by with a block
|
|
916
|
+
Style/TallyMethod:
|
|
917
|
+
Enabled: true
|
|
918
|
+
|
|
883
919
|
Chef/Deprecations/Ruby27KeywordArgumentWarnings:
|
|
884
920
|
Description: Pass options to shell_out helpers without the brackets to avoid Ruby 2.7 deprecation warnings.
|
|
885
921
|
Enabled: true
|
data/config/cookstyle.yml
CHANGED
|
@@ -3309,3 +3309,39 @@ Style/ModuleMemberExistenceCheck:
|
|
|
3309
3309
|
# simplify array access
|
|
3310
3310
|
Style/NegativeArrayIndex:
|
|
3311
3311
|
Enabled: true
|
|
3312
|
+
|
|
3313
|
+
# avoid a map to single and then a join when just a join would do
|
|
3314
|
+
Style/MapJoin:
|
|
3315
|
+
Enabled: true
|
|
3316
|
+
|
|
3317
|
+
# Use .partition instead of calls to both .select and .reject
|
|
3318
|
+
Style/PartitionInsteadOfDoubleSelect:
|
|
3319
|
+
Enabled: true
|
|
3320
|
+
|
|
3321
|
+
# avoid unecessary blocks
|
|
3322
|
+
Style/PredicateWithKind:
|
|
3323
|
+
Enabled: true
|
|
3324
|
+
|
|
3325
|
+
# Use .to_h instead of rolling your own hash construction
|
|
3326
|
+
Style/ReduceToHash:
|
|
3327
|
+
Enabled: true
|
|
3328
|
+
|
|
3329
|
+
# Use .max and .min instead of max_by and min_by with a block
|
|
3330
|
+
Style/RedundantMinMaxBy:
|
|
3331
|
+
Enabled: true
|
|
3332
|
+
|
|
3333
|
+
# avoid keyword_init when it's not necessary
|
|
3334
|
+
Style/RedundantStructKeywordInit:
|
|
3335
|
+
Enabled: true
|
|
3336
|
+
|
|
3337
|
+
# avoid select and reject with an uncessary block to select on class
|
|
3338
|
+
Style/SelectByKind:
|
|
3339
|
+
Enabled: true
|
|
3340
|
+
|
|
3341
|
+
# use .grep and .grep_v for simple ranges
|
|
3342
|
+
Style/SelectByRange:
|
|
3343
|
+
Enabled: true
|
|
3344
|
+
|
|
3345
|
+
# Use new .tally method that is much simpler that group_by with a block
|
|
3346
|
+
Style/TallyMethod:
|
|
3347
|
+
Enabled: true
|
data/lib/cookstyle/version.rb
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Cookstyle
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
# version of cookstyle
|
|
4
|
+
VERSION = "8.7.6" # rubocop: disable Style/StringLiterals
|
|
5
|
+
|
|
6
|
+
# version of rubocop we pin to
|
|
7
|
+
RUBOCOP_VERSION = '1.86.1'
|
|
5
8
|
end
|
data/lib/cookstyle.rb
CHANGED
|
@@ -8,6 +8,7 @@ require 'yaml' unless defined?(YAML)
|
|
|
8
8
|
gem 'rubocop', "= #{Cookstyle::RUBOCOP_VERSION}"
|
|
9
9
|
require 'rubocop'
|
|
10
10
|
require_relative 'rubocop/monkey_patches/directive_comment'
|
|
11
|
+
require_relative 'rubocop/monkey_patches/comment_config'
|
|
11
12
|
|
|
12
13
|
# monkey patches needed for the TargetChefVersion config option
|
|
13
14
|
require_relative 'rubocop/monkey_patches/config'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
# RuboCop >= 1.40.0 introduced a performance fast-path in CommentConfig that
|
|
5
|
+
# skips directive parsing when the raw source does not contain the literal
|
|
6
|
+
# string "rubocop". Because Cookstyle also supports "# cookstyle:disable"
|
|
7
|
+
# directives, we must also check for "cookstyle" so that those directives
|
|
8
|
+
# are not silently ignored.
|
|
9
|
+
class CommentConfig
|
|
10
|
+
alias_method :original_initialize, :initialize
|
|
11
|
+
|
|
12
|
+
def initialize(processed_source)
|
|
13
|
+
original_initialize(processed_source)
|
|
14
|
+
# Re-evaluate @no_directives to also consider "cookstyle" comments
|
|
15
|
+
if @no_directives && processed_source.raw_source.include?('cookstyle')
|
|
16
|
+
@no_directives = false
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -3,12 +3,10 @@ module RuboCop
|
|
|
3
3
|
module Cop
|
|
4
4
|
class Registry
|
|
5
5
|
# we monkeypatch this warning to replace rubocop with cookstyle
|
|
6
|
-
def
|
|
7
|
-
message = "
|
|
8
|
-
if path.end_with?('.rb')
|
|
9
|
-
|
|
10
|
-
end
|
|
11
|
-
warn message
|
|
6
|
+
def print_department_missing_warning(name, path)
|
|
7
|
+
message = "no department given for #{name}."
|
|
8
|
+
message += ' Run `cookstyle -a --only Migration/DepartmentName` to fix.' if path.end_with?('.rb')
|
|
9
|
+
emit_warning(path, message)
|
|
12
10
|
end
|
|
13
11
|
end
|
|
14
12
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cookstyle
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.6
|
|
4
|
+
version: 8.7.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thom May
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-06-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rubocop
|
|
@@ -17,14 +17,14 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - '='
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: 1.
|
|
20
|
+
version: 1.86.1
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - '='
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: 1.
|
|
27
|
+
version: 1.86.1
|
|
28
28
|
description:
|
|
29
29
|
email:
|
|
30
30
|
- thom@chef.io
|
|
@@ -312,6 +312,7 @@ files:
|
|
|
312
312
|
- lib/rubocop/cop/target_chef_version.rb
|
|
313
313
|
- lib/rubocop/monkey_patches/allow_invalid_ruby.rb
|
|
314
314
|
- lib/rubocop/monkey_patches/base.rb
|
|
315
|
+
- lib/rubocop/monkey_patches/comment_config.rb
|
|
315
316
|
- lib/rubocop/monkey_patches/config.rb
|
|
316
317
|
- lib/rubocop/monkey_patches/directive_comment.rb
|
|
317
318
|
- lib/rubocop/monkey_patches/registry_cop.rb
|