pronto-foodcritic 0.8.0 → 0.11.0

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
- SHA1:
3
- metadata.gz: 07bb1e1cdb144351e9fb41dc93b6946e9929b68c
4
- data.tar.gz: f3585a275cd2eb7807572be6d086537402f9ac0f
2
+ SHA256:
3
+ metadata.gz: 705d781bf92a42d5435cfd6b81ba1c7e6a1a84cdab215388ce65d18554a1c213
4
+ data.tar.gz: 4352eb684c8a4f778334f3bce543df239319f126a53d6254b69939ee73ef2afc
5
5
  SHA512:
6
- metadata.gz: fd8ddde07b604f3b71f7db50be73493e765d9f4046a8d98d09466b6e4b69f353d255e363c766608be73ee1211a8747193219a206cdc95fccf3b4167599094e48
7
- data.tar.gz: bb2b70f79b59efdeeda024954231dc990d8d868f6293a843d298559ddf72b47ca01e0b07d9ab70c7c0de721072e5911e3ea5050ec58f16550b86910a1e800665
6
+ metadata.gz: 5167e5cbca5bc798efb4f472b3f43a435bd1272edfeb1cc19d04065f2872e2afb83d46e097c79d569ebc09295eea059195a6c626618a24f9d60ae2e858fac99a
7
+ data.tar.gz: a635b03ed8878b0ebf828e7a27e7039563f5a6b380782bcc958a40b8235d969c72977b113c39bf9f4bf88ec33de8887157be62d06641c5de266f2614b60112a1
@@ -0,0 +1,3 @@
1
+ # Order is important. The last matching pattern takes the most precedence.
2
+ # Default owners for everything in the repo.
3
+ * @prontolabs/core
@@ -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
@@ -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
@@ -1,12 +1,33 @@
1
1
  # Pronto runner for Food Critic
2
2
 
3
3
  [![Code Climate](https://codeclimate.com/github/mmozuras/pronto-foodcritic.png)](https://codeclimate.com/github/mmozuras/pronto-foodcritic)
4
- [![Build Status](https://travis-ci.org/mmozuras/pronto-foodcritic.png)](https://travis-ci.org/mmozuras/pronto-foodcritic)
4
+ [![Build Status](https://secure.travis-ci.org/mmozuras/pronto-foodcritic.svg)](http://travis-ci.org/mmozuras/pronto-foodcritic)
5
5
  [![Gem Version](https://badge.fury.io/rb/pronto-foodcritic.png)](http://badge.fury.io/rb/pronto-foodcritic)
6
6
  [![Dependency Status](https://gemnasium.com/mmozuras/pronto-foodcritic.png)](https://gemnasium.com/mmozuras/pronto-foodcritic)
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.
@@ -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(paths).warnings.flat_map do |warning|
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
@@ -1,5 +1,5 @@
1
1
  module Pronto
2
2
  module FoodCriticVersion
3
- VERSION = '0.8.0'.freeze
3
+ VERSION = '0.11.0'.freeze
4
4
  end
5
5
  end
@@ -10,11 +10,11 @@ Gem::Specification.new do |s|
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.author = 'Mindaugas Mozūras'
12
12
  s.email = 'mindaugas.mozuras@gmail.com'
13
- s.homepage = 'http://github.org/mmozuras/pronto-foodcritic'
13
+ s.homepage = 'http://github.com/mmozuras/pronto-foodcritic'
14
14
  s.summary = 'Pronto runner for Food Critic, lint tool for chef'
15
15
 
16
16
  s.licenses = ['MIT']
17
- s.required_ruby_version = '>= 2.0.0'
17
+ s.required_ruby_version = '>= 2.3.0'
18
18
  s.rubygems_version = '1.8.23'
19
19
 
20
20
  s.files = `git ls-files`.split($RS).reject do |file|
@@ -32,9 +32,9 @@ Gem::Specification.new do |s|
32
32
  s.extra_rdoc_files = ['LICENSE', 'README.md']
33
33
  s.require_paths = ['lib']
34
34
 
35
- s.add_dependency('foodcritic', '~> 5', '>= 5.0.0')
36
- s.add_dependency('pronto', '~> 0.8.0')
37
- s.add_development_dependency('rake', '~> 11.0')
35
+ s.add_dependency('foodcritic', '~> 15', '>= 10.0.0')
36
+ s.add_dependency('pronto', '~> 0.11.0')
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')
40
40
  end
metadata CHANGED
@@ -1,63 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto-foodcritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.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: 2017-02-12 00:00:00.000000000 Z
11
+ date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foodcritic
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '5'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: 5.0.0
19
+ version: 10.0.0
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '15'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '5'
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
- version: 5.0.0
29
+ version: 10.0.0
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '15'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pronto
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.8.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.8.0
46
+ version: 0.11.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '11.0'
53
+ version: '12.0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '11.0'
60
+ version: '12.0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rspec
63
63
  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
@@ -101,7 +103,7 @@ files:
101
103
  - lib/pronto/foodcritic.rb
102
104
  - lib/pronto/foodcritic/version.rb
103
105
  - pronto-foodcritic.gemspec
104
- homepage: http://github.org/mmozuras/pronto-foodcritic
106
+ homepage: http://github.com/mmozuras/pronto-foodcritic
105
107
  licenses:
106
108
  - MIT
107
109
  metadata: {}
@@ -113,15 +115,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
115
  requirements:
114
116
  - - ">="
115
117
  - !ruby/object:Gem::Version
116
- version: 2.0.0
118
+ version: 2.3.0
117
119
  required_rubygems_version: !ruby/object:Gem::Requirement
118
120
  requirements:
119
121
  - - ">="
120
122
  - !ruby/object:Gem::Version
121
123
  version: '0'
122
124
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.6.10
125
+ rubygems_version: 3.0.3
125
126
  signing_key:
126
127
  specification_version: 4
127
128
  summary: Pronto runner for Food Critic, lint tool for chef