Skip to content
This repository was archived by the owner on Sep 6, 2018. It is now read-only.

Commit a2fe0c0

Browse files
author
Olivier Halligon
committed
Eve — sync:all_files
1 parent 436d6ee commit a2fe0c0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

rakelib/changelog.rake

+17
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,21 @@ namespace :changelog do
3232
|
3333
HEADER
3434
end
35+
36+
desc 'Check if links to issues and PRs use matching numbers between text & link'
37+
task :check do |task|
38+
links = %r{\[\#([0-9]+)\]\(https://github.com/.*/(issues|pull)/([0-9]+)\)}
39+
all_wrong_links = []
40+
File.readlines('CHANGELOG.md').each_with_index do |line, idx|
41+
wrong_links = line.scan(links)
42+
.select { |m| m[0] != m[2] }
43+
.map { |m| " - Line #{idx+1}, link text is ##{m[0]} but links points to #{m[2]}" }
44+
all_wrong_links.concat(wrong_links)
45+
end
46+
if all_wrong_links.empty?
47+
puts "\u{2705} All links correct"
48+
else
49+
puts "\u{274C} Some wrong links found:\n" + all_wrong_links.join("\n")
50+
end
51+
end
3552
end

0 commit comments

Comments
 (0)