cookstyle 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a37a4a7a9ec43c83e6085e8971b23619ecbc3856bb23e809e1e75bd862b9969
4
- data.tar.gz: 6c0985615bebda8f779282554a089be993b8d3bb92efdcad2a52b46cef7a79a8
3
+ metadata.gz: aeeb9f2df11ca3427f17df1c4e2ccf8b0adc510276bcd395cf9e20a02714dd96
4
+ data.tar.gz: 1d5bccf02c9b86b0080641b8192249bd0b5aaabfb8bbe3403f4e46dec715bdd5
5
5
  SHA512:
6
- metadata.gz: 92eb8d8eb33a6523c05c29013f670305d17ac480a0e992081ebcd15fc2a6b716ccd59fe6889ed87c0f1f098f853343d67035664021b98023a739ba3cc40a8302
7
- data.tar.gz: 420492d447f9d021f3a1b98074f7e12d0e4b5268ede661fb5db3d79bedf24672373548c247b825a80d114dff7ca68605db795d1db8279ffb392a8842a7c5b85d
6
+ metadata.gz: c81f0e25b0cd9234a4d7c5efb8a62c97f5c4765f395adce9047af577768838162299b7130ce63bce5525274fef2592480b08e4bdde50d683d471dd9eaa6c3e96
7
+ data.tar.gz: e654324057aa0be6abd35dad2dae215358594861930c712b737f2cc745b97606c219d9bab92459aea5d958cd6c364e0037d5e8c833d3f6545eb7902b4ec3eead
File without changes
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- encoding: utf-8 -*-
3
3
 
4
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w[.. lib])
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w(.. lib))
5
5
 
6
- require "cookstyle"
6
+ require 'cookstyle'
7
7
 
8
- if ARGV.size == 1 && %w[-v --version].include?(ARGV.first)
8
+ if ARGV.size == 1 && %w(-v --version).include?(ARGV.first)
9
9
  puts "Cookstyle #{Cookstyle::VERSION}"
10
- print " * RuboCop "
10
+ print ' * RuboCop '
11
11
  end
12
12
 
13
- load Gem.bin_path("rubocop", "rubocop")
13
+ load Gem.bin_path('rubocop', 'rubocop')
@@ -230,3 +230,9 @@ Style/UnpackFirst:
230
230
  # simplify how you get the min or max of an array
231
231
  Performance/UnneededSort:
232
232
  Enable: true
233
+
234
+ Style/SymbolProc:
235
+ # A list of method names to be ignored by the check.
236
+ # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
237
+ IgnoredMethods:
238
+ - lazy
@@ -1,19 +1,19 @@
1
- require "cookstyle/version"
1
+ require 'cookstyle/version'
2
2
 
3
3
  # ensure the desired target version of RuboCop is gem activated
4
- gem "rubocop", "= #{Cookstyle::RUBOCOP_VERSION}"
5
- require "rubocop"
4
+ gem 'rubocop', "= #{Cookstyle::RUBOCOP_VERSION}"
5
+ require 'rubocop'
6
6
 
7
7
  module RuboCop
8
8
  class ConfigLoader
9
9
  RUBOCOP_HOME.gsub!(
10
10
  /^.*$/,
11
- File.realpath(File.join(File.dirname(__FILE__), ".."))
11
+ File.realpath(File.join(File.dirname(__FILE__), '..'))
12
12
  )
13
13
 
14
14
  DEFAULT_FILE.gsub!(
15
15
  /^.*$/,
16
- File.join(RUBOCOP_HOME, "config", "default.yml")
16
+ File.join(RUBOCOP_HOME, 'config', 'default.yml')
17
17
  )
18
18
  end
19
19
  end
@@ -1,4 +1,4 @@
1
1
  module Cookstyle
2
- VERSION = "3.0.0".freeze
3
- RUBOCOP_VERSION = "0.55.0".freeze
2
+ VERSION = '3.0.1'.freeze
3
+ RUBOCOP_VERSION = '0.55.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cookstyle
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May
8
+ - Tim Smith
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2018-05-07 00:00:00.000000000 Z
12
+ date: 2018-12-11 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -28,16 +29,16 @@ dependencies:
28
29
  name: rake
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - "~>"
32
+ - - ">="
32
33
  - !ruby/object:Gem::Version
33
- version: '12.0'
34
+ version: '0'
34
35
  type: :development
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - "~>"
39
+ - - ">="
39
40
  - !ruby/object:Gem::Version
40
- version: '12.0'
41
+ version: '0'
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: rspec
43
44
  requirement: !ruby/object:Gem::Requirement
@@ -69,19 +70,13 @@ dependencies:
69
70
  description:
70
71
  email:
71
72
  - thom@chef.io
73
+ - tsmith@chef.io
72
74
  executables:
73
75
  - cookstyle
74
76
  extensions: []
75
77
  extra_rdoc_files: []
76
78
  files:
77
- - ".gitignore"
78
- - ".rspec"
79
- - ".travis.yml"
80
- - CHANGELOG.md
81
- - Gemfile
82
- - LICENSE.txt
83
- - README.md
84
- - Rakefile
79
+ - LICENSE
85
80
  - bin/cookstyle
86
81
  - config/cookstyle.yml
87
82
  - config/cookstyle_base.yml
@@ -90,7 +85,6 @@ files:
90
85
  - config/disabled.yml
91
86
  - config/enabled.yml
92
87
  - config/upstream.yml
93
- - cookstyle.gemspec
94
88
  - lib/cookstyle.rb
95
89
  - lib/cookstyle/version.rb
96
90
  homepage: https://github.com/chef/cookstyle
@@ -113,8 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
107
  version: '0'
114
108
  requirements: []
115
109
  rubyforge_project:
116
- rubygems_version: 2.7.5
110
+ rubygems_version: 2.7.7
117
111
  signing_key:
118
112
  specification_version: 4
119
- summary: Rubocop configuration for Chef cookbooks
113
+ summary: RuboCop configuration for Chef cookbooks
120
114
  test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,16 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- dist: trusty
