Adjust PyLint log to reduce Sentry messages
This commit is contained in:
@ -86,18 +86,18 @@ class PyLintAdapter < TestingFrameworkAdapter
|
||||
# key might be "linter.#{severity}.#{name}.#{key}.#{value}"
|
||||
# or something like "linter.#{severity}.#{name}.replacement"
|
||||
translation = I18n.t(key, locale: :de, default: default)
|
||||
key.delete_suffix!(".#{default}") # Remove any custom prefix, might have no effect
|
||||
keys = key.split('.')
|
||||
final_key = keys.pop
|
||||
if %w[severity_name name regex replacement].exclude? final_key
|
||||
second_final = keys.pop # second last key, e.g. #{key}
|
||||
# Check for known values from SyntaxError
|
||||
log_missing = if %w[actual suggestion context line].exclude? second_final
|
||||
I18n.t(keys.append('log_missing').join('.'), locale: :de, default: true)
|
||||
else
|
||||
log_missing = if %w[severity_name name regex replacement].include? final_key
|
||||
# Log missing predefined keys; they should exist
|
||||
I18n.t("#{key}.log_missing", locale: :de, default: true)
|
||||
elsif %w[actual suggestion context line].include?(final_key)
|
||||
# SyntaxErrors: These are dynamic and won't get translated
|
||||
false
|
||||
end
|
||||
else
|
||||
log_missing = true
|
||||
# Read config key
|
||||
I18n.t(keys.append('log_missing').join('.'), locale: :de, default: true)
|
||||
end
|
||||
Raven.capture_message({key: key, default: default}.to_json) if translation == default && log_missing
|
||||
translation
|
||||
|
Reference in New Issue
Block a user