Module: Gitlab::Styles::Rubocop::ModelHelpers
- Defined in:
- lib/gitlab/styles/rubocop/model_helpers.rb
Instance Method Summary collapse
-
#in_model?(node) ⇒ Boolean
Returns true if the given node originated from the models directory.
Instance Method Details
#in_model?(node) ⇒ Boolean
Returns true if the given node originated from the models directory.
8 9 10 11 12 13 14 15 |
# File 'lib/gitlab/styles/rubocop/model_helpers.rb', line 8 def in_model?(node) path = node.location.expression.source_buffer.name pwd = RuboCop::PathUtil.pwd models_path = File.join(pwd, 'app', 'models') ee_models_path = File.join(pwd, 'ee', 'app', 'models') path.start_with?(models_path, ee_models_path) end |