4
- sudo: false
5
-
6
- branches:
7
- only:
8
- - master
9
-
10
- # Early warning system to catch if Rubygems breaks something
11
- before_install:
12
- - gem update --system
13
-
14
- rvm:
15
- - 2.3.4
16
- - 2.4.1
@@ -1,116 +0,0 @@
1
- # Cookstyle Changelog
2
-
3
- ## 3.0.0 (2018-05-07)
4
-
5
- The RuboCop engine has been updated from 0.49 to 0.55 in this release of Cookstyle. This fixes a very large number of bugs and may lead to new warnings being shown for existing rules. Additionally the names of many rules were changed which may require updating your .rubocop.yml files if you previously disabled these rules.
6
-
7
- ### Newly Enabled Cops:
8
-
9
- - Bundler/InsecureProtocolSource
10
- - Layout/EmptyComment
11
- - Layout/EmptyLinesAroundArguments
12
- - Lint/BigDecimalNew
13
- - Lint/BooleanSymbol
14
- - Lint/InterpolationCheck:
15
- - Lint/RedundantWithIndex
16
- - Lint/RedundantWithObject
17
- - Lint/RegexpInCondition
18
- - Lint/ShadowedArgument
19
- - Lint/UnneededCopEnableDirective
20
- - Lint/UnneededRequireStatement
21
- - Lint/UriRegexp
22
- - Performance/UnneededSort
23
- - Performance/UriDefaultParser
24
- - Style/MinMax
25
- - Style/RedundantConditional
26
- - Style/TrailingBodyOnMethodDefinition
27
- - Style/UnpackFirst
28
-
29
- ## 2.2.0 (2017-12-6)
30
-
31
- - Style/GuardClause disabled as it forces consistency that may sacrifice readability in a cookbook.
32
-
33
- ## 2.1.0 (2017-08-24)
34
-
35
- - The Layout/EndOfLine cop now enforces a LF for line endings. This prevents users on Windows from seeing the "Carriage return character missing" error message.
36
-
37
- ## 2.0.0 (2017-05-31)
38
-
39
- ### Security Update
40
-
41
- Rubocop has been upgraded from 0.47.1 to 0.49.1 to resolve <http://www.cvedetails.com/cve/CVE-2017-8418/>. Unfortunately between these versions a large number of rules were moved from the style namespace to the layout namespace. If you previously enabled/disabled whitespace or layout related rules in your own .rubocop.yml there is a good chance you'll need to update your config.
42
-
43
- ### Newly Enabled Cops:
44
-
45
- - Style/YodaCondition which alerts on backwards and confusing condition logic
46
- - Layout/EmptyLinesAroundExceptionHandlingKeywords which makes our empty line policy more consistent when using exception handling
47
-
48
- ## 1.4.0 (2017-05-30)
49
-
50
- - Our configuration of Lint/AmbiguousRegexpLiteral now ignores files in the test dir even if you run Cookstyle against a chef-repo directory instead of individual cookbook directories.
51
- - We now explicitly set TargetRubyVersion to 2.0, as Ruby 2.0 shipped in older Chef 12 releases.
52
-
53
- ### Newly Disabled Cops:
54
-
55
- - BlockLength which completes Cookstyle ignoring length in cookbooks.
56
- - Performance/Casecmp which resulted in confusing code.
57
-
58
- ## 1.3.1 (2017-04-17)
59
-
60
- ### Newly Disabled Cops:
61
-
62
- - Style/DoubleNegation which is needed in some situations to avoid Chef deprecation warnings
63
-
64
- ## 1.3.0 (2017-02-13)
65
-
66
- - Upgraded the Rubocop engine from 0.46 -> 0.47.1, but disabled all new cops. This aligns cookstyle with the Rubocop in Chefstyle and also resolves multiple bugs in Rubocop 0.46\. If you previously disabled the Lint/Eval cop in your own Rubocop config you'll need to update that with the new cop name of Security/Eval.
67
-
68
- ## 1.2.0 (2017-01-19)
69
-
70
- - Change Style/NumericPredicate to use comparisons. We found that cookstyle autocorrecting code from foo == 0 to foo.zero? was breaking a lot of cookbooks. Additionally .zero? is significantly slower than just using foo == 0.
71
-
72
- ## 1.1.1 (2016-12-22)
73
-
74
- - Properly disabled the correct cop to avoid warning on InSpec matchers: Lint/AmbiguousRegexpLiteral
75
-
76
- ## 1.1.0 (2016-12-13)
77
-
78
- ### Newly Disabled Cops:
79
-
80
- - All Rails cops since they don't apply to us
81
- - Metrics/ClassLength
82
-
83
- ## 1.0.1 (2016-12-12)
84
-
85
- ### Newly Disabled Cops:
86
-
87
- - Style/TernaryParentheses
88
-
89
- ### Newly Enabled Cops:
90
-
91
- - Lint/ShadowedException
92
-
93
- ## 1.0.0 (2016-12-12)
94
-
95
- ### Newly Disabled Cops:
96
-
97
- - Metrics/CyclomaticComplexity
98
- - Style/NumericLiterals
99
- - Style/RegexpLiteral in /tests/ directory
100
- - Style/AsciiComments
101
-
102
- ### Newly Enabled Cops:
103
-
104
- - Bundler/DuplicatedGem
105
- - Style/SpaceInsideArrayPercentLiteral
106
- - Style/NumericPredicate
107
- - Style/EmptyCaseCondition
108
- - Style/EachForSimpleLoop
109
- - Style/PreferredHashMethods
110
- - Lint/UnifiedInteger
111
- - Lint/PercentSymbolArray
112
- - Lint/PercentStringArray
113
- - Lint/EmptyWhen
114
- - Lint/EmptyExpression
115
- - Lint/DuplicateCaseCondition
116
- - Style/TrailingCommaInLiteral
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in cookstyle.gemspec
4
- gemspec
data/README.md DELETED
@@ -1,109 +0,0 @@
1
- # Cookstyle - Sane rubocop defaults for Chef Cookbooks
2
-
3
- [![Gem Version](https://badge.fury.io/rb/cookstyle.svg)](https://badge.fury.io/rb/cookstyle) [![Build Status](https://travis-ci.org/chef/cookstyle.svg?branch=master)](https://travis-ci.org/chef/cookstyle)
4
-
5
- Cookstyle is a set of opinions about Ruby code that are specific to cookbooks. Running both cookstyle and RuboCop on the same codebase will result, by design, in changes being applied and then removed. Needless to say you should _not_ use both tools on the same cookbook.
6
-
7
- Cookstyle is infrequently updated, since the rule set is mature and fairly stable. We sync new RuboCop versions when there's advantage to doing so, but are conservative by default.
8
-
9
- Cookstyle is included in the ChefDK, and can be used from the command line by running `cookstyle`.
10
-
11
- The active ruleset is in the [config/cookstyle.yml](https://github.com/chef/cookstyle/blob/master/config/cookstyle.yml) file. Changes to the rule set must be accompanied by arguments and code demonstrating why the change should be made, and in most cases we would expect the author of the change to help with updating the core community cookbooks.
12
-
13
- ## How It Works
14
-
15
- The project itself is a derivative of [finstyle](https://github.com/fnichol/finstyle), but starts with all rules disabled. Cookstyle has a direct dependency on one specific version of RuboCop (at a time), and [patches it][patch] to load the [upstream configuration][upstream] and [custom set][config] of rule updates. When a new RuboCop release comes out, this library can rev its pinned version dependency and [re-vendor][rakefile] the upstream configuration to determine if any breaking style or lint rules were added/dropped/reversed/etc.
16
-
17
- ## NOTE CAREFULLY ABOUT UPDATING COOKSTYLE
18
-
19
- This is designed to allow bumping the RuboCop engine while keeping backwards compatibility with the config and not requiring all the cookbooks to update.
20
-
21
- The [cookstyle_base.yml](https://github.com/chef/cookstyle/blob/master/config/cookstyle_base.yml) file is (essentially) the enabled.yml file from 0.37.2 (as of this writing) which is applied on top of 0.55.0 with all the rules disabled. It pins the default enabled set to 0.37.2 compatibility while running under the 0.55.0 engine.
22
-
23
- There is no rake task for updating the `cookstyle_base.yml` file. It was generated by hand -- the Description and other fields need to be dropped out of it.
24
-
25
- It may be necessary to edit that file (again by hand) to resolve issues with later RuboCop engines changing cop names (renaming, splitting up, etc).
26
-
27
- Occasionally the `cookstyle_base.yml` file should be updated, which will generate a lot of work to fix every cookbook that cookstyle runs against.
28
-
29
- When updating to a new engine the `rake vendor` task should still always be run in order to update the base set of cops and generate the default disabled.yml ruleset.
30
-
31
- When editing the `cookstyle_base.yml` becomes too much of a PITA, it may be time to bump the engine, run `rake vendor` and then drop the new `enabled.yml` into `cookstyle_base.yml`, fix it up, and ship it and then deal with the fallout of all the new cops...
32
-
33
- ## Installation
34
-
35
- Cookstyle is included in the [ChefDK](https://downloads.chef.io/chefdk). If you choose not to use ChefDK, you can still install Cookstyle manually using the instructions below.
36
-
37
- Add this line to your application's Gemfile:
38
-
39
- ```ruby
40
- gem 'cookstyle'
41
- ```
42
-
43
- And then execute:
44
-
45
- ```
46
- $ bundle
47
- ```
48
-
49
- Or install it yourself as:
50
-
51
- ```
52
- $ gem install cookstyle
53
- ```
54
-
55
- ## Usage
56
-
57
- ### Vanilla RuboCop
58
-
59
- Run RuboCop as normal, simply add a `-r cookstyle` option when running:
60
-
61
- ```sh
62
- rubocop -r cookstyle -D --format offenses
63
- ```
64
-
65
- ### cookstyle Command
66
-
67
- Use this tool just as you would RuboCop, but invoke the `cookstyle` binary instead which patches RuboCop to load rules from the cookstyle gem. For example:
68
-
69
- ```sh
70
- cookstyle -D --format offenses
71
- ```
72
-
73
- ### Rake
74
-
75
- In a Rakefile, the setup is exactly the same, except you need to require the cookstyle library first:
76
-
77
- ```ruby
78
- require "cookstyle"
79
- require "rubocop/rake_task"
80
- RuboCop::RakeTask.new do |task|
81
- task.options << "--display-cop-names"
82
- end
83
- ```
84
-
85
- ### guard-rubocop
86
-
87
- You can use one of two methods. The simplest is to add the `-r cookstyle` option to the `:cli` option in your Guardfile:
88
-
89
- ```ruby
90
- guard :rubocop, cli: "-r cookstyle" do
91
- watch(%r{.+\.rb$})
92
- watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
93
- end
94
- ```
95
-
96
- Alternatively you could pass the path to Cookstyle's configuration by using the `Cookstyle.config` method:
97
-
98
- ```ruby
99
- require "cookstyle"
100
-
101
- guard :rubocop, cli: "--config #{Cookstyle.config}" do
102
- watch(%r{.+\.rb$})
103
- watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
104
- end
105
- ```
106
-
107
- ### .rubocop.yml
108
-
109
- As with vanilla RuboCop, any custom settings can still be placed in a `.rubocop.yml` file in the root of your project.
data/Rakefile DELETED
@@ -1,30 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- upstream = Gem::Specification.find_by_name("rubocop")
4
-
5
- desc "Vendor rubocop-#{upstream.version} configuration into gem"
6
- task :vendor do
7
- src = Pathname.new(upstream.gem_dir).join("config")
8
- dst = Pathname.new(__FILE__).dirname.join("config")
9
-
10
- mkdir_p dst
11
- cp(src.join("default.yml"), dst.join("upstream.yml"))
12
- cp(src.join("enabled.yml"), dst.join("enabled.yml"))
13
- cp(src.join("disabled.yml"), dst.join("disabled.yml"))
14
-
15
- require 'rubocop'
16
- require 'yaml'
17
- cfg = RuboCop::Cop::Cop.all.inject({}) { |acc, cop| acc[cop.cop_name] = {"Enabled" => false}; acc }
18
- File.open(dst.join("disable_all.yml"), "w"){|fh| fh.write cfg.to_yaml }
19
-
20
- sh %{git add #{dst}/{upstream,enabled,disabled,disable_all}.yml}
21
- sh %{git commit -m "Vendor rubocop-#{upstream.version} upstream configuration."}
22
- end
23
-
24
- require "cookstyle"
25
- require "rubocop/rake_task"
26
- RuboCop::RakeTask.new(:style) do |task|
27
- task.options << "--display-cop-names"
28
- end
29
-
30
- task default: [:build, :install]
@@ -1,25 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'cookstyle/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "cookstyle"
8
- spec.version = Cookstyle::VERSION
9
- spec.authors = ["Thom May"]
10
- spec.email = ["thom@chef.io"]
11
-
12
- spec.summary = %q{Rubocop configuration for Chef cookbooks}
13
- spec.homepage = "https://github.com/chef/cookstyle"
14
- spec.license = "Apache-2.0"
15
- spec.required_ruby_version = ">= 2.1"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.executables = %w[cookstyle]
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.10"
22
- spec.add_development_dependency "rake", "~> 12.0"
23
- spec.add_development_dependency "rspec"
24
- spec.add_dependency("rubocop", Cookstyle::RUBOCOP_VERSION)
25
- end