Skip to content

Commit

Permalink
adapt code quality checks to new code layout, re #49
Browse files Browse the repository at this point in the history
  • Loading branch information
gentryx committed Feb 20, 2017
1 parent c875a2a commit 2743e4b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tools/codequality/custom_checks
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ class FindUnmatchedHeaderGuards < TestBase
def test(filename, content)
return 0 if is_commonly_excluded?(filename)

relative_path = Pathname.new(filename).relative_path_from(PATH)
macro = "LIBGEODECOMP_#{relative_path}".upcase.gsub(/[\/\.]/, "_")
relative_path = Pathname.new(filename).relative_path_from(PATH).to_s
if !(filename =~ /src\/libgeodecomp\//)
relative_path = "libgeodecomp/#{relative_path}"
end

macro = relative_path.upcase.gsub(/[\/\.]/, "_")

expected_guard = <<EOF
#ifndef #{macro}
#define #{macro}
Expand Down Expand Up @@ -105,7 +110,10 @@ class FindBadIncludes < TestBase
begin
content.scan(/^#include.*".*"/) do
ret += 1
log "#{filename}: found malformed include »#{$&}«"
match = $&
if filename =~ /src\/libgeodecomp/
log "#{filename}: found malformed include »#{match}«"
end
end
rescue ArgumentError => e
end
Expand Down

0 comments on commit 2743e4b

Please sign in to comment.