pronto-foodcritic 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/pronto/foodcritic/version.rb +1 -1
- data/lib/pronto/foodcritic.rb +14 -25
- data/pronto-foodcritic.gemspec +4 -4
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c691b0313cef47acaeac8b463f81a8aabb3d79b
|
4
|
+
data.tar.gz: 93873717b61e3183bf80ce613e0ec4d0aed80b52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 803f8a6817787d75773b1120a453d714e57d588a9df7da3237875c3b3477028dc67ec7aaaa21881941a5061d8d75b19a527453d86ea82b67c2d3e405751eb94d
|
7
|
+
data.tar.gz: fbcf050ed672ebf4ccf10cc9a17b8db5a8d736b47d1c2da3afe367ff7035f37bbdcd31c570b8080c653647a18df3897ed97f27b801b72929a2a14e409aeb496b
|
data/LICENSE
CHANGED
data/lib/pronto/foodcritic.rb
CHANGED
@@ -3,42 +3,31 @@ require 'foodcritic'
|
|
3
3
|
|
4
4
|
module Pronto
|
5
5
|
class FoodCritic < Runner
|
6
|
-
def
|
7
|
-
@linter = ::FoodCritic::Linter.new
|
8
|
-
end
|
9
|
-
|
10
|
-
def run(patches, _)
|
11
|
-
return [] unless patches
|
12
|
-
|
13
|
-
ruby_patches = patches.select { |patch| patch.additions > 0 }
|
14
|
-
.select { |patch| ruby_file?(patch.new_file_full_path) }
|
15
|
-
|
16
|
-
inspect(ruby_patches)
|
17
|
-
end
|
18
|
-
|
19
|
-
def inspect(patches)
|
20
|
-
paths = chef_paths(patches)
|
6
|
+
def run
|
21
7
|
return [] if paths[:cookbook_paths].none? && paths[:role_paths].none?
|
22
8
|
|
9
|
+
@linter = ::FoodCritic::Linter.new
|
23
10
|
@linter.check(paths).warnings.flat_map do |warning|
|
24
|
-
|
11
|
+
ruby_patches.select { |patch| patch.new_file_full_path.to_s == warning.match[:filename] }
|
25
12
|
.flat_map(&:added_lines)
|
26
13
|
.select { |line| line.new_lineno == warning.match[:line] }
|
27
14
|
.flat_map { |line| new_message(warning, line) }
|
28
15
|
end
|
29
16
|
end
|
30
17
|
|
31
|
-
def
|
32
|
-
paths
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
18
|
+
def paths
|
19
|
+
@paths ||= begin
|
20
|
+
result = { cookbook_paths: [], role_paths: [] }
|
21
|
+
ruby_patches.each do |patch|
|
22
|
+
path = patch.new_file_full_path.to_s
|
23
|
+
if path.include?('cookbook')
|
24
|
+
result[:cookbook_paths] << path
|
25
|
+
elsif path.include?('role')
|
26
|
+
result[:role_paths] << path
|
27
|
+
end
|
39
28
|
end
|
29
|
+
result
|
40
30
|
end
|
41
|
-
paths
|
42
31
|
end
|
43
32
|
|
44
33
|
def new_message(warning, line)
|
data/pronto-foodcritic.gemspec
CHANGED
@@ -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.0.0')
|
36
|
-
s.add_dependency('pronto', '~> 0.
|
37
|
-
s.add_development_dependency('rake', '~>
|
38
|
-
s.add_development_dependency('rspec', '~> 3.
|
35
|
+
s.add_dependency('foodcritic', '~> 5', '>= 5.0.0')
|
36
|
+
s.add_dependency('pronto', '~> 0.6.0')
|
37
|
+
s.add_development_dependency('rake', '~> 11.0')
|
38
|
+
s.add_development_dependency('rspec', '~> 3.4')
|
39
39
|
s.add_development_dependency('rspec-its', '~> 1.2')
|
40
40
|
end
|
metadata
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pronto-foodcritic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.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: 2016-03-14 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
17
|
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5'
|
20
|
+
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: 5.0.0
|
20
23
|
type: :runtime
|
@@ -22,6 +25,9 @@ dependencies:
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5'
|
30
|
+
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: 5.0.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
@@ -30,42 +36,42 @@ dependencies:
|
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
39
|
+
version: 0.6.0
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
46
|
+
version: 0.6.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rake
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '11.0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '11.0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rspec
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
67
|
+
version: '3.4'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
74
|
+
version: '3.4'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: rspec-its
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|