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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d96be9ad97c037ccdeed723dc4f1be5b79369c9
4
- data.tar.gz: da2b20f3450a920fc72cb675650dbdb61212b115
3
+ metadata.gz: 1c691b0313cef47acaeac8b463f81a8aabb3d79b
4
+ data.tar.gz: 93873717b61e3183bf80ce613e0ec4d0aed80b52
5
5
  SHA512:
6
- metadata.gz: 2c2e6ab148e16f4d6047ce3338c758011ca2ef54c9be83bf9e8eb7d7bdfdb06ddc0d61b4231b55a49376da59eac66ceb045ad4f087d616be2335a05632a4c673
7
- data.tar.gz: a3fdd1d1fdabeb72118434feb2ef6a76cbee4608d8e2ac65250febee9a9d03097b1484bf9f2e1ba6ae7004773a39d64516b0c3023e68d570b545aa3ad3f616ff
6
+ metadata.gz: 803f8a6817787d75773b1120a453d714e57d588a9df7da3237875c3b3477028dc67ec7aaaa21881941a5061d8d75b19a527453d86ea82b67c2d3e405751eb94d
7
+ data.tar.gz: fbcf050ed672ebf4ccf10cc9a17b8db5a8d736b47d1c2da3afe367ff7035f37bbdcd31c570b8080c653647a18df3897ed97f27b801b72929a2a14e409aeb496b
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2015 Mindaugas Mozūras
3
+ Copyright (c) 2016 Mindaugas Mozūras
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,5 +1,5 @@
1
1
  module Pronto
2
2
  module FoodCriticVersion
3
- VERSION = '0.5.0'
3
+ VERSION = '0.6.0'.freeze
4
4
  end
5
5
  end
@@ -3,42 +3,31 @@ require 'foodcritic'
3
3
 
4
4
  module Pronto
5
5
  class FoodCritic < Runner
6
- def initialize
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
- patches.select { |patch| patch.new_file_full_path.to_s == warning.match[:filename] }
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 chef_paths(patches)
32
- paths = { cookbook_paths: [], role_paths: [] }
33
- patches.each do |patch|
34
- path = patch.new_file_full_path.to_s
35
- if path.include?('cookbook')
36
- paths[:cookbook_paths] << path
37
- elsif path.include?('role')
38
- paths[:role_paths] << path
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)
@@ -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.5.0')
37
- s.add_development_dependency('rake', '~> 10.4')
38
- s.add_development_dependency('rspec', '~> 3.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.5.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: 2015-12-02 00:00:00.000000000 Z
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.5.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.5.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: '10.4'
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: '10.4'
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.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.3'
74
+ version: '3.4'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: rspec-its
71
77
  requirement: !ruby/object:Gem::Requirement