diff --git a/flake8_quotes/__init__.py b/flake8_quotes/__init__.py index 6fb22c5..3113d7c 100644 --- a/flake8_quotes/__init__.py +++ b/flake8_quotes/__init__.py @@ -27,11 +27,13 @@ class QuoteChecker(object): "'": { 'good_single': "'", 'bad_single': '"', + 'single_error_message': 'Double quotes found but single quotes preferred', }, # When user wants only double quotes '"': { 'good_single': '"', 'bad_single': "'", + 'single_error_message': 'Single quotes found but double quotes preferred', }, } # Provide aliases for Windows CLI support @@ -44,11 +46,13 @@ class QuoteChecker(object): 'good_multiline': "'''", 'good_multiline_ending': '\'"""', 'bad_multiline': '"""', + 'multiline_error_message': 'Double quote multiline found but single quotes preferred', }, '"': { 'good_multiline': '"""', 'good_multiline_ending': '"\'\'\'', 'bad_multiline': "'''", + 'multiline_error_message': 'Single quote multiline found but double quotes preferred', }, } # Provide Windows CLI and multi-quote aliases @@ -61,10 +65,12 @@ class QuoteChecker(object): "'": { 'good_docstring': "'''", 'bad_docstring': '"""', + 'docstring_error_message': 'Double quote docstring found but single quotes preferred', }, '"': { 'good_docstring': '"""', 'bad_docstring': "'''", + 'docstring_error_message': 'Single quote docstring found but double quotes preferred', }, } # Provide Windows CLI and docstring-quote aliases @@ -221,7 +227,7 @@ def get_quotes_errors(self, file_contents): continue yield { - 'message': 'Q002 Remove bad quotes from docstring', + 'message': 'Q002 ' + self.config['docstring_error_message'], 'line': start_row, 'col': start_col, } @@ -242,7 +248,7 @@ def get_quotes_errors(self, file_contents): # Output our error yield { - 'message': 'Q001 Remove bad quotes from multiline string', + 'message': 'Q001 ' + self.config['multiline_error_message'], 'line': start_row, 'col': start_col, } @@ -276,7 +282,7 @@ def get_quotes_errors(self, file_contents): # If not preferred type, only allow use to avoid escapes. if not self.config['good_single'] in string_contents: yield { - 'message': 'Q000 Remove bad quotes', + 'message': 'Q000 ' + self.config['single_error_message'], 'line': start_row, 'col': start_col, } diff --git a/test/test_checks.py b/test/test_checks.py index 06ebca5..0d9d82c 100644 --- a/test/test_checks.py +++ b/test/test_checks.py @@ -22,9 +22,15 @@ def test_stdin(self): stdout_lines = stdout.splitlines() self.assertEqual(stderr, b'') self.assertEqual(len(stdout_lines), 3) - self.assertRegexpMatches(stdout_lines[0], b'stdin:1:(24|25): Q000 Remove bad quotes') - self.assertRegexpMatches(stdout_lines[1], b'stdin:2:(24|25): Q000 Remove bad quotes') - self.assertRegexpMatches(stdout_lines[2], b'stdin:3:(24|25): Q000 Remove bad quotes') + self.assertRegexpMatches( + stdout_lines[0], + b'stdin:1:(24|25): Q000 Double quotes found but single quotes preferred') + self.assertRegexpMatches( + stdout_lines[1], + b'stdin:2:(24|25): Q000 Double quotes found but single quotes preferred') + self.assertRegexpMatches( + stdout_lines[2], + b'stdin:3:(24|25): Q000 Double quotes found but single quotes preferred') class DoublesTestChecks(TestCase): @@ -37,7 +43,7 @@ class DoublesOptions(): def test_multiline_string(self): doubles_checker = QuoteChecker(None, filename=get_absolute_path('data/doubles_multiline_string.py')) self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [ - {'col': 4, 'line': 1, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 1, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, ]) def test_multiline_string_using_lines(self): @@ -45,7 +51,7 @@ def test_multiline_string_using_lines(self): lines = f.readlines() doubles_checker = QuoteChecker(None, lines=lines) self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [ - {'col': 4, 'line': 1, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 1, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, ]) def test_wrapped(self): @@ -55,9 +61,9 @@ def test_wrapped(self): def test_doubles(self): doubles_checker = QuoteChecker(None, filename=get_absolute_path('data/doubles.py')) self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [ - {'col': 24, 'line': 1, 'message': 'Q000 Remove bad quotes'}, - {'col': 24, 'line': 2, 'message': 'Q000 Remove bad quotes'}, - {'col': 24, 'line': 3, 'message': 'Q000 Remove bad quotes'}, + {'col': 24, 'line': 1, 'message': 'Q000 Double quotes found but single quotes preferred'}, + {'col': 24, 'line': 2, 'message': 'Q000 Double quotes found but single quotes preferred'}, + {'col': 24, 'line': 3, 'message': 'Q000 Double quotes found but single quotes preferred'}, ]) def test_noqa_doubles(self): @@ -93,9 +99,9 @@ def test_doubles(self): doubles_checker = QuoteChecker(None, filename=get_absolute_path('data/doubles.py')) self.assertEqual(list(doubles_checker.get_quotes_errors(doubles_checker.get_file_contents())), [ - {'col': 24, 'line': 1, 'message': 'Q000 Remove bad quotes'}, - {'col': 24, 'line': 2, 'message': 'Q000 Remove bad quotes'}, - {'col': 24, 'line': 3, 'message': 'Q000 Remove bad quotes'}, + {'col': 24, 'line': 1, 'message': 'Q000 Double quotes found but single quotes preferred'}, + {'col': 24, 'line': 2, 'message': 'Q000 Double quotes found but single quotes preferred'}, + {'col': 24, 'line': 3, 'message': 'Q000 Double quotes found but single quotes preferred'}, ]) @@ -109,7 +115,7 @@ class SinglesOptions(): def test_multiline_string(self): singles_checker = QuoteChecker(None, filename=get_absolute_path('data/singles_multiline_string.py')) self.assertEqual(list(singles_checker.get_quotes_errors(singles_checker.get_file_contents())), [ - {'col': 4, 'line': 1, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 1, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, ]) def test_wrapped(self): @@ -119,9 +125,9 @@ def test_wrapped(self): def test_singles(self): singles_checker = QuoteChecker(None, filename=get_absolute_path('data/singles.py')) self.assertEqual(list(singles_checker.get_quotes_errors(singles_checker.get_file_contents())), [ - {'col': 24, 'line': 1, 'message': 'Q000 Remove bad quotes'}, - {'col': 24, 'line': 2, 'message': 'Q000 Remove bad quotes'}, - {'col': 24, 'line': 3, 'message': 'Q000 Remove bad quotes'}, + {'col': 24, 'line': 1, 'message': 'Q000 Single quotes found but double quotes preferred'}, + {'col': 24, 'line': 2, 'message': 'Q000 Single quotes found but double quotes preferred'}, + {'col': 24, 'line': 3, 'message': 'Q000 Single quotes found but double quotes preferred'}, ]) def test_noqa_singles(self): @@ -157,9 +163,9 @@ def test_singles(self): singles_checker = QuoteChecker(None, filename=get_absolute_path('data/singles.py')) self.assertEqual(list(singles_checker.get_quotes_errors(singles_checker.get_file_contents())), [ - {'col': 24, 'line': 1, 'message': 'Q000 Remove bad quotes'}, - {'col': 24, 'line': 2, 'message': 'Q000 Remove bad quotes'}, - {'col': 24, 'line': 3, 'message': 'Q000 Remove bad quotes'}, + {'col': 24, 'line': 1, 'message': 'Q000 Single quotes found but double quotes preferred'}, + {'col': 24, 'line': 2, 'message': 'Q000 Single quotes found but double quotes preferred'}, + {'col': 24, 'line': 3, 'message': 'Q000 Single quotes found but double quotes preferred'}, ]) @@ -172,7 +178,7 @@ class Options(): multiline_checker = QuoteChecker(None, filename=get_absolute_path('data/multiline_string.py')) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 10, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 10, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, ]) def test_singles_alias(self): @@ -183,7 +189,7 @@ class Options(): multiline_checker = QuoteChecker(None, filename=get_absolute_path('data/multiline_string.py')) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 10, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 10, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, ]) def test_doubles(self): @@ -194,7 +200,7 @@ class Options(): multiline_checker = QuoteChecker(None, filename=get_absolute_path('data/multiline_string.py')) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 1, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 1, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, ]) def test_doubles_alias(self): @@ -205,7 +211,7 @@ class Options(): multiline_checker = QuoteChecker(None, filename=get_absolute_path('data/multiline_string.py')) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 1, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 1, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, ]) diff --git a/test/test_docstring_checks.py b/test/test_docstring_checks.py index ecbd764..c7ec4e2 100644 --- a/test/test_docstring_checks.py +++ b/test/test_docstring_checks.py @@ -17,11 +17,11 @@ class Options(): filename=get_absolute_path('data/docstring_doubles.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 5, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 4, 'line': 16, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 20, 'line': 21, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 8, 'line': 30, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 12, 'line': 35, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 0, 'line': 5, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 4, 'line': 16, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 20, 'line': 21, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 8, 'line': 30, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 12, 'line': 35, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -29,8 +29,8 @@ class Options(): filename=get_absolute_path('data/docstring_doubles_module_multiline.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 4, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 0, 'line': 9, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 0, 'line': 4, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 0, 'line': 9, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -38,8 +38,8 @@ class Options(): filename=get_absolute_path('data/docstring_doubles_module_singleline.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 2, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 0, 'line': 6, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 0, 'line': 2, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 0, 'line': 6, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -47,8 +47,8 @@ class Options(): filename=get_absolute_path('data/docstring_doubles_class.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 3, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 22, 'line': 5, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 3, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 22, 'line': 5, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -56,11 +56,11 @@ class Options(): filename=get_absolute_path('data/docstring_doubles_function.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 3, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 4, 'line': 11, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 38, 'line': 15, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 4, 'line': 17, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 4, 'line': 21, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 3, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 4, 'line': 11, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 38, 'line': 15, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 4, 'line': 17, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, + {'col': 4, 'line': 21, 'message': 'Q001 Double quote multiline found but single quotes preferred'}, ]) def test_require_single_docstring_double_present(self): @@ -75,9 +75,9 @@ class Options(): filename=get_absolute_path('data/docstring_doubles.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 1, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 4, 'line': 12, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 8, 'line': 24, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 0, 'line': 1, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, + {'col': 4, 'line': 12, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, + {'col': 8, 'line': 24, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -85,7 +85,7 @@ class Options(): filename=get_absolute_path('data/docstring_doubles_module_multiline.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 1, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 0, 'line': 1, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -93,7 +93,7 @@ class Options(): filename=get_absolute_path('data/docstring_doubles_module_singleline.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 1, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 0, 'line': 1, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -101,9 +101,9 @@ class Options(): filename=get_absolute_path('data/docstring_doubles_class.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 2, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 8, 'line': 6, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 28, 'line': 9, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 4, 'line': 2, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, + {'col': 8, 'line': 6, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, + {'col': 28, 'line': 9, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -111,8 +111,8 @@ class Options(): filename=get_absolute_path('data/docstring_doubles_function.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 2, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 4, 'line': 8, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 4, 'line': 2, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, + {'col': 4, 'line': 8, 'message': 'Q002 Double quote docstring found but single quotes preferred'}, ]) def test_require_double_docstring_single_present(self): @@ -127,9 +127,9 @@ class Options(): filename=get_absolute_path('data/docstring_singles.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 1, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 4, 'line': 14, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 8, 'line': 26, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 0, 'line': 1, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, + {'col': 4, 'line': 14, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, + {'col': 8, 'line': 26, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -137,7 +137,7 @@ class Options(): filename=get_absolute_path('data/docstring_singles_module_multiline.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 1, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 0, 'line': 1, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -145,7 +145,7 @@ class Options(): filename=get_absolute_path('data/docstring_singles_module_singleline.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 1, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 0, 'line': 1, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -153,9 +153,9 @@ class Options(): filename=get_absolute_path('data/docstring_singles_class.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 2, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 8, 'line': 6, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 28, 'line': 9, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 4, 'line': 2, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, + {'col': 8, 'line': 6, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, + {'col': 28, 'line': 9, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -163,8 +163,8 @@ class Options(): filename=get_absolute_path('data/docstring_singles_function.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 2, 'message': 'Q002 Remove bad quotes from docstring'}, - {'col': 4, 'line': 8, 'message': 'Q002 Remove bad quotes from docstring'}, + {'col': 4, 'line': 2, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, + {'col': 4, 'line': 8, 'message': 'Q002 Single quote docstring found but double quotes preferred'}, ]) def test_require_single_docstring_single_present(self): @@ -176,12 +176,12 @@ class Options(): multiline_checker = QuoteChecker(None, filename=get_absolute_path('data/docstring_singles.py')) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 5, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 20, 'line': 11, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 4, 'line': 18, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 20, 'line': 23, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 8, 'line': 32, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 12, 'line': 37, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 0, 'line': 5, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 20, 'line': 11, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 4, 'line': 18, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 20, 'line': 23, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 8, 'line': 32, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 12, 'line': 37, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -189,8 +189,8 @@ class Options(): filename=get_absolute_path('data/docstring_singles_module_multiline.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 4, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 0, 'line': 9, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 0, 'line': 4, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 0, 'line': 9, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -198,8 +198,8 @@ class Options(): filename=get_absolute_path('data/docstring_singles_module_singleline.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 0, 'line': 2, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 0, 'line': 6, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 0, 'line': 2, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 0, 'line': 6, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -207,8 +207,8 @@ class Options(): filename=get_absolute_path('data/docstring_singles_class.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 3, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 22, 'line': 5, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 3, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 22, 'line': 5, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, ]) multiline_checker = QuoteChecker( @@ -216,9 +216,9 @@ class Options(): filename=get_absolute_path('data/docstring_singles_function.py') ) self.assertEqual(list(multiline_checker.get_quotes_errors(multiline_checker.get_file_contents())), [ - {'col': 4, 'line': 3, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 4, 'line': 11, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 38, 'line': 15, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 4, 'line': 17, 'message': 'Q001 Remove bad quotes from multiline string'}, - {'col': 4, 'line': 21, 'message': 'Q001 Remove bad quotes from multiline string'}, + {'col': 4, 'line': 3, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 4, 'line': 11, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 38, 'line': 15, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 4, 'line': 17, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, + {'col': 4, 'line': 21, 'message': 'Q001 Single quote multiline found but double quotes preferred'}, ])