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 +4 -4
- data/lib/pronto/clang_tidy/version.rb +1 -1
- data/lib/pronto/clang_tidy.rb +14 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d865f961b636a9321c454a5718344dad214de056235732b3f4f828c1bcec9774
|
4
|
+
data.tar.gz: 0cb9023bc1eca7ae743da51b6456c0b856f256df28def4e683384c899dde7880
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffe3a8d8e97596c6f0b78c0955464f3cb77178b467291c949594ad1c6e444117a70de2f44231f28f462a60dd49f58c71268599bd4a844bb6b2c3081694c1a4b0
|
7
|
+
data.tar.gz: '095f28f9fed2eda0669cc6dd5d6a56d5476253ea7e31df1457a86a46852ae7648467402ba300a2914be0e666d07f5fede3c1c8ff23126e91809dc5cf3012147f'
|
data/lib/pronto/clang_tidy.rb
CHANGED
@@ -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
|
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
|
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)
|