From bc9f808acc7df0dfa90cec1d1703e5a723acc5d6 Mon Sep 17 00:00:00 2001 From: Sam Bostock Date: Tue, 7 Mar 2023 22:10:56 -0500 Subject: [PATCH] Allow `test_` method names to violate `snake_case` Tests are a use case where it is sometimes valuable to be able to be able to violate the `snake_case` convention. For example def test_GET_request_response_is_200_OK --- rubocop.yml | 4 ++++ test/fixtures/full_config.yml | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rubocop.yml b/rubocop.yml index a1c685ff..de44e5f4 100644 --- a/rubocop.yml +++ b/rubocop.yml @@ -377,6 +377,10 @@ Naming/InclusiveLanguage: Naming/MemoizedInstanceVariableName: Enabled: false +Naming/MethodName: + AllowedPatterns: + - '\Atest_' + Naming/MethodParameterName: Enabled: false diff --git a/test/fixtures/full_config.yml b/test/fixtures/full_config.yml index f7762906..24847dd9 100644 --- a/test/fixtures/full_config.yml +++ b/test/fixtures/full_config.yml @@ -2134,7 +2134,8 @@ Naming/MethodName: SupportedStyles: - snake_case - camelCase - AllowedPatterns: [] + AllowedPatterns: + - "\\Atest_" Naming/MethodParameterName: Description: Checks for method parameter names that contain capital letters, end in numbers, or do not meet a minimal length.