forked from artsy/artsy.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDangerfile
More file actions
30 lines (25 loc) · 1.01 KB
/
Dangerfile
File metadata and controls
30 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Look for prose issues
prose.lint_files
# Use the VS Code Spell-checker word ignore list
require "json"
vscode_spellings = JSON.parse File.read(".vscode/spellchecker.json")
# Look for spelling issues
prose.ignored_words = vscode_spellings["ignoreWordsList"]
prose.check_spelling
avoid_exact_words = [
{ word: "Github", reason: "Please use GitHub, capital 'H'" },
{ word: "Cocoapods", reason: "Please use CocoaPods, capital 'P'" },
{ word: "Javascript", reason: "Please use JavaScript, capital 'S'" },
{ word: "Typescript", reason: "Please use TypeScript, capital 'S'" },
{ word: "localhost:4000", reason: "You may have left an internal link in the markdown" }
]
markdowns = (git.modified_files + git.added_files).select { |file| file.start_with? "_posts/" }
# This could do with some code golfing sometime
markdowns.each do |file|
lines = File.read(file).lines
lines.each do |l|
avoid_exact_words.each do |avoid|
warn(avoid[:reason], file: file, line: l) if l.include? avoid[:word]
end
end
end