Stop checking file locations programmatically
Problem
Checking file locations in RuboCop cop rules programmatically (via e.g. in_model?) is slow (see stack profile). RuboCop's Include/Exclude directives should be used instead.
Proposed solution
Create a InternalAffairs:
- Ban methods of form
in_X(node)?and encourage the use of RuboCop'sInclude/Excludeconfiguration directives - Ban use of
source_buffer.name
Locations
gitlab-styles
gitlab-org/gitlab
def in_with_lock_retries?(node)def in_haml_file?(node)def in_routes?(node)def in_spec?(node)def in_haml_file?(node)def in_qa_file?(node)def in_finder?(node)def in_model?(node)def in_service_class?(node)def in_presenter?(node)def in_serializer?(node)def in_worker?(node)def in_controller?(node)def in_graphql?(node)def in_api?(node)def in_spec?(node)def in_app_directory?(node, directory)def in_lib_directory?(node, directory)def in_graphql_directory?(node, directory)def in_migration?(node)def in_background_migration?(node)def in_ee_background_migration?(node)def in_deployment_migration?(node)def in_post_deployment_migration?(node)
Prior discussion
The following discussion from !156 (merged) should be addressed:
-
@splattael started a discussion: A potential follow-up is to write a
InternalAffairscop to ban use of:- Methods of form
in_X(node)? - Ban use of
source_buffer.name
In
gitlab-stylesI see:In
gitlab-org/gitlabI see more:def in_with_lock_retries?(node)def in_haml_file?(node)def in_routes?(node)def in_spec?(node)def in_haml_file?(node)def in_qa_file?(node)def in_finder?(node)def in_model?(node)def in_service_class?(node)def in_presenter?(node)def in_serializer?(node)def in_worker?(node)def in_controller?(node)def in_graphql?(node)def in_api?(node)def in_spec?(node)def in_app_directory?(node, directory)def in_lib_directory?(node, directory)def in_graphql_directory?(node, directory)def in_migration?(node)def in_background_migration?(node)def in_ee_background_migration?(node)def in_deployment_migration?(node)def in_post_deployment_migration?(node)
- Methods of form
Edited by Peter Leitzen