Skip to content

Stop checking for models location programmatically

Peter Leitzen requested to merge pl-drop-model-helpers into master

What does this MR do and why?

Use RuboCop's Include/Exclude directives instead.

The method in_models? shows up in top 20 of a stack profile. See gitlab-org/gitlab#377469 (comment 1130358088).

BREAKING CHANGE: Previously, we checked for app/models/**/*.rb and ee/app/models/**/*.rb. In this commit we are only adding app/models/**/*.rb back as most projects using gitlab-styles won't have a ee/ folder.

Projects (most likely on gitlab-org/gitlab) which do have an ee/ folder must add the following configuration to .rubocop.yml:

Cop/ActiveRecordDependent:
  Include:
    - app/models/**/*.rb
    - ee/app/models/**/*.rb
    - jh/app/models/**/*.rb

Cop/ActiveRecordSerialize:
  Include:
    - app/models/**/*.rb
    - ee/app/models/**/*.rb
    - jh/app/models/**/*.rb

Cop/PolymorphicAssociations:
  Include:
    - app/models/**/*.rb
    - ee/app/models/**/*.rb
    - jh/app/models/**/*.rb
Edited by Peter Leitzen

Merge request reports

Loading