pronto-clang_tidy 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 912e8cbd46b44243e4e4b8826fdd92a3b5188bd34a7308249182546e317df741
4
- data.tar.gz: 3f01a9758d7c41795a9dcc92bbd340399eeef9fa582fa40151721fcc4828e26d
3
+ metadata.gz: d865f961b636a9321c454a5718344dad214de056235732b3f4f828c1bcec9774
4
+ data.tar.gz: 0cb9023bc1eca7ae743da51b6456c0b856f256df28def4e683384c899dde7880
5
5
  SHA512:
6
- metadata.gz: 6e80c9ea8d9eb51df711ed959709e7354b31067222e4016ee332657a2143a729839f93de88571d71f7a147362d2f02fd7a99a6ea8d2822f5b8376ef5eaaff6c0
7
- data.tar.gz: 94faf438e390e41c506535442307631b1e39219e42708875cd9422440ad6ffee3fbd200685a1fcd9af6239c919e2d58ba8f099e0481da0e0e2280c38de062178
6
+ metadata.gz: ffe3a8d8e97596c6f0b78c0955464f3cb77178b467291c949594ad1c6e444117a70de2f44231f28f462a60dd49f58c71268599bd4a844bb6b2c3081694c1a4b0
7
+ data.tar.gz: '095f28f9fed2eda0669cc6dd5d6a56d5476253ea7e31df1457a86a46852ae7648467402ba300a2914be0e666d07f5fede3c1c8ff23126e91809dc5cf3012147f'
@@ -1,5 +1,5 @@
1
1
  module Pronto
2
2
  module ClangTidy
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.1'.freeze
4
4
  end
5
5
  end
@@ -4,23 +4,31 @@ require 'pronto'
4
4
  module Pronto
5
5
  class ClangTidyRunner < Runner
6
6
  def run
7
- return [] if !@patches || @patches.count.zero?
8
- # loop through all offences in clang-tidy output
9
7
  offences = read_clang_tidy_output
10
- return [] if !offences || offences.length.zero?
8
+ return [] if no_patches? || offences.length.zero?
9
+ # loop through all offences in clang-tidy output
11
10
  offences.map do |offence|
12
11
  # find the patch that corresponds to the current offence
13
12
  patch = patch_for(offence.file)
14
13
  next if patch.nil?
15
14
  # generate a message for the corresponding added_line in the patch
16
- patch.added_lines
17
- .select { |added_line| added_line.new_lineno == offence.lineno }
18
- .map { |line| new_message(offence, line) }
15
+ message_for(patch, offence)
19
16
  end.flatten.compact
20
17
  end
21
18
 
22
19
  private
23
20
 
21
+ def message_for(patch, offence)
22
+ line = patch.added_lines.find do |added_line|
23
+ added_line.new_lineno == offence.lineno
24
+ end
25
+ new_message(offence, line) unless line.nil?
26
+ end
27
+
28
+ def no_patches?
29
+ !@patches || @patches.count.zero?
30
+ end
31
+
24
32
  def patch_for(filename)
25
33
  @patches.find do |p|
26
34
  p.new_file_full_path == Pathname.new(filename)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto-clang_tidy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Jabbour