Maintenance: Prevent back porting of new __() methods from develop.

This commit is contained in:
Martin Gruner 2021-11-15 16:41:10 +01:00
parent a9b57e5719
commit 4d90a7b240
5 changed files with 42 additions and 1 deletions

View file

@ -0,0 +1,20 @@
module.exports = class PreventUnderscoreBackport
rule:
name: 'prevent_underscore_backport'
level: 'error'
message: 'The method __(...) is not available in current stable'
description: '''
'''
constructor: ->
@callTokens = []
tokens: ['CALL_START']
lintToken: (token, tokenApi) ->
[type, tokenValue] = token
p = tokenApi.peek(-1)
if p[1] == '__'
return { }

View file

@ -48,7 +48,7 @@ brakeman:
coffeelint:
<<: *template_pre
script:
- coffeelint app/
- coffeelint --rules ./.coffeelint/rules/* app/
bundle-audit:
<<: *template_pre

View file

@ -0,0 +1,17 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
module RuboCop
module Cop
module Zammad
class PreventUnderscroreBackport < Base
MSG = <<~ERROR_MESSAGE.freeze
The method __(...) is not available in current stable.
ERROR_MESSAGE
def on_send(node)
add_offense(node) if node.method_name.eql? :__
end
end
end
end
end

View file

@ -10,3 +10,4 @@ require_relative 'cop/zammad/no_to_sym_on_string'
require_relative 'cop/zammad/prefer_negated_if_over_unless'
require_relative 'cop/zammad/update_copyright'
require_relative 'cop/zammad/forbid_rand'
require_relative 'cop/zammad/prevent_underscore_backport'

View file

@ -131,5 +131,8 @@
},
"transform_messes_up_line_numbers": {
"level": "error"
},
"prevent_underscore_backport": {
"level": "error"
}
}