chefstyle 0.11.0 → 0.11.2
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/Gemfile +22 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/chefstyle.gemspec +25 -0
- data/lib/chefstyle/version.rb +1 -1
- metadata +12 -11
- data/README.md +0 -136
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e26762f4088c8da0c654c85b10f475d664004764ec2fc726b82a2aec25f3fe9
|
|
4
|
+
data.tar.gz: e7813e1a9a62931ffbb87f4ef627649db808e58681f530e18fd9973fa2a9700a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b73fd1a8f6049b9189d9563ca7a37b43f9635749720fe6319bc0e69a350db1d2f8f2f82f8ccad25434522bc31499366ce392d3dba3b896e2d4fe3531ef399ecb
|
|
7
|
+
data.tar.gz: 49e26eb57f3f5e732aba4648d12745166883f64e471f0d2c1e4b1a016aae22c466f094565e7e84bb790dbe066753845362941946916bdfb8bb88a0bcaed3ca30
|
data/Gemfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in chefstyle.gemspec
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
group :debug do
|
|
7
|
+
gem "pry"
|
|
8
|
+
gem "pry-byebug"
|
|
9
|
+
gem "pry-stack_explorer"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
group :docs do
|
|
13
|
+
gem "github-markup"
|
|
14
|
+
gem "redcarpet"
|
|
15
|
+
gem "yard"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
|
19
|
+
|
|
20
|
+
# If you want to load debugging tools into the bundle exec sandbox,
|
|
21
|
+
# add these additional dependencies into Gemfile.local
|
|
22
|
+
eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")
|
data/{LICENSE.txt → LICENSE}
RENAMED
|
File without changes
|
data/chefstyle.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'chefstyle/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "chefstyle"
|
|
8
|
+
spec.version = Chefstyle::VERSION
|
|
9
|
+
spec.authors = ["Chef Software, Inc."]
|
|
10
|
+
spec.email = ["oss@chef.io"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Rubocop configuration for Chef's ruby projects}
|
|
13
|
+
spec.homepage = "https://github.com/chef/chefstyle"
|
|
14
|
+
spec.license = "Apache-2.0"
|
|
15
|
+
spec.required_ruby_version = ">= 2.2"
|
|
16
|
+
|
|
17
|
+
spec.files = %w{LICENSE chefstyle.gemspec Gemfile} + Dir.glob("{bin,config,lib}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
|
|
18
|
+
spec.executables = %w[chefstyle]
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler"
|
|
22
|
+
spec.add_development_dependency "rake", ">= 12.0"
|
|
23
|
+
spec.add_development_dependency "rspec"
|
|
24
|
+
spec.add_dependency("rubocop", Chefstyle::RUBOCOP_VERSION)
|
|
25
|
+
end
|
data/lib/chefstyle/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chefstyle
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.2
|
|
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:
|
|
11
|
+
date: 2019-01-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '0'
|
|
20
20
|
type: :development
|
|
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: '
|
|
26
|
+
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -68,15 +68,16 @@ dependencies:
|
|
|
68
68
|
version: 0.55.0
|
|
69
69
|
description:
|
|
70
70
|
email:
|
|
71
|
-
-
|
|
71
|
+
- oss@chef.io
|
|
72
72
|
executables:
|
|
73
73
|
- chefstyle
|
|
74
74
|
extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
|
76
76
|
files:
|
|
77
|
-
-
|
|
78
|
-
-
|
|
77
|
+
- Gemfile
|
|
78
|
+
- LICENSE
|
|
79
79
|
- bin/chefstyle
|
|
80
|
+
- chefstyle.gemspec
|
|
80
81
|
- config/chefstyle.yml
|
|
81
82
|
- config/default.yml
|
|
82
83
|
- config/disable_all.yml
|
|
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
105
106
|
version: '0'
|
|
106
107
|
requirements: []
|
|
107
108
|
rubyforge_project:
|
|
108
|
-
rubygems_version: 2.7.
|
|
109
|
+
rubygems_version: 2.7.6
|
|
109
110
|
signing_key:
|
|
110
111
|
specification_version: 4
|
|
111
112
|
summary: Rubocop configuration for Chef's ruby projects
|
data/README.md
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
# Chefstyle - Version Pinned rubocop and sane defaults for Ruby
|
|
2
|
-
|
|
3
|
-
[](https://badge.fury.io/rb/chefstyle) [](https://travis-ci.org/chef/chefstyle)
|
|
4
|
-
|
|
5
|
-
This is an internal style guide for chef ruby projects (chef-client,
|
|
6
|
-
ohai, mixlib-shellout, mixlib-config, etc).
|
|
7
|
-
|
|
8
|
-
It is not meant for consumption by cookbooks or for any general
|
|
9
|
-
purpose uses. **Chef Users and Customers Should Generally Not Use
|
|
10
|
-
This Tool and Should Use Cookstyle**. It is not intended for any audience
|
|
11
|
-
outside of chef core ruby development.
|
|
12
|
-
|
|
13
|
-
It will conflict with rubocop defaults, cookstyle, finstyle and other
|
|
14
|
-
ruby style guides entirely by design. The point is that the core
|
|
15
|
-
chef authors vehemently disagree with them on points of style and this
|
|
16
|
-
point is generally not up for debate.
|
|
17
|
-
|
|
18
|
-
It will have many rules that are disabled simply because fixing a
|
|
19
|
-
project as large as chef-client would be tedious and have little
|
|
20
|
-
value. It will have other rules that are disabled because chef
|
|
21
|
-
exposes edge conditions that make them falsely alert. Other rules
|
|
22
|
-
will be selected based on the biases of the core chef developers
|
|
23
|
-
which are often violently at odds with the rubocop core developers
|
|
24
|
-
over ruby style.
|
|
25
|
-
|
|
26
|
-
Pull requests to this repo will not be accepted without corresponding
|
|
27
|
-
PRs into at least the chef-client and ohai codebases to clean the
|
|
28
|
-
code up. PRs will not be accepted that assume unfunded mandates for
|
|
29
|
-
other people to finish the work. Do not open PRs offering opinions
|
|
30
|
-
or suggestions without offering to do the work.
|
|
31
|
-
|
|
32
|
-
The project itself is a derivative of
|
|
33
|
-
[finstyle](https://github.com/fnichol/finstyle), but starts with all
|
|
34
|
-
rules disabled. The active ruleset is in the
|
|
35
|
-
[config/chefstyle.yml](https://github.com/chef/chefstyle/blob/master/config/chefstyle.yml)
|
|
36
|
-
file.
|
|
37
|
-
|
|
38
|
-
## How It Works
|
|
39
|
-
|
|
40
|
-
This library 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.
|
|
41
|
-
|
|
42
|
-
## Installation
|
|
43
|
-
|
|
44
|
-
Add this line to your application's Gemfile:
|
|
45
|
-
|
|
46
|
-
```ruby
|
|
47
|
-
gem 'chefstyle'
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
And then execute:
|
|
51
|
-
|
|
52
|
-
$ bundle
|
|
53
|
-
|
|
54
|
-
Or install it yourself as:
|
|
55
|
-
|
|
56
|
-
$ gem install chefstyle
|
|
57
|
-
|
|
58
|
-
## Usage
|
|
59
|
-
|
|
60
|
-
### Vanilla RuboCop
|
|
61
|
-
|
|
62
|
-
Run RuboCop as normal, simply add a `-r chefstyle` option when running:
|
|
63
|
-
|
|
64
|
-
```sh
|
|
65
|
-
rubocop -r chefstyle -D --format offenses
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### chefstyle Command
|
|
69
|
-
|
|
70
|
-
Use this tool just as you would RuboCop, but invoke the `chefstyle` binary
|
|
71
|
-
instead which patches RuboCop to load rules from the chefstyle gem. For example:
|
|
72
|
-
|
|
73
|
-
```sh
|
|
74
|
-
chefstyle -D --format offenses
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Rake
|
|
78
|
-
|
|
79
|
-
In a Rakefile, the setup is exactly the same, except you need to require the
|
|
80
|
-
chefstyle library first:
|
|
81
|
-
|
|
82
|
-
```ruby
|
|
83
|
-
require "chefstyle"
|
|
84
|
-
require "rubocop/rake_task"
|
|
85
|
-
RuboCop::RakeTask.new do |task|
|
|
86
|
-
task.options << "--display-cop-names"
|
|
87
|
-
end
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### guard-rubocop
|
|
91
|
-
|
|
92
|
-
You can use one of two methods. The simplest is to add the `-r chefstyle` option to the `:cli` option in your Guardfile:
|
|
93
|
-
|
|
94
|
-
```ruby
|
|
95
|
-
guard :rubocop, cli: "-r chefstyle" do
|
|
96
|
-
watch(%r{.+\.rb$})
|
|
97
|
-
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
|
98
|
-
end
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Alternatively you could pass the path to Chefstyle's configuration by using the `Chefstyle.config` method:
|
|
102
|
-
|
|
103
|
-
```ruby
|
|
104
|
-
require "chefstyle"
|
|
105
|
-
|
|
106
|
-
guard :rubocop, cli: "--config #{Chefstyle.config}" do
|
|
107
|
-
watch(%r{.+\.rb$})
|
|
108
|
-
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
|
109
|
-
end
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### git pre-commit hoooks
|
|
113
|
-
|
|
114
|
-
In any repo a pre-commit hook can be used in .git/hooks/pre-commit to catch offenses before checkin:
|
|
115
|
-
|
|
116
|
-
```ruby
|
|
117
|
-
#!/usr/bin/env ruby
|
|
118
|
-
|
|
119
|
-
changed_files = `git diff --name-only --cached`.split.select { |f| File.extname(f) == ".rb" }
|
|
120
|
-
|
|
121
|
-
unless changed_files.empty?
|
|
122
|
-
system "chefstyle #{changed_files.join(" ")}"
|
|
123
|
-
unless $?.success?
|
|
124
|
-
puts "\n\nthere was a chefstyle error, please fix before commiting:"
|
|
125
|
-
puts "(chefstyle -a may be able to autofix these issues for you)\n\n"
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
exit $?.to_s[-1].to_i
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
For whatever `$REASON` git does not allow easily distributing hooks in the repo itself so each individual user
|
|
132
|
-
needs to set this up.
|
|
133
|
-
|
|
134
|
-
### .rubocop.yml
|
|
135
|
-
|
|
136
|
-
As with vanilla RuboCop, any custom settings can still be placed in a `.rubocop.yml` file in the root of your project.
|