2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-04 08:47:37 +08:00

DEV: s/this._super()/this._super(...arguments) (#6908)

This commit is contained in:
Joffrey JAFFEUX 2019-01-19 10:05:51 +01:00 committed by GitHub
parent 61fff098ed
commit 502b1316d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
111 changed files with 174 additions and 151 deletions

View file

@ -17,3 +17,26 @@ has_non_en_locales_changes = locales_changes.grep_v(/config\/locales\/(client|se
if locales_changes.any? && has_non_en_locales_changes
fail("Please submit your non-English translation updates via [Transifex](https://www.transifex.com/discourse/discourse-org/). You can read more on how to contribute translations [here](https://meta.discourse.org/t/contribute-a-translation-to-discourse/14882).")
end
files = (git.added_files + git.modified_files)
.reject! { |path| path.start_with?("plugins/") }
.reject! { |path| !(path.end_with?("es6") || path.end_with?("rb")) }
super_offenses = []
files.each do |path|
diff = git.diff_for_file(path)
next if !diff
diff.patch.lines.grep(/^\+\s\s/).each do |added_line|
super_offenses << path if added_line['this._super()']
end
end
if !super_offenses.empty?
warn(%{
When possible use `this._super(...arguments)` instead of `this._super()`\n
#{super_offenses.uniq.map { |o| github.html_link(o) }.join("\n")}
})
end