added a custom rubocop linter in order to avoid hardcoding application name
This commit is contained in:
parent
c1208add62
commit
03864f60cf
2 changed files with 29 additions and 0 deletions
17
lib/cops/application_name.rb
Normal file
17
lib/cops/application_name.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
if defined?(RuboCop)
|
||||
module RuboCop
|
||||
module Cop
|
||||
module DS
|
||||
class ApplicationName < Cop
|
||||
MSG = "Avoid hardcoding `demarches-simplifiees.fr`. Instead use a dedicated environnement variable."
|
||||
|
||||
def on_str(node)
|
||||
return unless node.source.include?('demarches-simplifiees.fr')
|
||||
|
||||
add_offense(node)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue