Utils fixes

pull/41/head
Andre Richter 5 years ago
parent fad90e8bb1
commit e5bfd30477
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -13,6 +13,6 @@ staged_files = `git --no-pager diff --name-only --cached`.split(/\n/)
staged_files.each do |f|
if f.include?('Makefile') || source_files_exts.include?(File.extname(f))
puts "Checking for copyright range: #{f}"
exit 1 unless copyrighted?(f, true)
exit 1 unless copyrighted?(f)
end
end

@ -11,9 +11,9 @@ def checkin_years(file)
checkin_years.split(/\n/).map!(&:to_i)
end
def parse_checkin_years(file, is_being_checked_in)
def parse_checkin_years(file)
checkin_years = checkin_years(file)
checkin_years << Time.now.year if is_being_checked_in
checkin_years << Time.now.year
checkin_years.minmax
end
@ -38,8 +38,8 @@ def print_on_err(file, copyright_lines, checkin_min, checkin_max)
puts "\tMax year: " + checkin_max.to_s
end
def copyrighted?(file, is_being_checked_in)
checkin_min, checkin_max = parse_checkin_years(file, is_being_checked_in)
def copyrighted?(file)
checkin_min, checkin_max = parse_checkin_years(file)
copyright_lines = File.readlines(file).grep(/.*Copyright.*/)
min_seen, max_seen = min_max_seen?(copyright_lines, checkin_min, checkin_max)

@ -11,7 +11,7 @@ WITH_EXTRA = '[X0-9]'
NO_EXTRA = '[0-9]'
def tutorial_folders(with_extra = true)
crates = Dir['**/Cargo.toml']
crates = Dir['*/Cargo.toml']
crates.delete_if do |x|
s = with_extra ? WITH_EXTRA : NO_EXTRA

@ -29,7 +29,7 @@ def check_old_copyrights
sources.sort.each do |f|
puts "Checking for copyright: #{f}"
exit(1) unless copyrighted?(f, false)
exit(1) unless copyrighted?(f)
end
end

Loading…
Cancel
Save