pronto-foodcritic 0.10.0 → 0.11.0
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/.github/CODEOWNERS +3 -0
- data/.github/workflows/checks.yml +22 -0
- data/CHANGELOG.md +8 -0
- data/README.md +21 -0
- data/lib/pronto/foodcritic.rb +33 -1
- data/lib/pronto/foodcritic/version.rb +1 -1
- data/pronto-foodcritic.gemspec +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 705d781bf92a42d5435cfd6b81ba1c7e6a1a84cdab215388ce65d18554a1c213
|
|
4
|
+
data.tar.gz: 4352eb684c8a4f778334f3bce543df239319f126a53d6254b69939ee73ef2afc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5167e5cbca5bc798efb4f472b3f43a435bd1272edfeb1cc19d04065f2872e2afb83d46e097c79d569ebc09295eea059195a6c626618a24f9d60ae2e858fac99a
|
|
7
|
+
data.tar.gz: a635b03ed8878b0ebf828e7a27e7039563f5a6b380782bcc958a40b8235d969c72977b113c39bf9f4bf88ec33de8887157be62d06641c5de266f2614b60112a1
|
data/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Checks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
ruby:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
ruby: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0']
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
- uses: ruby/setup-ruby@v1
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
|
20
|
+
bundler-cache: true
|
|
21
|
+
- name: rake spec
|
|
22
|
+
run: bundle exec rake spec
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
## 0.11.0
|
|
5
|
+
|
|
6
|
+
### Changes
|
|
7
|
+
|
|
8
|
+
* Add Foodcritic options rule_file, search_gems and include_rules, allows to customize CI with custom ignores and Foodcritic rules.
|
|
9
|
+
* Add exclude option to ignore Foodcritic linter.
|
|
10
|
+
|
|
3
11
|
## 0.2.2
|
|
4
12
|
|
|
5
13
|
### Bugs fixed
|
data/README.md
CHANGED
|
@@ -7,6 +7,27 @@
|
|
|
7
7
|
|
|
8
8
|
Pronto runner for [Food Critic](https://github.com/acrmp/foodcritic), lint tool for chef. [What is Pronto?](https://github.com/mmozuras/pronto)
|
|
9
9
|
|
|
10
|
+
## Configuration
|
|
11
|
+
|
|
12
|
+
You can provide several Food Critic options via `.pronto.yml`:
|
|
13
|
+
|
|
14
|
+
```yml
|
|
15
|
+
foodcritic:
|
|
16
|
+
# Like CLI option --search-gems
|
|
17
|
+
search_gems: true
|
|
18
|
+
|
|
19
|
+
# Like CLI option --include, add custom rules to your CI
|
|
20
|
+
include_rules:
|
|
21
|
+
- lib/foodcritic/rules
|
|
22
|
+
|
|
23
|
+
# Like CLI option --rule-file
|
|
24
|
+
rule_file: .foodcritic-ci
|
|
25
|
+
|
|
26
|
+
# File GLOBs to ignore, matching files won't be passed to Food Critic
|
|
27
|
+
exclude:
|
|
28
|
+
- '**/test/integration/**/*_spec.rb'
|
|
29
|
+
```
|
|
30
|
+
|
|
10
31
|
## Note
|
|
11
32
|
|
|
12
33
|
Currently, naively uses path to determine if a file is a cookbook or a role configuration.
|
data/lib/pronto/foodcritic.rb
CHANGED
|
@@ -7,7 +7,7 @@ module Pronto
|
|
|
7
7
|
return [] if paths[:cookbook_paths].none? && paths[:role_paths].none?
|
|
8
8
|
|
|
9
9
|
@linter = ::FoodCritic::Linter.new
|
|
10
|
-
@linter.check(
|
|
10
|
+
@linter.check(options).warnings.flat_map do |warning|
|
|
11
11
|
ruby_patches.select { |patch| patch.new_file_full_path.to_s == warning.match[:filename] }
|
|
12
12
|
.flat_map(&:added_lines)
|
|
13
13
|
.select { |line| line.new_lineno == warning.match[:line] }
|
|
@@ -15,11 +15,22 @@ module Pronto
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
def options
|
|
19
|
+
@options ||= begin
|
|
20
|
+
result = {}.merge(paths)
|
|
21
|
+
result[:rule_file] = foodcritic_rule_file if foodcritic_rule_file
|
|
22
|
+
result[:search_gems] = foodcritic_search_gems if foodcritic_search_gems
|
|
23
|
+
result[:include_rules] = Array(foodcritic_include_rules)
|
|
24
|
+
result
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
18
28
|
def paths
|
|
19
29
|
@paths ||= begin
|
|
20
30
|
result = { cookbook_paths: [], role_paths: [] }
|
|
21
31
|
ruby_patches.each do |patch|
|
|
22
32
|
path = patch.new_file_full_path.to_s
|
|
33
|
+
next if foodcritic_exclude.any? { |r| File.fnmatch(r, path) }
|
|
23
34
|
if path.include?('cookbook')
|
|
24
35
|
result[:cookbook_paths] << path
|
|
25
36
|
elsif path.include?('role')
|
|
@@ -35,5 +46,26 @@ module Pronto
|
|
|
35
46
|
message = "#{warning.rule.code} - #{warning.rule.name}"
|
|
36
47
|
Message.new(path, line, :warning, message, nil, self.class)
|
|
37
48
|
end
|
|
49
|
+
|
|
50
|
+
def pronto_foodcritic_config
|
|
51
|
+
@pronto_foodcritic_config ||= Pronto::ConfigFile.new.to_h['foodcritic'] || {}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def foodcritic_search_gems
|
|
55
|
+
pronto_foodcritic_config.fetch('search_gems', nil)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def foodcritic_rule_file
|
|
59
|
+
pronto_foodcritic_config.fetch('rule_file', nil)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def foodcritic_include_rules
|
|
63
|
+
pronto_foodcritic_config.fetch('include_rules', [])
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def foodcritic_exclude
|
|
67
|
+
Array(pronto_foodcritic_config.fetch('exclude', []))
|
|
68
|
+
end
|
|
69
|
+
|
|
38
70
|
end
|
|
39
71
|
end
|
data/pronto-foodcritic.gemspec
CHANGED
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
|
33
33
|
s.require_paths = ['lib']
|
|
34
34
|
|
|
35
35
|
s.add_dependency('foodcritic', '~> 15', '>= 10.0.0')
|
|
36
|
-
s.add_dependency('pronto', '~> 0.
|
|
36
|
+
s.add_dependency('pronto', '~> 0.11.0')
|
|
37
37
|
s.add_development_dependency('rake', '~> 12.0')
|
|
38
38
|
s.add_development_dependency('rspec', '~> 3.4')
|
|
39
39
|
s.add_development_dependency('rspec-its', '~> 1.2')
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pronto-foodcritic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mindaugas Mozūras
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: foodcritic
|
|
@@ -36,14 +36,14 @@ dependencies:
|
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 0.
|
|
39
|
+
version: 0.11.0
|
|
40
40
|
type: :runtime
|
|
41
41
|
prerelease: false
|
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 0.
|
|
46
|
+
version: 0.11.0
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: rake
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -94,6 +94,8 @@ extra_rdoc_files:
|
|
|
94
94
|
- LICENSE
|
|
95
95
|
- README.md
|
|
96
96
|
files:
|
|
97
|
+
- ".github/CODEOWNERS"
|
|
98
|
+
- ".github/workflows/checks.yml"
|
|
97
99
|
- CHANGELOG.md
|
|
98
100
|
- CONTRIBUTING.md
|
|
99
101
|
- LICENSE
|
|
@@ -120,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
120
122
|
- !ruby/object:Gem::Version
|
|
121
123
|
version: '0'
|
|
122
124
|
requirements: []
|
|
123
|
-
rubygems_version: 3.0.
|
|
125
|
+
rubygems_version: 3.0.3
|
|
124
126
|
signing_key:
|
|
125
127
|
specification_version: 4
|
|
126
128
|
summary: Pronto runner for Food Critic, lint tool for chef
|