mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 18:15:31 +08:00
DEV: more precise self pattern check (#7278)
This commit is contained in:
parent
a6d93f6317
commit
843a73e1ef
@ -34,7 +34,7 @@ js_files.each do |path|
|
|||||||
|
|
||||||
diff.patch.lines.grep(/^\+\s\s/).each do |added_line|
|
diff.patch.lines.grep(/^\+\s\s/).each do |added_line|
|
||||||
super_offenses << path if added_line['this._super()']
|
super_offenses << path if added_line['this._super()']
|
||||||
self_offenses << path if added_line['self']
|
self_offenses << path if added_line[/(?:(^|\W)self\.?)/]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ end
|
|||||||
|
|
||||||
if !self_offenses.empty?
|
if !self_offenses.empty?
|
||||||
warn(%{
|
warn(%{
|
||||||
Use fat arrow instead of self pattern.`\n
|
Use fat arrow instead of self pattern.\n
|
||||||
#{self_offenses.uniq.map { |o| github.html_link(o) }.join("\n")}
|
#{self_offenses.uniq.map { |o| github.html_link(o) }.join("\n")}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user