diff --git a/cpplint-1.6.1.tar.gz b/cpplint-1.6.1.tar.gz deleted file mode 100644 index b4523c6..0000000 --- a/cpplint-1.6.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d430ce8f67afc1839340e60daa89e90de08b874bc27149833077bba726dfc13a -size 364487 diff --git a/cpplint-2.0.2.tar.gz b/cpplint-2.0.2.tar.gz new file mode 100644 index 0000000..d225417 --- /dev/null +++ b/cpplint-2.0.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a5971e4b5490133e425284f0c566c7ade0b959e61018d2c9af3ff7f357ddc57 +size 373781 diff --git a/deprecated-unittest-aliases.patch b/deprecated-unittest-aliases.patch deleted file mode 100644 index 8b8833b..0000000 --- a/deprecated-unittest-aliases.patch +++ /dev/null @@ -1,780 +0,0 @@ -From ea0004c2ae98c4e275f58d20bf42095160171f87 Mon Sep 17 00:00:00 2001 -From: Karthikeyan Singaravelan -Date: Sun, 17 Oct 2021 11:29:03 +0530 -Subject: [PATCH] Refactor deprecated unittest aliases for Python 3.11 - compatibility. - ---- - cpplint_unittest.py | 177 +++++++++++++++++++++++--------------------- - 1 file changed, 93 insertions(+), 84 deletions(-) - -Index: cpplint-1.6.1/cpplint_unittest.py -=================================================================== ---- cpplint-1.6.1.orig/cpplint_unittest.py -+++ cpplint-1.6.1/cpplint_unittest.py -@@ -152,13 +152,15 @@ class CpplintTestBase(unittest.TestCase) - def setUp(self): - # Allow subclasses to cheat os.path.abspath called in FileInfo class. - self.os_path_abspath_orig = os.path.abspath -+ self.assertEquals = self.assertEqual -+ self.assertTrue = self.assertTrue - - def tearDown(self): - os.path.abspath = self.os_path_abspath_orig - - # Perform lint on single line of input and return the error message. - def PerformSingleLineLint(self, code): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - lines = code.split('\n') - cpplint.RemoveMultiLineComments('foo.h', lines, error_collector) - clean_lines = cpplint.CleansedLines(lines) -@@ -176,7 +178,7 @@ class CpplintTestBase(unittest.TestCase) - - # Perform lint over multiple lines and return the error message. - def PerformMultiLineLint(self, code): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - lines = code.split('\n') - cpplint.RemoveMultiLineComments('foo.h', lines, error_collector) - lines = cpplint.CleansedLines(lines) -@@ -193,7 +195,7 @@ class CpplintTestBase(unittest.TestCase) - # Similar to PerformMultiLineLint, but calls CheckLanguage instead of - # CheckForNonStandardConstructs - def PerformLanguageRulesCheck(self, file_name, code): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - include_state = cpplint._IncludeState() - nesting_state = cpplint.NestingState() - lines = code.split('\n') -@@ -221,7 +223,7 @@ class CpplintTestBase(unittest.TestCase) - The accumulated errors. - """ - file_name = 'foo.cc' -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - function_state = cpplint._FunctionState() - lines = code.split('\n') - cpplint.RemoveMultiLineComments(file_name, lines, error_collector) -@@ -233,7 +235,7 @@ class CpplintTestBase(unittest.TestCase) - - def PerformIncludeWhatYouUse(self, code, filename='foo.h', io=codecs): - # First, build up the include state. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - include_state = cpplint._IncludeState() - nesting_state = cpplint.NestingState() - lines = code.split('\n') -@@ -277,7 +279,7 @@ class CpplintTestBase(unittest.TestCase) - self.doTestBlankLinesCheck(lines, start_errors, end_errors, extension) - - def doTestBlankLinesCheck(self, lines, start_errors, end_errors, extension): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.' + extension, extension, lines, error_collector) - self.assertEqual( - start_errors, -@@ -294,7 +296,7 @@ class CpplintTestBase(unittest.TestCase) - class CpplintTest(CpplintTestBase): - - def GetNamespaceResults(self, lines): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.RemoveMultiLineComments('foo.h', lines, error_collector) - lines = cpplint.CleansedLines(lines) - nesting_state = cpplint.NestingState() -@@ -509,7 +511,7 @@ class CpplintTest(CpplintTestBase): - 'Use int16/int64/etc, rather than the C type long' - ' [runtime/int] [4]') - # NOLINTNEXTLINE silences warning for the next line instead of current line -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('test.cc', 'cc', - ['// Copyright 2014 Your Company.', - '// NOLINTNEXTLINE(whitespace/line_length)', -@@ -518,7 +520,7 @@ class CpplintTest(CpplintTestBase): - error_collector) - self.assertEqual('', error_collector.Results()) - # LINT_C_FILE silences cast warnings for entire file. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('test.h', 'h', - ['// Copyright 2014 Your Company.', - '// NOLINT(build/header_guard)', -@@ -552,7 +554,7 @@ class CpplintTest(CpplintTestBase): - 'vim: se filetype=c :', - 'vim: se sw=8 filetype=c :', - 'vim: se sw=8 filetype=c ts=8 :']: -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('test.h', 'h', - ['// Copyright 2014 Your Company.', - '// NOLINT(build/header_guard)', -@@ -564,7 +566,7 @@ class CpplintTest(CpplintTestBase): - error_collector) - self.assertEqual('', error_collector.Results()) - # LINT_KERNEL_FILE silences whitespace/tab warnings for entire file. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('test.h', 'h', - ['// Copyright 2014 Your Company.', - '// NOLINT(build/header_guard)', -@@ -576,7 +578,7 @@ class CpplintTest(CpplintTestBase): - error_collector) - self.assertEqual('', error_collector.Results()) - # NOLINT, NOLINTNEXTLINE silences the readability/braces warning for "};". -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('test.cc', 'cc', - ['// Copyright 2014 Your Company.', - 'for (int i = 0; i != 100; ++i) {', -@@ -837,7 +839,7 @@ class CpplintTest(CpplintTestBase): - self.TestLint('std::function< int(bool) >', '') - self.TestLint('mfunction', '') - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'test.cc', 'cc', - ['// Copyright 2014 Your Company. All Rights Reserved.', -@@ -876,7 +878,7 @@ class CpplintTest(CpplintTestBase): - 'MOCK_CONST_METHOD1(method, SomeType(int));', - '') - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('mock.cc', 'cc', - ['MOCK_METHOD1(method1,', - ' bool(int));', -@@ -1373,7 +1375,7 @@ class CpplintTest(CpplintTestBase): - for extension in ['c', 'cc', 'cpp', 'cxx', 'c++', 'cu']: - file_path = 'mydir/foo.' + extension - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, extension, - ['const char* str = "This is a\\', - ' multiline string.";'], -@@ -1724,7 +1726,7 @@ class CpplintTest(CpplintTestBase): - };""", - '') - # Special case for variadic arguments -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['class Foo {', - ' template', -@@ -1734,7 +1736,7 @@ class CpplintTest(CpplintTestBase): - self.assertEqual(0, error_collector.ResultList().count( - 'Constructors that require multiple arguments should not be marked ' - 'explicit. [runtime/explicit] [0]')) -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['class Foo {', - ' template', -@@ -1744,7 +1746,7 @@ class CpplintTest(CpplintTestBase): - self.assertEqual(0, error_collector.ResultList().count( - 'Constructors that require multiple arguments should not be marked ' - 'explicit. [runtime/explicit] [0]')) -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['class Foo {', - ' template', -@@ -1754,7 +1756,7 @@ class CpplintTest(CpplintTestBase): - self.assertEqual(1, error_collector.ResultList().count( - 'Constructors callable with one argument should be marked explicit.' - ' [runtime/explicit] [5]')) -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['class Foo {', - ' template', -@@ -1765,7 +1767,7 @@ class CpplintTest(CpplintTestBase): - 'Constructors callable with one argument should be marked explicit.' - ' [runtime/explicit] [5]')) - # Anything goes inside an assembly block -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['void Func() {', - ' __asm__ (', -@@ -1875,7 +1877,7 @@ class CpplintTest(CpplintTestBase): - self.TestLint('virtual int F() %s;' % virt_specifier, error_message) - self.TestLint('virtual int F() %s {' % virt_specifier, error_message) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company.', -@@ -1900,7 +1902,7 @@ class CpplintTest(CpplintTestBase): - self.TestLint('int F() final override;', error_message) - self.TestLint('int F() final override {}', error_message) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company.', -@@ -2074,7 +2076,7 @@ class CpplintTest(CpplintTestBase): - for macro_name in ( - 'DISALLOW_COPY_AND_ASSIGN', - 'DISALLOW_IMPLICIT_CONSTRUCTORS'): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company.', -@@ -2090,7 +2092,7 @@ class CpplintTest(CpplintTestBase): - ' [readability/constructors] [3]', - error_collector.Results()) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company.', -@@ -2109,7 +2111,7 @@ class CpplintTest(CpplintTestBase): - ' [readability/constructors] [3]', - error_collector.Results()) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company.', -@@ -2442,7 +2444,7 @@ class CpplintTest(CpplintTestBase): - - # Don't warn on out-of-line method definitions. - self.TestLint('void NS::Func(X& x) {', '') -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company. All Rights Reserved.', -@@ -2456,7 +2458,7 @@ class CpplintTest(CpplintTestBase): - - # Other potential false positives. These need full parser - # state to reproduce as opposed to just TestLint. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company. All Rights Reserved.', -@@ -2499,7 +2501,7 @@ class CpplintTest(CpplintTestBase): - self.assertEqual('', error_collector.Results()) - - # Multi-line references -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company. All Rights Reserved.', -@@ -2525,7 +2527,7 @@ class CpplintTest(CpplintTestBase): - error_collector.Results()) - - # A peculiar false positive due to bad template argument parsing -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company. All Rights Reserved.', -@@ -2545,7 +2547,7 @@ class CpplintTest(CpplintTestBase): - '{ should almost always be at the end of the previous line' - ' [whitespace/braces] [4]') - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['int function()', - '{', # warning here -@@ -3056,7 +3058,7 @@ class CpplintTest(CpplintTestBase): - '}\n', '') - - # Check multiline cases. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['// Copyright 2014 Your Company.', - 'string Class', -@@ -3207,7 +3209,7 @@ class CpplintTest(CpplintTestBase): - # 1' line was also causing the issue. - def testLinePrecededByEmptyOrCommentLines(self): - def DoTest(self, lines): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', lines, error_collector) - # The warning appears only once. - self.assertEqual( -@@ -3230,7 +3232,7 @@ class CpplintTest(CpplintTestBase): - - def testNewlineAtEOF(self): - def DoTest(self, data, is_missing_eof): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', data.split('\n'), - error_collector) - # The warning appears only once. -@@ -3245,7 +3247,7 @@ class CpplintTest(CpplintTestBase): - - def testInvalidUtf8(self): - def DoTest(self, raw_bytes, has_invalid_utf8): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - if sys.version_info < (3,): - unidata = unicode(raw_bytes, 'utf8', 'replace').split('\n') - else: -@@ -3271,7 +3273,7 @@ class CpplintTest(CpplintTestBase): - - def testBadCharacters(self): - # Test for NUL bytes only -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('nul.cc', 'cc', - ['// Copyright 2014 Your Company.', - '\0', ''], error_collector) -@@ -3281,7 +3283,7 @@ class CpplintTest(CpplintTestBase): - - # Make sure both NUL bytes and UTF-8 are caught if they appear on - # the same line. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - raw_bytes = codecs_latin_encode('\xe9x\0') - if sys.version_info < (3,): - unidata = unicode(raw_bytes, 'utf8', 'replace') -@@ -3300,11 +3302,11 @@ class CpplintTest(CpplintTestBase): - 'Line contains NUL byte. [readability/nul] [5]']) - - def testIsBlankLine(self): -- self.assert_(cpplint.IsBlankLine('')) -- self.assert_(cpplint.IsBlankLine(' ')) -- self.assert_(cpplint.IsBlankLine(' \t\r\n')) -- self.assert_(not cpplint.IsBlankLine('int a;')) -- self.assert_(not cpplint.IsBlankLine('{')) -+ self.assertTrue(cpplint.IsBlankLine('')) -+ self.assertTrue(cpplint.IsBlankLine(' ')) -+ self.assertTrue(cpplint.IsBlankLine(' \t\r\n')) -+ self.assertTrue(not cpplint.IsBlankLine('int a;')) -+ self.assertTrue(not cpplint.IsBlankLine('{')) - - def testBlankLinesCheck(self): - self.TestBlankLinesCheck(['{\n', '\n', '\n', '}\n'], 1, 1) -@@ -3323,7 +3325,7 @@ class CpplintTest(CpplintTestBase): - ['int x(\n', ' int a) {\n', '\n', 'return 0;\n', '}'], 1, 0) - - def testAllowBlankLineBeforeClosingNamespace(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['namespace {', - '', -@@ -3348,7 +3350,7 @@ class CpplintTest(CpplintTestBase): - ' [whitespace/blank_line] [3]')) - - def testAllowBlankLineBeforeIfElseChain(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['if (hoge) {', - '', # No warning -@@ -3365,7 +3367,7 @@ class CpplintTest(CpplintTestBase): - ' [whitespace/blank_line] [3]')) - - def testAllowBlankLineAfterExtern(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['extern "C" {', - '', -@@ -3381,7 +3383,7 @@ class CpplintTest(CpplintTestBase): - ' [whitespace/blank_line] [3]')) - - def testBlankLineBeforeSectionKeyword(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['class A {', - ' public:', -@@ -3417,7 +3419,7 @@ class CpplintTest(CpplintTestBase): - ' [whitespace/blank_line] [3]')) - - def testNoBlankLineAfterSectionKeyword(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['class A {', - ' public:', -@@ -3441,7 +3443,7 @@ class CpplintTest(CpplintTestBase): - ' [whitespace/blank_line] [3]')) - - def testAllowBlankLinesInRawStrings(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['// Copyright 2014 Your Company.', - 'static const char *kData[] = {R"(', -@@ -3454,7 +3456,7 @@ class CpplintTest(CpplintTestBase): - self.assertEqual('', error_collector.Results()) - - def testElseOnSameLineAsClosingBraces(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['if (hoge) {', - '}', -@@ -3468,7 +3470,7 @@ class CpplintTest(CpplintTestBase): - 'An else should appear on the same line as the preceding }' - ' [whitespace/newline] [4]')) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['if (hoge) {', - '', -@@ -3482,7 +3484,7 @@ class CpplintTest(CpplintTestBase): - 'An else should appear on the same line as the preceding }' - ' [whitespace/newline] [4]')) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['if (hoge) {', - '', -@@ -3494,7 +3496,7 @@ class CpplintTest(CpplintTestBase): - ' [whitespace/newline] [4]')) - - def testMultipleStatementsOnSameLine(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['for (int i = 0; i < 1; i++) {}', - 'switch (x) {', -@@ -3513,7 +3515,7 @@ class CpplintTest(CpplintTestBase): - cpplint._cpplint_state.verbose_level = old_verbose_level - - def testLambdasOnSameLine(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - old_verbose_level = cpplint._cpplint_state.verbose_level - cpplint._cpplint_state.verbose_level = 0 - cpplint.ProcessFileData('foo.cc', 'cc', -@@ -3524,7 +3526,7 @@ class CpplintTest(CpplintTestBase): - self.assertEqual(0, error_collector.Results().count( - 'More than one command on the same line [whitespace/newline] [0]')) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - old_verbose_level = cpplint._cpplint_state.verbose_level - cpplint._cpplint_state.verbose_level = 0 - cpplint.ProcessFileData('foo.cc', 'cc', -@@ -3536,7 +3538,7 @@ class CpplintTest(CpplintTestBase): - self.assertEqual(0, error_collector.Results().count( - 'More than one command on the same line [whitespace/newline] [0]')) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - old_verbose_level = cpplint._cpplint_state.verbose_level - cpplint._cpplint_state.verbose_level = 0 - cpplint.ProcessFileData('foo.cc', 'cc', -@@ -3548,7 +3550,7 @@ class CpplintTest(CpplintTestBase): - self.assertEqual(0, error_collector.Results().count( - 'More than one command on the same line [whitespace/newline] [0]')) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - old_verbose_level = cpplint._cpplint_state.verbose_level - cpplint._cpplint_state.verbose_level = 0 - cpplint.ProcessFileData('foo.cc', 'cc', -@@ -3561,7 +3563,7 @@ class CpplintTest(CpplintTestBase): - 'More than one command on the same line [whitespace/newline] [0]')) - - def testEndOfNamespaceComments(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('foo.cc', 'cc', - ['namespace {', - '', -@@ -4377,7 +4379,7 @@ class CpplintTest(CpplintTestBase): - cpplint._DEFAULT_FILTERS = default_filters - - def testDuplicateHeader(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('path/self.cc', 'cc', - ['// Copyright 2014 Your Company. All Rights Reserved.', - '#include "path/self.h"', -@@ -4481,7 +4483,7 @@ class CpplintTest(CpplintTestBase): - - def GetBuildHeaderGuardPreprocessorSymbol(self, file_path): - # Figure out the expected header guard by processing an empty file. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', [], error_collector) - for error in error_collector.ResultList(): - matched = re.search( -@@ -4497,7 +4499,7 @@ class CpplintTest(CpplintTestBase): - self.assertTrue(re.search('MYDIR_FOO_H_$', expected_guard)) - - # No guard at all: expect one error. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', [], error_collector) - self.assertEqual( - 1, -@@ -4507,7 +4509,7 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList()) - - # No header guard, but the error is suppressed. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['// Copyright 2014 Your Company.', - '// NOLINT(build/header_guard)', ''], -@@ -4515,7 +4517,7 @@ class CpplintTest(CpplintTestBase): - self.assertEqual([], error_collector.ResultList()) - - # Wrong guard -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef FOO_H', '#define FOO_H'], error_collector) - self.assertEqual( -@@ -4526,7 +4528,7 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList()) - - # No define -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef %s' % expected_guard], error_collector) - self.assertEqual( -@@ -4537,7 +4539,7 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList()) - - # Mismatched define -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef %s' % expected_guard, - '#define FOO_H'], -@@ -4550,7 +4552,7 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList()) - - # No endif -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef %s' % expected_guard, - '#define %s' % expected_guard, -@@ -4564,7 +4566,7 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList()) - - # Commentless endif -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef %s' % expected_guard, - '#define %s' % expected_guard, -@@ -4578,7 +4580,7 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList()) - - # Commentless endif for old-style guard -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef %s_' % expected_guard, - '#define %s_' % expected_guard, -@@ -4592,7 +4594,7 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList()) - - # No header guard errors -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef %s' % expected_guard, - '#define %s' % expected_guard, -@@ -4603,7 +4605,7 @@ class CpplintTest(CpplintTestBase): - self.fail('Unexpected error: %s' % line) - - # No header guard errors for old-style guard -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef %s_' % expected_guard, - '#define %s_' % expected_guard, -@@ -4617,7 +4619,7 @@ class CpplintTest(CpplintTestBase): - try: - cpplint._cpplint_state.verbose_level = 0 - # Warn on old-style guard if verbosity is 0. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef %s_' % expected_guard, - '#define %s_' % expected_guard, -@@ -4633,7 +4635,7 @@ class CpplintTest(CpplintTestBase): - cpplint._cpplint_state.verbose_level = old_verbose_level - - # Completely incorrect header guard -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef FOO', - '#define FOO', -@@ -4653,7 +4655,7 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList()) - - # incorrect header guard with nolint -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef FOO // NOLINT', - '#define FOO', -@@ -4674,7 +4676,7 @@ class CpplintTest(CpplintTestBase): - - # Special case for flymake - for test_file in ['mydir/foo_flymake.h', 'mydir/.flymake/foo.h']: -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(test_file, 'h', - ['// Copyright 2014 Your Company.', ''], - error_collector) -@@ -4688,7 +4690,7 @@ class CpplintTest(CpplintTestBase): - # Cuda guard - file_path = 'mydir/foo.cuh' - expected_guard = self.GetBuildHeaderGuardPreprocessorSymbol(file_path) -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'cuh', - ['#ifndef FOO', - '#define FOO', -@@ -4708,7 +4710,7 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList()) - - def testPragmaOnce(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData('mydir/foo.h', 'h', - ['// Copyright 2014 Your Company.', '#pragma once', ''], - error_collector) -@@ -4988,7 +4990,7 @@ class CpplintTest(CpplintTestBase): - self.TestLanguageRulesCheck('foo.h', code, '') - - def testBuildPrintfFormat(self): -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - [r'printf("\%%d", value);', -@@ -5002,7 +5004,7 @@ class CpplintTest(CpplintTestBase): - '%, [, (, and { are undefined character escapes. Unescape them.' - ' [build/printf_format] [3]')) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - 'foo.cc', 'cc', - ['// Copyright 2014 Your Company.', -@@ -5121,13 +5123,13 @@ class CpplintTest(CpplintTestBase): - file_path = 'mydir/googleclient/foo.cc' - - # There should be a copyright message in the first 10 lines -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'cc', [], error_collector) - self.assertEqual( - 1, - error_collector.ResultList().count(legal_copyright_message)) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - file_path, 'cc', - ['' for unused_i in range(10)] + [copyright_line], -@@ -5137,13 +5139,13 @@ class CpplintTest(CpplintTestBase): - error_collector.ResultList().count(legal_copyright_message)) - - # Test that warning isn't issued if Copyright line appears early enough. -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(file_path, 'cc', [copyright_line], error_collector) - for message in error_collector.ResultList(): - if message.find('legal/copyright') != -1: - self.fail('Unexpected error: %s' % message) - -- error_collector = ErrorCollector(self.assert_) -+ error_collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData( - file_path, 'cc', - ['' for unused_i in range(9)] + [copyright_line], -@@ -5179,14 +5181,14 @@ class Cxx11Test(CpplintTestBase): - lines.append('') - - # Process the file and check resulting error count. -- collector = ErrorCollector(self.assert_) -+ collector = ErrorCollector(self.assertTrue) - cpplint.ProcessFileData(filename, extension, lines, collector) - error_list = collector.ResultList() - self.assertEqual(count, len(error_list), error_list) - - def TestCxx11Feature(self, code, expected_error): - lines = code.split('\n') -- collector = ErrorCollector(self.assert_) -+ collector = ErrorCollector(self.assertTrue) - cpplint.RemoveMultiLineComments('foo.h', lines, collector) - clean_lines = cpplint.CleansedLines(lines) - cpplint.FlagCxx11Features('foo.cc', clean_lines, 0, collector) -@@ -5244,7 +5246,7 @@ class Cxx14Test(CpplintTestBase): - - def TestCxx14Feature(self, code, expected_error): - lines = code.split('\n') -- collector = ErrorCollector(self.assert_) -+ collector = ErrorCollector(self.assertTrue) - cpplint.RemoveMultiLineComments('foo.h', lines, collector) - clean_lines = cpplint.CleansedLines(lines) - cpplint.FlagCxx14Features('foo.cc', clean_lines, 0, collector) -@@ -5261,6 +5263,9 @@ class Cxx14Test(CpplintTestBase): - - class CleansedLinesTest(unittest.TestCase): - -+ def setUp(self): -+ self.assertEquals = self.assertEqual -+ - def testInit(self): - lines = ['Line 1', - 'Line 2', -@@ -5645,6 +5650,7 @@ class CheckForFunctionLengthsTest(Cpplin - - def setUp(self): - # Reducing these thresholds for the tests speeds up tests significantly. -+ CpplintTestBase.setUp(self) - self.old_normal_trigger = cpplint._FunctionState._NORMAL_TRIGGER - self.old_test_trigger = cpplint._FunctionState._TEST_TRIGGER - -@@ -5996,6 +6002,7 @@ def TrimExtraIndent(text_block): - class CloseExpressionTest(unittest.TestCase): - - def setUp(self): -+ self.assertEquals = self.assertEqual - self.lines = cpplint.CleansedLines( - # 1 2 3 4 5 - # 0123456789012345678901234567890123456789012345678901234567890 -@@ -6067,7 +6074,8 @@ class NestingStateTest(unittest.TestCase - - def setUp(self): - self.nesting_state = cpplint.NestingState() -- self.error_collector = ErrorCollector(self.assert_) -+ self.error_collector = ErrorCollector(self.assertTrue) -+ self.assertEquals = self.assertEqual - - def UpdateWithLines(self, lines): - clean_lines = cpplint.CleansedLines(lines) -@@ -6450,6 +6458,7 @@ class QuietTest(unittest.TestCase): - self.python_executable = sys.executable or 'python' - self.cpplint_test_h = os.path.join(self.this_dir_path, - 'cpplint_test_header.h') -+ self.assertEquals = self.assertEqual - open(self.cpplint_test_h, 'w').close() - - def tearDown(self): diff --git a/do-not-use-codecs-open.patch b/do-not-use-codecs-open.patch new file mode 100644 index 0000000..fafe170 --- /dev/null +++ b/do-not-use-codecs-open.patch @@ -0,0 +1,45 @@ +From fe579d0e248f2f1f977ecb902f7a2eb1a4a66eef Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Fri, 31 Oct 2025 12:50:26 +1100 +Subject: [PATCH 1/3] Drop use of codecs.open() + +codecs.open() has been deprecated as of Python 3.14, and plain open() +supports all use-cases we have, switch to using it. +--- + cpplint.py | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +Index: cpplint-2.0.2/cpplint.py +=================================================================== +--- cpplint-2.0.2.orig/cpplint.py ++++ cpplint-2.0.2/cpplint.py +@@ -7448,7 +7448,7 @@ def ProcessConfigOverrides(filename): + continue + + try: +- with codecs.open(cfg_file, "r", "utf8", "replace") as file_handle: ++ with open(cfg_file, encoding="utf8", errors="replace") as file_handle: + for line in file_handle: + line, _, _ = line.partition("#") # Remove comments. + if not line.strip(): +@@ -7541,16 +7541,15 @@ def ProcessFile(filename, vlevel, extra_ + crlf_lines = [] + try: + # Support the UNIX convention of using "-" for stdin. Note that +- # we are not opening the file with universal newline support +- # (which codecs doesn't support anyway), so the resulting lines do +- # contain trailing '\r' characters if we are reading a file that +- # has CRLF endings. ++ # we are not opening the file with universal newline support, ++ # so the resulting lines do # contain trailing '\r' characters ++ # if we are reading a file that # has CRLF endings. + # If after the split a trailing '\r' is present, it is removed + # below. + if filename == "-": + lines = sys.stdin.read().split("\n") + else: +- with codecs.open(filename, "r", "utf8", "replace") as target_file: ++ with open(filename, encoding="utf8", errors="replace") as target_file: + lines = target_file.read().split("\n") + + # Remove trailing '\r'. diff --git a/drop-sre-compile.patch b/drop-sre-compile.patch deleted file mode 100644 index 09afe2e..0000000 --- a/drop-sre-compile.patch +++ /dev/null @@ -1,1774 +0,0 @@ -From e84e84f53915ae2a9214e756cf89c573a73bbcd3 Mon Sep 17 00:00:00 2001 -From: Jochen Sprickerhof -Date: Sat, 24 Dec 2022 16:46:29 +0100 -Subject: [PATCH 1/2] Drop deprecated sre_compile usage - ---- - cpplint.py | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -Index: cpplint-1.6.1/cpplint.py -=================================================================== ---- cpplint-1.6.1.orig/cpplint.py -+++ cpplint-1.6.1/cpplint.py -@@ -53,7 +53,6 @@ import itertools - import math # for log - import os - import re --import sre_compile - import string - import sys - import sysconfig -@@ -853,8 +852,6 @@ _SED_FIXUPS = { - 'Missing space after ,': r's/,\([^ ]\)/, \1/g', - } - --_regexp_compile_cache = {} -- - # {str, set(int)}: a map from error categories to sets of linenumbers - # on which those errors are expected and should be suppressed. - _error_suppressions = {} -@@ -978,7 +975,7 @@ def ParseNolintSuppressions(filename, ra - linenum: int, the number of the current line. - error: function, an error handler. - """ -- matched = Search(r'\bNOLINT(NEXTLINE)?\b(\([^)]+\))?', raw_line) -+ matched = re.search(r'\bNOLINT(NEXTLINE)?\b(\([^)]+\))?', raw_line) - if matched: - if matched.group(1): - suppressed_line = linenum + 1 -@@ -1042,41 +1039,6 @@ def IsErrorSuppressedByNolint(category, - linenum in _error_suppressions.get(None, set())) - - --def Match(pattern, s): -- """Matches the string with the pattern, caching the compiled regexp.""" -- # The regexp compilation caching is inlined in both Match and Search for -- # performance reasons; factoring it out into a separate function turns out -- # to be noticeably expensive. -- if pattern not in _regexp_compile_cache: -- _regexp_compile_cache[pattern] = sre_compile.compile(pattern) -- return _regexp_compile_cache[pattern].match(s) -- -- --def ReplaceAll(pattern, rep, s): -- """Replaces instances of pattern in a string with a replacement. -- -- The compiled regex is kept in a cache shared by Match and Search. -- -- Args: -- pattern: regex pattern -- rep: replacement text -- s: search string -- -- Returns: -- string with replacements made (or original string if no replacements) -- """ -- if pattern not in _regexp_compile_cache: -- _regexp_compile_cache[pattern] = sre_compile.compile(pattern) -- return _regexp_compile_cache[pattern].sub(rep, s) -- -- --def Search(pattern, s): -- """Searches the string for the pattern, caching the compiled regexp.""" -- if pattern not in _regexp_compile_cache: -- _regexp_compile_cache[pattern] = sre_compile.compile(pattern) -- return _regexp_compile_cache[pattern].search(s) -- -- - def _IsSourceExtension(s): - """File extension (excluding dot) matches a source file extension.""" - return s in GetNonHeaderExtensions() -@@ -1194,7 +1156,7 @@ class _IncludeState(object): - # If previous line was a blank line, assume that the headers are - # intentionally sorted the way they are. - if (self._last_header > header_path and -- Match(r'^\s*#\s*include\b', clean_lines.elided[linenum - 1])): -+ re.match(r'^\s*#\s*include\b', clean_lines.elided[linenum - 1])): - return False - return True - -@@ -1536,7 +1498,7 @@ class _FunctionState(object): - if not self.in_a_function: - return - -- if Match(r'T(EST|est)', self.current_function): -+ if re.match(r'T(EST|est)', self.current_function): - base_trigger = self._TEST_TRIGGER - else: - base_trigger = self._NORMAL_TRIGGER -@@ -1808,7 +1770,7 @@ def CleanseRawStrings(raw_lines): - # Found the end of the string, match leading space for this - # line and resume copying the original lines, and also insert - # a "" on the last line. -- leading_space = Match(r'^(\s*)\S', line) -+ leading_space = re.match(r'^(\s*)\S', line) - line = leading_space.group(1) + '""' + line[end + len(delimiter):] - delimiter = None - else: -@@ -1829,9 +1791,9 @@ def CleanseRawStrings(raw_lines): - # before removing raw strings. This is because there are some - # cpplint checks that requires the comments to be preserved, but - # we don't want to check comments that are inside raw strings. -- matched = Match(r'^(.*?)\b(?:R|u8R|uR|UR|LR)"([^\s\\()]*)\((.*)$', line) -+ matched = re.match(r'^(.*?)\b(?:R|u8R|uR|UR|LR)"([^\s\\()]*)\((.*)$', line) - if (matched and -- not Match(r'^([^\'"]|\'(\\.|[^\'])*\'|"(\\.|[^"])*")*//', -+ not re.match(r'^([^\'"]|\'(\\.|[^\'])*\'|"(\\.|[^"])*")*//', - matched.group(1))): - delimiter = ')' + matched.group(2) + '"' - -@@ -1968,7 +1930,7 @@ class CleansedLines(object): - collapsed = '' - while True: - # Find the first quote character -- match = Match(r'^([^\'"]*)([\'"])(.*)$', elided) -+ match = re.match(r'^([^\'"]*)([\'"])(.*)$', elided) - if not match: - collapsed += elided - break -@@ -1993,8 +1955,8 @@ class CleansedLines(object): - # correctly as long as there are digits on both sides of the - # separator. So we are fine as long as we don't see something - # like "0.'3" (gcc 4.9.0 will not allow this literal). -- if Search(r'\b(?:0[bBxX]?|[1-9])[0-9a-fA-F]*$', head): -- match_literal = Match(r'^((?:\'?[0-9a-zA-Z_])*)(.*)$', "'" + tail) -+ if re.search(r'\b(?:0[bBxX]?|[1-9])[0-9a-fA-F]*$', head): -+ match_literal = re.match(r'^((?:\'?[0-9a-zA-Z_])*)(.*)$', "'" + tail) - collapsed += head + match_literal.group(1).replace("'", '') - elided = match_literal.group(2) - else: -@@ -2036,7 +1998,7 @@ def FindEndOfExpressionInLine(line, star - stack.pop() - if not stack: - return (-1, None) -- elif i > 0 and Search(r'\boperator\s*$', line[0:i]): -+ elif i > 0 and re.search(r'\boperator\s*$', line[0:i]): - # operator<, don't add to stack - continue - else: -@@ -2065,7 +2027,7 @@ def FindEndOfExpressionInLine(line, star - - # Ignore "->" and operator functions - if (i > 0 and -- (line[i - 1] == '-' or Search(r'\boperator\s*$', line[0:i - 1]))): -+ (line[i - 1] == '-' or re.search(r'\boperator\s*$', line[0:i - 1]))): - continue - - # Pop the stack if there is a matching '<'. Otherwise, ignore -@@ -2112,7 +2074,7 @@ def CloseExpression(clean_lines, linenum - """ - - line = clean_lines.elided[linenum] -- if (line[pos] not in '({[<') or Match(r'<[<=]', line[pos:]): -+ if (line[pos] not in '({[<') or re.match(r'<[<=]', line[pos:]): - return (line, clean_lines.NumLines(), -1) - - # Check first line -@@ -2160,8 +2122,8 @@ def FindStartOfExpressionInLine(line, en - # Ignore it if it's a "->" or ">=" or "operator>" - if (i > 0 and - (line[i - 1] == '-' or -- Match(r'\s>=\s', line[i - 1:]) or -- Search(r'\boperator\s*$', line[0:i]))): -+ re.match(r'\s>=\s', line[i - 1:]) or -+ re.search(r'\boperator\s*$', line[0:i]))): - i -= 1 - else: - stack.append('>') -@@ -2269,7 +2231,7 @@ def GetIndentLevel(line): - Returns: - An integer count of leading spaces, possibly zero. - """ -- indent = Match(r'^( *)\S', line) -+ indent = re.match(r'^( *)\S', line) - if indent: - return len(indent.group(1)) - else: -@@ -2397,12 +2359,12 @@ def CheckForHeaderGuard(filename, clean_ - # and not the general NOLINT or NOLINT(*) syntax. - raw_lines = clean_lines.lines_without_raw_strings - for i in raw_lines: -- if Search(r'//\s*NOLINT\(build/header_guard\)', i): -+ if re.search(r'//\s*NOLINT\(build/header_guard\)', i): - return - - # Allow pragma once instead of header guards - for i in raw_lines: -- if Search(r'^\s*#pragma\s+once', i): -+ if re.search(r'^\s*#pragma\s+once', i): - return - - cppvar = GetHeaderGuardCPPVariable(filename) -@@ -2448,7 +2410,7 @@ def CheckForHeaderGuard(filename, clean_ - # Check for "//" comments on endif line. - ParseNolintSuppressions(filename, raw_lines[endif_linenum], endif_linenum, - error) -- match = Match(r'#endif\s*//\s*' + cppvar + r'(_)?\b', endif) -+ match = re.match(r'#endif\s*//\s*' + cppvar + r'(_)?\b', endif) - if match: - if match.group(1) == '_': - # Issue low severity warning for deprecated double trailing underscore -@@ -2462,12 +2424,12 @@ def CheckForHeaderGuard(filename, clean_ - no_single_line_comments = True - for i in xrange(1, len(raw_lines) - 1): - line = raw_lines[i] -- if Match(r'^(?:(?:\'(?:\.|[^\'])*\')|(?:"(?:\.|[^"])*")|[^\'"])*//', line): -+ if re.match(r'^(?:(?:\'(?:\.|[^\'])*\')|(?:"(?:\.|[^"])*")|[^\'"])*//', line): - no_single_line_comments = False - break - - if no_single_line_comments: -- match = Match(r'#endif\s*/\*\s*' + cppvar + r'(_)?\s*\*/', endif) -+ match = re.match(r'#endif\s*/\*\s*' + cppvar + r'(_)?\s*\*/', endif) - if match: - if match.group(1) == '_': - # Low severity warning for double trailing underscore -@@ -2485,7 +2447,7 @@ def CheckHeaderFileIncluded(filename, in - - # Do not check test files - fileinfo = FileInfo(filename) -- if Search(_TEST_FILE_SUFFIX, fileinfo.BaseName()): -+ if re.search(_TEST_FILE_SUFFIX, fileinfo.BaseName()): - return - - for ext in GetHeaderExtensions(): -@@ -2643,7 +2605,7 @@ def CheckPosixThreading(filename, clean_ - for single_thread_func, multithread_safe_func, pattern in _THREADING_LIST: - # Additional pattern matching check to confirm that this is the - # function we are looking for -- if Search(pattern, line): -+ if re.search(pattern, line): - error(filename, linenum, 'runtime/threadsafe_fn', 2, - 'Consider using ' + multithread_safe_func + - '...) instead of ' + single_thread_func + -@@ -2663,7 +2625,7 @@ def CheckVlogArguments(filename, clean_l - error: The function to call with any errors found. - """ - line = clean_lines.elided[linenum] -- if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line): -+ if re.search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line): - error(filename, linenum, 'runtime/vlog', 5, - 'VLOG() should be used with numeric verbosity level. ' - 'Use LOG() if you want symbolic severity levels.') -@@ -2697,17 +2659,17 @@ def CheckInvalidIncrement(filename, clea - - - def IsMacroDefinition(clean_lines, linenum): -- if Search(r'^#define', clean_lines[linenum]): -+ if re.search(r'^#define', clean_lines[linenum]): - return True - -- if linenum > 0 and Search(r'\\$', clean_lines[linenum - 1]): -+ if linenum > 0 and re.search(r'\\$', clean_lines[linenum - 1]): - return True - - return False - - - def IsForwardClassDeclaration(clean_lines, linenum): -- return Match(r'^\s*(\btemplate\b)*.*class\s+\w+;\s*$', clean_lines[linenum]) -+ return re.match(r'^\s*(\btemplate\b)*.*class\s+\w+;\s*$', clean_lines[linenum]) - - - class _BlockInfo(object): -@@ -2802,7 +2764,7 @@ class _ClassInfo(_BlockInfo): - - def CheckBegin(self, filename, clean_lines, linenum, error): - # Look for a bare ':' -- if Search('(^|[^:]):($|[^:])', clean_lines.elided[linenum]): -+ if re.search('(^|[^:]):($|[^:])', clean_lines.elided[linenum]): - self.is_derived = True - - def CheckEnd(self, filename, clean_lines, linenum, error): -@@ -2810,7 +2772,7 @@ class _ClassInfo(_BlockInfo): - # the class. - seen_last_thing_in_class = False - for i in xrange(linenum - 1, self.starting_linenum, -1): -- match = Search( -+ match = re.search( - r'\b(DISALLOW_COPY_AND_ASSIGN|DISALLOW_IMPLICIT_CONSTRUCTORS)\(' + - self.name + r'\)', - clean_lines.elided[i]) -@@ -2820,13 +2782,13 @@ class _ClassInfo(_BlockInfo): - match.group(1) + ' should be the last thing in the class') - break - -- if not Match(r'^\s*$', clean_lines.elided[i]): -+ if not re.match(r'^\s*$', clean_lines.elided[i]): - seen_last_thing_in_class = True - - # Check that closing brace is aligned with beginning of the class. - # Only do this if the closing brace is indented by only whitespaces. - # This means we will not check single-line class definitions. -- indent = Match(r'^( *)\}', clean_lines.elided[linenum]) -+ indent = re.match(r'^( *)\}', clean_lines.elided[linenum]) - if indent and len(indent.group(1)) != self.class_indent: - if self.is_struct: - parent = 'struct ' + self.name -@@ -2860,7 +2822,7 @@ class _NamespaceInfo(_BlockInfo): - # deciding what these nontrivial things are, so this check is - # triggered by namespace size only, which works most of the time. - if (linenum - self.starting_linenum < 10 -- and not Match(r'^\s*};*\s*(//|/\*).*\bnamespace\b', line)): -+ and not re.match(r'^\s*};*\s*(//|/\*).*\bnamespace\b', line)): - return - - # Look for matching comment at end of namespace. -@@ -2877,7 +2839,7 @@ class _NamespaceInfo(_BlockInfo): - # expected namespace. - if self.name: - # Named namespace -- if not Match((r'^\s*};*\s*(//|/\*).*\bnamespace\s+' + -+ if not re.match((r'^\s*};*\s*(//|/\*).*\bnamespace\s+' + - re.escape(self.name) + r'[\*/\.\\\s]*$'), - line): - error(filename, linenum, 'readability/namespace', 5, -@@ -2885,10 +2847,10 @@ class _NamespaceInfo(_BlockInfo): - self.name) - else: - # Anonymous namespace -- if not Match(r'^\s*};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line): -+ if not re.match(r'^\s*};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line): - # If "// namespace anonymous" or "// anonymous namespace (more text)", - # mention "// anonymous namespace" as an acceptable form -- if Match(r'^\s*}.*\b(namespace anonymous|anonymous namespace)\b', line): -+ if re.match(r'^\s*}.*\b(namespace anonymous|anonymous namespace)\b', line): - error(filename, linenum, 'readability/namespace', 5, - 'Anonymous namespace should be terminated with "// namespace"' - ' or "// anonymous namespace"') -@@ -2991,7 +2953,7 @@ class NestingState(object): - while linenum < clean_lines.NumLines(): - # Find the earliest character that might indicate a template argument - line = clean_lines.elided[linenum] -- match = Match(r'^[^{};=\[\]\.<>]*(.)', line[pos:]) -+ match = re.match(r'^[^{};=\[\]\.<>]*(.)', line[pos:]) - if not match: - linenum += 1 - pos = 0 -@@ -3051,11 +3013,11 @@ class NestingState(object): - Args: - line: current line to check. - """ -- if Match(r'^\s*#\s*(if|ifdef|ifndef)\b', line): -+ if re.match(r'^\s*#\s*(if|ifdef|ifndef)\b', line): - # Beginning of #if block, save the nesting stack here. The saved - # stack will allow us to restore the parsing state in the #else case. - self.pp_stack.append(_PreprocessorInfo(copy.deepcopy(self.stack))) -- elif Match(r'^\s*#\s*(else|elif)\b', line): -+ elif re.match(r'^\s*#\s*(else|elif)\b', line): - # Beginning of #else block - if self.pp_stack: - if not self.pp_stack[-1].seen_else: -@@ -3070,7 +3032,7 @@ class NestingState(object): - else: - # TODO(unknown): unexpected #else, issue warning? - pass -- elif Match(r'^\s*#\s*endif\b', line): -+ elif re.match(r'^\s*#\s*endif\b', line): - # End of #if or #else blocks. - if self.pp_stack: - # If we saw an #else, we will need to restore the nesting -@@ -3142,7 +3104,7 @@ class NestingState(object): - # declarations even if it weren't followed by a whitespace, this - # is so that we don't confuse our namespace checker. The - # missing spaces will be flagged by CheckSpacing. -- namespace_decl_match = Match(r'^\s*namespace\b\s*([:\w]+)?(.*)$', line) -+ namespace_decl_match = re.match(r'^\s*namespace\b\s*([:\w]+)?(.*)$', line) - if not namespace_decl_match: - break - -@@ -3159,7 +3121,7 @@ class NestingState(object): - # such as in: - # class LOCKABLE API Object { - # }; -- class_decl_match = Match( -+ class_decl_match = re.match( - r'^(\s*(?:template\s*<[\w\s<>,:=]*>\s*)?' - r'(class|struct)\s+(?:[a-zA-Z0-9_]+\s+)*(\w+(?:::\w+)*))' - r'(.*)$', line) -@@ -3189,7 +3151,7 @@ class NestingState(object): - # Update access control if we are inside a class/struct - if self.stack and isinstance(self.stack[-1], _ClassInfo): - classinfo = self.stack[-1] -- access_match = Match( -+ access_match = re.match( - r'^(.*)\b(public|private|protected|signals)(\s+(?:slots\s*)?)?' - r':(?:[^:]|$)', - line) -@@ -3200,7 +3162,7 @@ class NestingState(object): - # check if the keywords are not preceded by whitespaces. - indent = access_match.group(1) - if (len(indent) != classinfo.class_indent + 1 and -- Match(r'^\s*$', indent)): -+ re.match(r'^\s*$', indent)): - if classinfo.is_struct: - parent = 'struct ' + classinfo.name - else: -@@ -3215,7 +3177,7 @@ class NestingState(object): - # Consume braces or semicolons from what's left of the line - while True: - # Match first brace, semicolon, or closed parenthesis. -- matched = Match(r'^[^{;)}]*([{;)}])(.*)$', line) -+ matched = re.match(r'^[^{;)}]*([{;)}])(.*)$', line) - if not matched: - break - -@@ -3226,7 +3188,7 @@ class NestingState(object): - # stack otherwise. - if not self.SeenOpenBrace(): - self.stack[-1].seen_open_brace = True -- elif Match(r'^extern\s*"[^"]*"\s*\{', line): -+ elif re.match(r'^extern\s*"[^"]*"\s*\{', line): - self.stack.append(_ExternCInfo(linenum)) - else: - self.stack.append(_BlockInfo(linenum, True)) -@@ -3317,25 +3279,25 @@ def CheckForNonStandardConstructs(filena - # Remove comments from the line, but leave in strings for now. - line = clean_lines.lines[linenum] - -- if Search(r'printf\s*\(.*".*%[-+ ]?\d*q', line): -+ if re.search(r'printf\s*\(.*".*%[-+ ]?\d*q', line): - error(filename, linenum, 'runtime/printf_format', 3, - '%q in format strings is deprecated. Use %ll instead.') - -- if Search(r'printf\s*\(.*".*%\d+\$', line): -+ if re.search(r'printf\s*\(.*".*%\d+\$', line): - error(filename, linenum, 'runtime/printf_format', 2, - '%N$ formats are unconventional. Try rewriting to avoid them.') - - # Remove escaped backslashes before looking for undefined escapes. - line = line.replace('\\\\', '') - -- if Search(r'("|\').*\\(%|\[|\(|{)', line): -+ if re.search(r'("|\').*\\(%|\[|\(|{)', line): - error(filename, linenum, 'build/printf_format', 3, - '%, [, (, and { are undefined character escapes. Unescape them.') - - # For the rest, work with both comments and strings removed. - line = clean_lines.elided[linenum] - -- if Search(r'\b(const|volatile|void|char|short|int|long' -+ if re.search(r'\b(const|volatile|void|char|short|int|long' - r'|float|double|signed|unsigned' - r'|schar|u?int8|u?int16|u?int32|u?int64)' - r'\s+(register|static|extern|typedef)\b', -@@ -3344,20 +3306,20 @@ def CheckForNonStandardConstructs(filena - 'Storage-class specifier (static, extern, typedef, etc) should be ' - 'at the beginning of the declaration.') - -- if Match(r'\s*#\s*endif\s*[^/\s]+', line): -+ if re.match(r'\s*#\s*endif\s*[^/\s]+', line): - error(filename, linenum, 'build/endif_comment', 5, - 'Uncommented text after #endif is non-standard. Use a comment.') - -- if Match(r'\s*class\s+(\w+\s*::\s*)+\w+\s*;', line): -+ if re.match(r'\s*class\s+(\w+\s*::\s*)+\w+\s*;', line): - error(filename, linenum, 'build/forward_decl', 5, - 'Inner-style forward declarations are invalid. Remove this line.') - -- if Search(r'(\w+|[+-]?\d+(\.\d*)?)\s*(<|>)\?=?\s*(\w+|[+-]?\d+)(\.\d*)?', -+ if re.search(r'(\w+|[+-]?\d+(\.\d*)?)\s*(<|>)\?=?\s*(\w+|[+-]?\d+)(\.\d*)?', - line): - error(filename, linenum, 'build/deprecated', 3, - '>? and = 1)) - initializer_list_constructor = bool( - onearg_constructor and -- Search(r'\bstd\s*::\s*initializer_list\b', constructor_args[0])) -+ re.search(r'\bstd\s*::\s*initializer_list\b', constructor_args[0])) - copy_constructor = bool( - onearg_constructor and -- Match(r'((const\s+(volatile\s+)?)?|(volatile\s+(const\s+)?))?' -+ re.match(r'((const\s+(volatile\s+)?)?|(volatile\s+(const\s+)?))?' - r'%s(\s*<[^>]*>)?(\s+const)?\s*(?:<\w+>\s*)?&' - % re.escape(base_classname), constructor_args[0].strip())) - -@@ -3470,7 +3432,7 @@ def CheckSpacingForFunctionCall(filename - r'\bfor\s*\((.*)\)\s*{', - r'\bwhile\s*\((.*)\)\s*[{;]', - r'\bswitch\s*\((.*)\)\s*{'): -- match = Search(pattern, line) -+ match = re.search(pattern, line) - if match: - fncall = match.group(1) # look inside the parens for function calls - break -@@ -3489,26 +3451,26 @@ def CheckSpacingForFunctionCall(filename - # Note that we assume the contents of [] to be short enough that - # they'll never need to wrap. - if ( # Ignore control structures. -- not Search(r'\b(if|elif|for|while|switch|return|new|delete|catch|sizeof)\b', -+ not re.search(r'\b(if|elif|for|while|switch|return|new|delete|catch|sizeof)\b', - fncall) and - # Ignore pointers/references to functions. -- not Search(r' \([^)]+\)\([^)]*(\)|,$)', fncall) and -+ not re.search(r' \([^)]+\)\([^)]*(\)|,$)', fncall) and - # Ignore pointers/references to arrays. -- not Search(r' \([^)]+\)\[[^\]]+\]', fncall)): -- if Search(r'\w\s*\(\s(?!\s*\\$)', fncall): # a ( used for a fn call -+ not re.search(r' \([^)]+\)\[[^\]]+\]', fncall)): -+ if re.search(r'\w\s*\(\s(?!\s*\\$)', fncall): # a ( used for a fn call - error(filename, linenum, 'whitespace/parens', 4, - 'Extra space after ( in function call') -- elif Search(r'\(\s+(?!(\s*\\)|\()', fncall): -+ elif re.search(r'\(\s+(?!(\s*\\)|\()', fncall): - error(filename, linenum, 'whitespace/parens', 2, - 'Extra space after (') -- if (Search(r'\w\s+\(', fncall) and -- not Search(r'_{0,2}asm_{0,2}\s+_{0,2}volatile_{0,2}\s+\(', fncall) and -- not Search(r'#\s*define|typedef|using\s+\w+\s*=', fncall) and -- not Search(r'\w\s+\((\w+::)*\*\w+\)\(', fncall) and -- not Search(r'\bcase\s+\(', fncall)): -+ if (re.search(r'\w\s+\(', fncall) and -+ not re.search(r'_{0,2}asm_{0,2}\s+_{0,2}volatile_{0,2}\s+\(', fncall) and -+ not re.search(r'#\s*define|typedef|using\s+\w+\s*=', fncall) and -+ not re.search(r'\w\s+\((\w+::)*\*\w+\)\(', fncall) and -+ not re.search(r'\bcase\s+\(', fncall)): - # TODO(unknown): Space after an operator function seem to be a common - # error, silence those for now by restricting them to highest verbosity. -- if Search(r'\boperator_*\b', line): -+ if re.search(r'\boperator_*\b', line): - error(filename, linenum, 'whitespace/parens', 0, - 'Extra space before ( in function call') - else: -@@ -3516,10 +3478,10 @@ def CheckSpacingForFunctionCall(filename - 'Extra space before ( in function call') - # If the ) is followed only by a newline or a { + newline, assume it's - # part of a control statement (if/while/etc), and don't complain -- if Search(r'[^)]\s+\)\s*[^{\s]', fncall): -+ if re.search(r'[^)]\s+\)\s*[^{\s]', fncall): - # If the closing parenthesis is preceded by only whitespaces, - # try to give a more descriptive error message. -- if Search(r'^\s+\)', fncall): -+ if re.search(r'^\s+\)', fncall): - error(filename, linenum, 'whitespace/parens', 2, - 'Closing ) should be moved to the previous line') - else: -@@ -3585,13 +3547,13 @@ def CheckForFunctionLengths(filename, cl - - starting_func = False - regexp = r'(\w(\w|::|\*|\&|\s)*)\(' # decls * & space::name( ... -- match_result = Match(regexp, line) -+ match_result = re.match(regexp, line) - if match_result: - # If the name is all caps and underscores, figure it's a macro and - # ignore it, unless it's TEST or TEST_F. - function_name = match_result.group(1).split()[-1] - if function_name == 'TEST' or function_name == 'TEST_F' or ( -- not Match(r'[A-Z_]+$', function_name)): -+ not re.match(r'[A-Z_]+$', function_name)): - starting_func = True - - if starting_func: -@@ -3599,14 +3561,14 @@ def CheckForFunctionLengths(filename, cl - for start_linenum in xrange(linenum, clean_lines.NumLines()): - start_line = lines[start_linenum] - joined_line += ' ' + start_line.lstrip() -- if Search(r'(;|})', start_line): # Declarations and trivial functions -+ if re.search(r'(;|})', start_line): # Declarations and trivial functions - body_found = True - break # ... ignore -- if Search(r'{', start_line): -+ if re.search(r'{', start_line): - body_found = True -- function = Search(r'((\w|:)*)\(', line).group(1) -- if Match(r'TEST', function): # Handle TEST... macros -- parameter_regexp = Search(r'(\(.*\))', joined_line) -+ function = re.search(r'((\w|:)*)\(', line).group(1) -+ if re.match(r'TEST', function): # Handle TEST... macros -+ parameter_regexp = re.search(r'(\(.*\))', joined_line) - if parameter_regexp: # Ignore bad syntax - function += parameter_regexp.group(1) - else: -@@ -3617,10 +3579,10 @@ def CheckForFunctionLengths(filename, cl - # No body for the function (or evidence of a non-function) was found. - error(filename, linenum, 'readability/fn_size', 5, - 'Lint failed to find start of function body.') -- elif Match(r'^\}\s*$', line): # function end -+ elif re.match(r'^\}\s*$', line): # function end - function_state.Check(error, filename, linenum) - function_state.End() -- elif not Match(r'^\s*$', line): -+ elif not re.match(r'^\s*$', line): - function_state.Count() # Count non-blank/non-comment lines. - - -@@ -3642,7 +3604,7 @@ def CheckComment(line, filename, linenum - # Check if the // may be in quotes. If so, ignore it - if re.sub(r'\\.', '', line[0:commentpos]).count('"') % 2 == 0: - # Allow one space for new scopes, two spaces otherwise: -- if (not (Match(r'^.*{ *//', line) and next_line_start == commentpos) and -+ if (not (re.match(r'^.*{ *//', line) and next_line_start == commentpos) and - ((commentpos >= 1 and - line[commentpos-1] not in string.whitespace) or - (commentpos >= 2 and -@@ -3675,8 +3637,8 @@ def CheckComment(line, filename, linenum - # If the comment contains an alphanumeric character, there - # should be a space somewhere between it and the // unless - # it's a /// or //! Doxygen comment. -- if (Match(r'//[^ ]*\w', comment) and -- not Match(r'(///|//\!)(\s+|$)', comment)): -+ if (re.match(r'//[^ ]*\w', comment) and -+ not re.match(r'(///|//\!)(\s+|$)', comment)): - error(filename, linenum, 'whitespace/comments', 4, - 'Should have a space between // and comment') - -@@ -3739,12 +3701,12 @@ def CheckSpacing(filename, clean_lines, - # the previous line is indented 6 spaces, which may happen when the - # initializers of a constructor do not fit into a 80 column line. - exception = False -- if Match(r' {6}\w', prev_line): # Initializer list? -+ if re.match(r' {6}\w', prev_line): # Initializer list? - # We are looking for the opening column of initializer list, which - # should be indented 4 spaces to cause 6 space indentation afterwards. - search_position = linenum-2 - while (search_position >= 0 -- and Match(r' {6}\w', elided[search_position])): -+ and re.match(r' {6}\w', elided[search_position])): - search_position -= 1 - exception = (search_position >= 0 - and elided[search_position][:5] == ' :') -@@ -3755,9 +3717,9 @@ def CheckSpacing(filename, clean_lines, - # or colon (for initializer lists) we assume that it is the last line of - # a function header. If we have a colon indented 4 spaces, it is an - # initializer list. -- exception = (Match(r' {4}\w[^\(]*\)\s*(const\s*)?(\{\s*$|:)', -+ exception = (re.match(r' {4}\w[^\(]*\)\s*(const\s*)?(\{\s*$|:)', - prev_line) -- or Match(r' {4}:', prev_line)) -+ or re.match(r' {4}:', prev_line)) - - if not exception: - error(filename, linenum, 'whitespace/blank_line', 2, -@@ -3774,13 +3736,13 @@ def CheckSpacing(filename, clean_lines, - if linenum + 1 < clean_lines.NumLines(): - next_line = raw[linenum + 1] - if (next_line -- and Match(r'\s*}', next_line) -+ and re.match(r'\s*}', next_line) - and next_line.find('} else ') == -1): - error(filename, linenum, 'whitespace/blank_line', 3, - 'Redundant blank line at the end of a code block ' - 'should be deleted.') - -- matched = Match(r'\s*(public|protected|private):', prev_line) -+ matched = re.match(r'\s*(public|protected|private):', prev_line) - if matched: - error(filename, linenum, 'whitespace/blank_line', 3, - 'Do not leave a blank line after "%s:"' % matched.group(1)) -@@ -3797,15 +3759,15 @@ def CheckSpacing(filename, clean_lines, - - # You shouldn't have spaces before your brackets, except for C++11 attributes - # or maybe after 'delete []', 'return []() {};', or 'auto [abc, ...] = ...;'. -- if (Search(r'\w\s+\[(?!\[)', line) and -- not Search(r'(?:auto&?|delete|return)\s+\[', line)): -+ if (re.search(r'\w\s+\[(?!\[)', line) and -+ not re.search(r'(?:auto&?|delete|return)\s+\[', line)): - error(filename, linenum, 'whitespace/braces', 5, - 'Extra space before [') - - # In range-based for, we wanted spaces before and after the colon, but - # not around "::" tokens that might appear. -- if (Search(r'for *\(.*[^:]:[^: ]', line) or -- Search(r'for *\(.*[^: ]:[^:]', line)): -+ if (re.search(r'for *\(.*[^:]:[^: ]', line) or -+ re.search(r'for *\(.*[^: ]:[^:]', line)): - error(filename, linenum, 'whitespace/forcolon', 2, - 'Missing space around colon in range-based for loop') - -@@ -3828,7 +3790,7 @@ def CheckOperatorSpacing(filename, clean - # The replacement is done repeatedly to avoid false positives from - # operators that call operators. - while True: -- match = Match(r'^(.*\boperator\b)(\S+)(\s*\(.*)$', line) -+ match = re.match(r'^(.*\boperator\b)(\S+)(\s*\(.*)$', line) - if match: - line = match.group(1) + ('_' * len(match.group(2))) + match.group(3) - else: -@@ -3838,12 +3800,12 @@ def CheckOperatorSpacing(filename, clean - # Otherwise not. Note we only check for non-spaces on *both* sides; - # sometimes people put non-spaces on one side when aligning ='s among - # many lines (not that this is behavior that I approve of...) -- if ((Search(r'[\w.]=', line) or -- Search(r'=[\w.]', line)) -- and not Search(r'\b(if|while|for) ', line) -+ if ((re.search(r'[\w.]=', line) or -+ re.search(r'=[\w.]', line)) -+ and not re.search(r'\b(if|while|for) ', line) - # Operators taken from [lex.operators] in C++11 standard. -- and not Search(r'(>=|<=|==|!=|&=|\^=|\|=|\+=|\*=|\/=|\%=)', line) -- and not Search(r'operator=', line)): -+ and not re.search(r'(>=|<=|==|!=|&=|\^=|\|=|\+=|\*=|\/=|\%=)', line) -+ and not re.search(r'operator=', line)): - error(filename, linenum, 'whitespace/operators', 4, - 'Missing spaces around =') - -@@ -3862,16 +3824,16 @@ def CheckOperatorSpacing(filename, clean - # - # Note that && is not included here. This is because there are too - # many false positives due to RValue references. -- match = Search(r'[^<>=!\s](==|!=|<=|>=|\|\|)[^<>=!\s,;\)]', line) -+ match = re.search(r'[^<>=!\s](==|!=|<=|>=|\|\|)[^<>=!\s,;\)]', line) - if match: - error(filename, linenum, 'whitespace/operators', 3, - 'Missing spaces around %s' % match.group(1)) -- elif not Match(r'#.*include', line): -+ elif not re.match(r'#.*include', line): - # Look for < that is not surrounded by spaces. This is only - # triggered if both sides are missing spaces, even though - # technically should should flag if at least one side is missing a - # space. This is done to avoid some false positives with shifts. -- match = Match(r'^(.*[^\s<])<[^\s=<,]', line) -+ match = re.match(r'^(.*[^\s<])<[^\s=<,]', line) - if match: - (_, _, end_pos) = CloseExpression( - clean_lines, linenum, len(match.group(1))) -@@ -3882,7 +3844,7 @@ def CheckOperatorSpacing(filename, clean - # Look for > that is not surrounded by spaces. Similar to the - # above, we only trigger if both sides are missing spaces to avoid - # false positives with shifts. -- match = Match(r'^(.*[^-\s>])>[^\s=>,]', line) -+ match = re.match(r'^(.*[^-\s>])>[^\s=>,]', line) - if match: - (_, _, start_pos) = ReverseCloseExpression( - clean_lines, linenum, len(match.group(1))) -@@ -3895,7 +3857,7 @@ def CheckOperatorSpacing(filename, clean - # - # We also allow operators following an opening parenthesis, since - # those tend to be macros that deal with operators. -- match = Search(r'(operator|[^\s(<])(?:L|UL|LL|ULL|l|ul|ll|ull)?<<([^\s,=<])', line) -+ match = re.search(r'(operator|[^\s(<])(?:L|UL|LL|ULL|l|ul|ll|ull)?<<([^\s,=<])', line) - if (match and not (match.group(1).isdigit() and match.group(2).isdigit()) and - not (match.group(1) == 'operator' and match.group(2) == ';')): - error(filename, linenum, 'whitespace/operators', 3, -@@ -3913,13 +3875,13 @@ def CheckOperatorSpacing(filename, clean - # follows would be part of an identifier, and there should still be - # a space separating the template type and the identifier. - # type> alpha -- match = Search(r'>>[a-zA-Z_]', line) -+ match = re.search(r'>>[a-zA-Z_]', line) - if match: - error(filename, linenum, 'whitespace/operators', 3, - 'Missing spaces around >>') - - # There shouldn't be space around unary operators -- match = Search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line) -+ match = re.search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line) - if match: - error(filename, linenum, 'whitespace/operators', 4, - 'Extra space for operator %s' % match.group(1)) -@@ -3937,7 +3899,7 @@ def CheckParenthesisSpacing(filename, cl - line = clean_lines.elided[linenum] - - # No spaces after an if, while, switch, or for -- match = Search(r' (if\(|for\(|while\(|switch\()', line) -+ match = re.search(r' (if\(|for\(|while\(|switch\()', line) - if match: - error(filename, linenum, 'whitespace/parens', 5, - 'Missing space before ( in %s' % match.group(1)) -@@ -3947,14 +3909,14 @@ def CheckParenthesisSpacing(filename, cl - # there should either be zero or one spaces inside the parens. - # We don't want: "if ( foo)" or "if ( foo )". - # Exception: "for ( ; foo; bar)" and "for (foo; bar; )" are allowed. -- match = Search(r'\b(if|for|while|switch)\s*' -+ match = re.search(r'\b(if|for|while|switch)\s*' - r'\(([ ]*)(.).*[^ ]+([ ]*)\)\s*{\s*$', - line) - if match: - if len(match.group(2)) != len(match.group(4)): - if not (match.group(3) == ';' and - len(match.group(2)) == 1 + len(match.group(4)) or -- not match.group(2) and Search(r'\bfor\s*\(.*; \)', line)): -+ not match.group(2) and re.search(r'\bfor\s*\(.*; \)', line)): - error(filename, linenum, 'whitespace/parens', 5, - 'Mismatching spaces inside () in %s' % match.group(1)) - if len(match.group(2)) not in [0, 1]: -@@ -3985,8 +3947,8 @@ def CheckCommaSpacing(filename, clean_li - # verify that lines contain missing whitespaces, second pass on raw - # lines to confirm that those missing whitespaces are not due to - # elided comments. -- if (Search(r',[^,\s]', ReplaceAll(r'\boperator\s*,\s*\(', 'F(', line)) and -- Search(r',[^,\s]', raw[linenum])): -+ if (re.search(r',[^,\s]', re.sub(r'\boperator\s*,\s*\(', 'F(', line)) and -+ re.search(r',[^,\s]', raw[linenum])): - error(filename, linenum, 'whitespace/comma', 3, - 'Missing space after ,') - -@@ -3994,7 +3956,7 @@ def CheckCommaSpacing(filename, clean_li - # except for few corner cases - # TODO(unknown): clarify if 'if (1) { return 1;}' is requires one more - # space after ; -- if Search(r';[^\s};\\)/]', line): -+ if re.search(r';[^\s};\\)/]', line): - error(filename, linenum, 'whitespace/semicolon', 3, - 'Missing space after ;') - -@@ -4011,7 +3973,7 @@ def _IsType(clean_lines, nesting_state, - True, if token looks like a type. - """ - # Keep only the last token in the expression -- last_word = Match(r'^.*(\b\S+)$', expr) -+ last_word = re.match(r'^.*(\b\S+)$', expr) - if last_word: - token = last_word.group(1) - else: -@@ -4055,7 +4017,7 @@ def _IsType(clean_lines, nesting_state, - - # Look for typename in the specified range - for i in xrange(first_line, last_line + 1, 1): -- if Search(typename_pattern, clean_lines.elided[i]): -+ if re.search(typename_pattern, clean_lines.elided[i]): - return True - block_index -= 1 - -@@ -4081,7 +4043,7 @@ def CheckBracesSpacing(filename, clean_l - # And since you should never have braces at the beginning of a line, - # this is an easy test. Except that braces used for initialization don't - # follow the same rule; we often don't want spaces before those. -- match = Match(r'^(.*[^ ({>]){', line) -+ match = re.match(r'^(.*[^ ({>]){', line) - - if match: - # Try a bit harder to check for brace initialization. This -@@ -4124,28 +4086,28 @@ def CheckBracesSpacing(filename, clean_l - # We also suppress warnings for `uint64_t{expression}` etc., as the style - # guide recommends brace initialization for integral types to avoid - # overflow/truncation. -- if (not Match(r'^[\s}]*[{.;,)<>\]:]', trailing_text) -+ if (not re.match(r'^[\s}]*[{.;,)<>\]:]', trailing_text) - and not _IsType(clean_lines, nesting_state, leading_text)): - error(filename, linenum, 'whitespace/braces', 5, - 'Missing space before {') - - # Make sure '} else {' has spaces. -- if Search(r'}else', line): -+ if re.search(r'}else', line): - error(filename, linenum, 'whitespace/braces', 5, - 'Missing space before else') - - # You shouldn't have a space before a semicolon at the end of the line. - # There's a special case for "for" since the style guide allows space before - # the semicolon there. -- if Search(r':\s*;\s*$', line): -+ if re.search(r':\s*;\s*$', line): - error(filename, linenum, 'whitespace/semicolon', 5, - 'Semicolon defining empty statement. Use {} instead.') -- elif Search(r'^\s*;\s*$', line): -+ elif re.search(r'^\s*;\s*$', line): - error(filename, linenum, 'whitespace/semicolon', 5, - 'Line contains only semicolon. If this should be an empty statement, ' - 'use {} instead.') -- elif (Search(r'\s+;\s*$', line) and -- not Search(r'\bfor\b', line)): -+ elif (re.search(r'\s+;\s*$', line) and -+ not re.search(r'\bfor\b', line)): - error(filename, linenum, 'whitespace/semicolon', 5, - 'Extra space before last semicolon. If this should be an empty ' - 'statement, use {} instead.') -@@ -4164,7 +4126,7 @@ def IsDecltype(clean_lines, linenum, col - (text, _, start_col) = ReverseCloseExpression(clean_lines, linenum, column) - if start_col < 0: - return False -- if Search(r'\bdecltype\s*$', text[0:start_col]): -+ if re.search(r'\bdecltype\s*$', text[0:start_col]): - return True - return False - -@@ -4195,7 +4157,7 @@ def CheckSectionSpacing(filename, clean_ - linenum <= class_info.starting_linenum): - return - -- matched = Match(r'\s*(public|protected|private):', clean_lines.lines[linenum]) -+ matched = re.match(r'\s*(public|protected|private):', clean_lines.lines[linenum]) - if matched: - # Issue warning if the line before public/protected/private was - # not a blank line, but don't do this if the previous line contains -@@ -4207,15 +4169,15 @@ def CheckSectionSpacing(filename, clean_ - # common when defining classes in C macros. - prev_line = clean_lines.lines[linenum - 1] - if (not IsBlankLine(prev_line) and -- not Search(r'\b(class|struct)\b', prev_line) and -- not Search(r'\\$', prev_line)): -+ not re.search(r'\b(class|struct)\b', prev_line) and -+ not re.search(r'\\$', prev_line)): - # Try a bit harder to find the beginning of the class. This is to - # account for multi-line base-specifier lists, e.g.: - # class Derived - # : public Base { - end_class_head = class_info.starting_linenum - for i in range(class_info.starting_linenum, linenum): -- if Search(r'\{\s*$', clean_lines.lines[i]): -+ if re.search(r'\{\s*$', clean_lines.lines[i]): - end_class_head = i - break - if end_class_head < linenum - 1: -@@ -4258,7 +4220,7 @@ def CheckBraces(filename, clean_lines, l - - line = clean_lines.elided[linenum] # get rid of comments and strings - -- if Match(r'\s*{\s*$', line): -+ if re.match(r'\s*{\s*$', line): - # We allow an open brace to start a line in the case where someone is using - # braces in a block to explicitly create a new scope, which is commonly used - # to control the lifetime of stack-allocated variables. Braces are also -@@ -4269,23 +4231,23 @@ def CheckBraces(filename, clean_lines, l - # following line if it is part of an array initialization and would not fit - # within the 80 character limit of the preceding line. - prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0] -- if (not Search(r'[,;:}{(]\s*$', prevline) and -- not Match(r'\s*#', prevline) and -+ if (not re.search(r'[,;:}{(]\s*$', prevline) and -+ not re.match(r'\s*#', prevline) and - not (GetLineWidth(prevline) > _line_length - 2 and '[]' in prevline)): - error(filename, linenum, 'whitespace/braces', 4, - '{ should almost always be at the end of the previous line') - - # An else clause should be on the same line as the preceding closing brace. -- if Match(r'\s*else\b\s*(?:if\b|\{|$)', line): -+ if re.match(r'\s*else\b\s*(?:if\b|\{|$)', line): - prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0] -- if Match(r'\s*}\s*$', prevline): -+ if re.match(r'\s*}\s*$', prevline): - error(filename, linenum, 'whitespace/newline', 4, - 'An else should appear on the same line as the preceding }') - - # If braces come on one side of an else, they should be on both. - # However, we have to worry about "else if" that spans multiple lines! -- if Search(r'else if\s*\(', line): # could be multi-line if -- brace_on_left = bool(Search(r'}\s*else if\s*\(', line)) -+ if re.search(r'else if\s*\(', line): # could be multi-line if -+ brace_on_left = bool(re.search(r'}\s*else if\s*\(', line)) - # find the ( after the if - pos = line.find('else if') - pos = line.find('(', pos) -@@ -4295,17 +4257,17 @@ def CheckBraces(filename, clean_lines, l - if brace_on_left != brace_on_right: # must be brace after if - error(filename, linenum, 'readability/braces', 5, - 'If an else has a brace on one side, it should have it on both') -- elif Search(r'}\s*else[^{]*$', line) or Match(r'[^}]*else\s*{', line): -+ elif re.search(r'}\s*else[^{]*$', line) or re.match(r'[^}]*else\s*{', line): - error(filename, linenum, 'readability/braces', 5, - 'If an else has a brace on one side, it should have it on both') - - # Likewise, an else should never have the else clause on the same line -- if Search(r'\belse [^\s{]', line) and not Search(r'\belse if\b', line): -+ if re.search(r'\belse [^\s{]', line) and not re.search(r'\belse if\b', line): - error(filename, linenum, 'whitespace/newline', 4, - 'Else clause should never be on same line as else (use 2 lines)') - - # In the same way, a do/while should never be on one line -- if Match(r'\s*do [^\s{]', line): -+ if re.match(r'\s*do [^\s{]', line): - error(filename, linenum, 'whitespace/newline', 4, - 'do/while clauses should not be on a single line') - -@@ -4316,21 +4278,21 @@ def CheckBraces(filename, clean_lines, l - # its line, and the line after that should have an indent level equal to or - # lower than the if. We also check for ambiguous if/else nesting without - # braces. -- if_else_match = Search(r'\b(if\s*(|constexpr)\s*\(|else\b)', line) -- if if_else_match and not Match(r'\s*#', line): -+ if_else_match = re.search(r'\b(if\s*(|constexpr)\s*\(|else\b)', line) -+ if if_else_match and not re.match(r'\s*#', line): - if_indent = GetIndentLevel(line) - endline, endlinenum, endpos = line, linenum, if_else_match.end() -- if_match = Search(r'\bif\s*(|constexpr)\s*\(', line) -+ if_match = re.search(r'\bif\s*(|constexpr)\s*\(', line) - if if_match: - # This could be a multiline if condition, so find the end first. - pos = if_match.end() - 1 - (endline, endlinenum, endpos) = CloseExpression(clean_lines, linenum, pos) - # Check for an opening brace, either directly after the if or on the next - # line. If found, this isn't a single-statement conditional. -- if (not Match(r'\s*{', endline[endpos:]) -- and not (Match(r'\s*$', endline[endpos:]) -+ if (not re.match(r'\s*{', endline[endpos:]) -+ and not (re.match(r'\s*$', endline[endpos:]) - and endlinenum < (len(clean_lines.elided) - 1) -- and Match(r'\s*{', clean_lines.elided[endlinenum + 1]))): -+ and re.match(r'\s*{', clean_lines.elided[endlinenum + 1]))): - while (endlinenum < len(clean_lines.elided) - and ';' not in clean_lines.elided[endlinenum][endpos:]): - endlinenum += 1 -@@ -4340,11 +4302,11 @@ def CheckBraces(filename, clean_lines, l - # We allow a mix of whitespace and closing braces (e.g. for one-liner - # methods) and a single \ after the semicolon (for macros) - endpos = endline.find(';') -- if not Match(r';[\s}]*(\\?)$', endline[endpos:]): -+ if not re.match(r';[\s}]*(\\?)$', endline[endpos:]): - # Semicolon isn't the last character, there's something trailing. - # Output a warning if the semicolon is not contained inside - # a lambda expression. -- if not Match(r'^[^{};]*\[[^\[\]]*\][^{}]*\{[^{}]*\}\s*\)*[;,]\s*$', -+ if not re.match(r'^[^{};]*\[[^\[\]]*\][^{}]*\{[^{}]*\}\s*\)*[;,]\s*$', - endline): - error(filename, linenum, 'readability/braces', 4, - 'If/else bodies with multiple statements require braces') -@@ -4355,7 +4317,7 @@ def CheckBraces(filename, clean_lines, l - # With ambiguous nested if statements, this will error out on the - # if that *doesn't* match the else, regardless of whether it's the - # inner one or outer one. -- if (if_match and Match(r'\s*else\b', next_line) -+ if (if_match and re.match(r'\s*else\b', next_line) - and next_indent != if_indent): - error(filename, linenum, 'readability/braces', 4, - 'Else clause should be indented at the same level as if. ' -@@ -4421,7 +4383,7 @@ def CheckTrailingSemicolon(filename, cle - # to namespaces. For now we do not warn for this case. - # - # Try matching case 1 first. -- match = Match(r'^(.*\)\s*)\{', line) -+ match = re.match(r'^(.*\)\s*)\{', line) - if match: - # Matched closing parenthesis (case 1). Check the token before the - # matching opening parenthesis, and don't warn if it looks like a -@@ -4454,27 +4416,27 @@ def CheckTrailingSemicolon(filename, cle - clean_lines, linenum, closing_brace_pos) - if opening_parenthesis[2] > -1: - line_prefix = opening_parenthesis[0][0:opening_parenthesis[2]] -- macro = Search(r'\b([A-Z_][A-Z0-9_]*)\s*$', line_prefix) -- func = Match(r'^(.*\])\s*$', line_prefix) -+ macro = re.search(r'\b([A-Z_][A-Z0-9_]*)\s*$', line_prefix) -+ func = re.match(r'^(.*\])\s*$', line_prefix) - if ((macro and - macro.group(1) not in ( - 'TEST', 'TEST_F', 'MATCHER', 'MATCHER_P', 'TYPED_TEST', - 'EXCLUSIVE_LOCKS_REQUIRED', 'SHARED_LOCKS_REQUIRED', - 'LOCKS_EXCLUDED', 'INTERFACE_DEF')) or -- (func and not Search(r'\boperator\s*\[\s*\]', func.group(1))) or -- Search(r'\b(?:struct|union)\s+alignas\s*$', line_prefix) or -- Search(r'\bdecltype$', line_prefix) or -- Search(r'\s+=\s*$', line_prefix)): -+ (func and not re.search(r'\boperator\s*\[\s*\]', func.group(1))) or -+ re.search(r'\b(?:struct|union)\s+alignas\s*$', line_prefix) or -+ re.search(r'\bdecltype$', line_prefix) or -+ re.search(r'\s+=\s*$', line_prefix)): - match = None - if (match and - opening_parenthesis[1] > 1 and -- Search(r'\]\s*$', clean_lines.elided[opening_parenthesis[1] - 1])): -+ re.search(r'\]\s*$', clean_lines.elided[opening_parenthesis[1] - 1])): - # Multi-line lambda-expression - match = None - - else: - # Try matching cases 2-3. -- match = Match(r'^(.*(?:else|\)\s*const)\s*)\{', line) -+ match = re.match(r'^(.*(?:else|\)\s*const)\s*)\{', line) - if not match: - # Try matching cases 4-6. These are always matched on separate lines. - # -@@ -4485,14 +4447,14 @@ def CheckTrailingSemicolon(filename, cle - # // blank line - # } - prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0] -- if prevline and Search(r'[;{}]\s*$', prevline): -- match = Match(r'^(\s*)\{', line) -+ if prevline and re.search(r'[;{}]\s*$', prevline): -+ match = re.match(r'^(\s*)\{', line) - - # Check matching closing brace - if match: - (endline, endlinenum, endpos) = CloseExpression( - clean_lines, linenum, len(match.group(1))) -- if endpos > -1 and Match(r'^\s*;', endline[endpos:]): -+ if endpos > -1 and re.match(r'^\s*;', endline[endpos:]): - # Current {} pair is eligible for semicolon check, and we have found - # the redundant semicolon, output warning here. - # -@@ -4529,7 +4491,7 @@ def CheckEmptyBlockBody(filename, clean_ - # We also check "if" blocks here, since an empty conditional block - # is likely an error. - line = clean_lines.elided[linenum] -- matched = Match(r'\s*(for|while|if)\s*\(', line) -+ matched = re.match(r'\s*(for|while|if)\s*\(', line) - if matched: - # Find the end of the conditional expression. - (end_line, end_linenum, end_pos) = CloseExpression( -@@ -4538,7 +4500,7 @@ def CheckEmptyBlockBody(filename, clean_ - # Output warning if what follows the condition expression is a semicolon. - # No warning for all other cases, including whitespace or newline, since we - # have a separate check for semicolons preceded by whitespace. -- if end_pos >= 0 and Match(r';', end_line[end_pos:]): -+ if end_pos >= 0 and re.match(r';', end_line[end_pos:]): - if matched.group(1) == 'if': - error(filename, end_linenum, 'whitespace/empty_conditional_body', 5, - 'Empty conditional bodies should use {}') -@@ -4554,8 +4516,8 @@ def CheckEmptyBlockBody(filename, clean_ - opening_linenum = end_linenum - opening_line_fragment = end_line[end_pos:] - # Loop until EOF or find anything that's not whitespace or opening {. -- while not Search(r'^\s*\{', opening_line_fragment): -- if Search(r'^(?!\s*$)', opening_line_fragment): -+ while not re.search(r'^\s*\{', opening_line_fragment): -+ if re.search(r'^(?!\s*$)', opening_line_fragment): - # Conditional has no brackets. - return - opening_linenum += 1 -@@ -4602,8 +4564,8 @@ def CheckEmptyBlockBody(filename, clean_ - current_linenum = closing_linenum - current_line_fragment = closing_line[closing_pos:] - # Loop until EOF or find anything that's not whitespace or else clause. -- while Search(r'^\s*$|^(?=\s*else)', current_line_fragment): -- if Search(r'^(?=\s*else)', current_line_fragment): -+ while re.search(r'^\s*$|^(?=\s*else)', current_line_fragment): -+ if re.search(r'^(?=\s*else)', current_line_fragment): - # Found an else clause, so don't log an error. - return - current_linenum += 1 -@@ -4632,7 +4594,7 @@ def FindCheckMacro(line): - # to make sure that we are matching the expected CHECK macro, as - # opposed to some other macro that happens to contain the CHECK - # substring. -- matched = Match(r'^(.*\b' + macro + r'\s*)\(', line) -+ matched = re.match(r'^(.*\b' + macro + r'\s*)\(', line) - if not matched: - continue - return (macro, len(matched.group(1))) -@@ -4664,7 +4626,7 @@ def CheckCheck(filename, clean_lines, li - # If the check macro is followed by something other than a - # semicolon, assume users will log their own custom error messages - # and don't suggest any replacements. -- if not Match(r'\s*;', last_line[end_pos:]): -+ if not re.match(r'\s*;', last_line[end_pos:]): - return - - if linenum == end_line: -@@ -4682,7 +4644,7 @@ def CheckCheck(filename, clean_lines, li - rhs = '' - operator = None - while expression: -- matched = Match(r'^\s*(<<|<<=|>>|>>=|->\*|->|&&|\|\||' -+ matched = re.match(r'^\s*(<<|<<=|>>|>>=|->\*|->|&&|\|\||' - r'==|!=|>=|>|<=|<|\()(.*)$', expression) - if matched: - token = matched.group(1) -@@ -4716,9 +4678,9 @@ def CheckCheck(filename, clean_lines, li - # characters at once if possible. Trivial benchmark shows that this - # is more efficient when the operands are longer than a single - # character, which is generally the case. -- matched = Match(r'^([^-=!<>()&|]+)(.*)$', expression) -+ matched = re.match(r'^([^-=!<>()&|]+)(.*)$', expression) - if not matched: -- matched = Match(r'^(\s*\S)(.*)$', expression) -+ matched = re.match(r'^(\s*\S)(.*)$', expression) - if not matched: - break - lhs += matched.group(1) -@@ -4742,7 +4704,7 @@ def CheckCheck(filename, clean_lines, li - lhs = lhs.strip() - rhs = rhs.strip() - match_constant = r'^([-+]?(\d+|0[xX][0-9a-fA-F]+)[lLuU]{0,3}|".*"|\'.*\')$' -- if Match(match_constant, lhs) or Match(match_constant, rhs): -+ if re.match(match_constant, lhs) or re.match(match_constant, rhs): - # Note: since we know both lhs and rhs, we can provide a more - # descriptive error message like: - # Consider using CHECK_EQ(x, 42) instead of CHECK(x == 42) -@@ -4769,7 +4731,7 @@ def CheckAltTokens(filename, clean_lines - line = clean_lines.elided[linenum] - - # Avoid preprocessor lines -- if Match(r'^\s*#', line): -+ if re.match(r'^\s*#', line): - return - - # Last ditch effort to avoid multi-line comments. This will not help -@@ -4873,11 +4835,11 @@ def CheckStyle(filename, clean_lines, li - # We also don't check for lines that look like continuation lines - # (of lines ending in double quotes, commas, equals, or angle brackets) - # because the rules for how to indent those are non-trivial. -- if (not Search(r'[",=><] *$', prev) and -+ if (not re.search(r'[",=><] *$', prev) and - (initial_spaces == 1 or initial_spaces == 3) and -- not Match(scope_or_label_pattern, cleansed_line) and -+ not re.match(scope_or_label_pattern, cleansed_line) and - not (clean_lines.raw_lines[linenum] != line and -- Match(r'^\s*""', line))): -+ re.match(r'^\s*""', line))): - error(filename, linenum, 'whitespace/indent', 3, - 'Weird number of spaces at line-start. ' - 'Are you using a 2-space indent?') -@@ -4906,10 +4868,10 @@ def CheckStyle(filename, clean_lines, li - # Doxygen documentation copying can get pretty long when using an overloaded - # function declaration - if (not line.startswith('#include') and not is_header_guard and -- not Match(r'^\s*//.*http(s?)://\S*$', line) and -- not Match(r'^\s*//\s*[^\s]*$', line) and -- not Match(r'^// \$Id:.*#[0-9]+ \$$', line) and -- not Match(r'^\s*/// [@\\](copydoc|copydetails|copybrief) .*$', line)): -+ not re.match(r'^\s*//.*http(s?)://\S*$', line) and -+ not re.match(r'^\s*//\s*[^\s]*$', line) and -+ not re.match(r'^// \$Id:.*#[0-9]+ \$$', line) and -+ not re.match(r'^\s*/// [@\\](copydoc|copydetails|copybrief) .*$', line)): - line_width = GetLineWidth(line) - if line_width > _line_length: - error(filename, linenum, 'whitespace/line_length', 2, -@@ -4917,7 +4879,7 @@ def CheckStyle(filename, clean_lines, li - - if (cleansed_line.count(';') > 1 and - # allow simple single line lambdas -- not Match(r'^[^{};]*\[[^\[\]]*\][^{}]*\{[^{}\n\r]*\}', -+ not re.match(r'^[^{};]*\[[^\[\]]*\][^{}]*\{[^{}\n\r]*\}', - line) and - # for loops are allowed two ;'s (and may run over two lines). - cleansed_line.find('for') == -1 and -@@ -5020,7 +4982,7 @@ def _ClassifyInclude(fileinfo, include, - # Mark include as C header if in list or in a known folder for standard-ish C headers. - is_std_c_header = (include_order == "default") or (include in _C_HEADERS - # additional linux glibc header folders -- or Search(r'(?:%s)\/.*\.h' % "|".join(C_STANDARD_HEADER_FOLDERS), include)) -+ or re.search(r'(?:%s)\/.*\.h' % "|".join(C_STANDARD_HEADER_FOLDERS), include)) - - # Headers with C++ extensions shouldn't be considered C system headers - include_ext = os.path.splitext(include)[1] -@@ -5086,7 +5048,7 @@ def CheckIncludeLine(filename, clean_lin - # - # We also make an exception for Lua headers, which follow google - # naming convention but not the include convention. -- match = Match(r'#include\s*"([^/]+\.(.*))"', line) -+ match = re.match(r'#include\s*"([^/]+\.(.*))"', line) - if match: - if (IsHeaderExtension(match.group(2)) and - not _THIRD_PARTY_HEADERS_PATTERN.match(match.group(1))): -@@ -5270,7 +5232,7 @@ def CheckLanguage(filename, clean_lines, - - # Reset include state across preprocessor directives. This is meant - # to silence warnings for conditional includes. -- match = Match(r'^\s*#\s*(if|ifdef|ifndef|elif|else|endif)\b', line) -+ match = re.match(r'^\s*#\s*(if|ifdef|ifndef|elif|else|endif)\b', line) - if match: - include_state.ResetSection(match.group(1)) - -@@ -5290,12 +5252,12 @@ def CheckLanguage(filename, clean_lines, - - # Check if people are using the verboten C basic types. The only exception - # we regularly allow is "unsigned short port" for port. -- if Search(r'\bshort port\b', line): -- if not Search(r'\bunsigned short port\b', line): -+ if re.search(r'\bshort port\b', line): -+ if not re.search(r'\bunsigned short port\b', line): - error(filename, linenum, 'runtime/int', 4, - 'Use "unsigned short" for ports, not "short"') - else: -- match = Search(r'\b(short|long(?! +double)|long long)\b', line) -+ match = re.search(r'\b(short|long(?! +double)|long long)\b', line) - if match: - error(filename, linenum, 'runtime/int', 4, - 'Use int16/int64/etc, rather than the C type %s' % match.group(1)) -@@ -5306,13 +5268,13 @@ def CheckLanguage(filename, clean_lines, - # int operator&(const X& x) { return 42; } // unary operator& - # The trick is it's hard to tell apart from binary operator&: - # class Y { int operator&(const Y& x) { return 23; } }; // binary operator& -- if Search(r'\boperator\s*&\s*\(\s*\)', line): -+ if re.search(r'\boperator\s*&\s*\(\s*\)', line): - error(filename, linenum, 'runtime/operator', 4, - 'Unary operator& is dangerous. Do not use it.') - - # Check for suspicious usage of "if" like - # } if (a == b) { -- if Search(r'\}\s*if\s*\(', line): -+ if re.search(r'\}\s*if\s*\(', line): - error(filename, linenum, 'readability/braces', 4, - 'Did you mean "else if"? If not, start a new line for "if".') - -@@ -5325,7 +5287,7 @@ def CheckLanguage(filename, clean_lines, - # boy_this_is_a_really_long_variable_that_cannot_fit_on_the_prev_line); - printf_args = _GetTextInside(line, r'(?i)\b(string)?printf\s*\(') - if printf_args: -- match = Match(r'([\w.\->()]+)$', printf_args) -+ match = re.match(r'([\w.\->()]+)$', printf_args) - if match and match.group(1) != '__VA_ARGS__': - function_name = re.search(r'\b((?:string)?printf)\s*\(', - line, re.I).group(1) -@@ -5334,14 +5296,14 @@ def CheckLanguage(filename, clean_lines, - % (function_name, match.group(1))) - - # Check for potential memset bugs like memset(buf, sizeof(buf), 0). -- match = Search(r'memset\s*\(([^,]*),\s*([^,]*),\s*0\s*\)', line) -- if match and not Match(r"^''|-?[0-9]+|0x[0-9A-Fa-f]$", match.group(2)): -+ match = re.search(r'memset\s*\(([^,]*),\s*([^,]*),\s*0\s*\)', line) -+ if match and not re.match(r"^''|-?[0-9]+|0x[0-9A-Fa-f]$", match.group(2)): - error(filename, linenum, 'runtime/memset', 4, - 'Did you mean "memset(%s, 0, %s)"?' - % (match.group(1), match.group(2))) - -- if Search(r'\busing namespace\b', line): -- if Search(r'\bliterals\b', line): -+ if re.search(r'\busing namespace\b', line): -+ if re.search(r'\bliterals\b', line): - error(filename, linenum, 'build/namespaces_literals', 5, - 'Do not use namespace using-directives. ' - 'Use using-declarations instead.') -@@ -5351,7 +5313,7 @@ def CheckLanguage(filename, clean_lines, - 'Use using-declarations instead.') - - # Detect variable-length arrays. -- match = Match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line) -+ match = re.match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line) - if (match and match.group(2) != 'return' and match.group(2) != 'delete' and - match.group(3).find(']') == -1): - # Split the size using space and arithmetic operators as delimiters. -@@ -5365,17 +5327,17 @@ def CheckLanguage(filename, clean_lines, - skip_next = False - continue - -- if Search(r'sizeof\(.+\)', tok): continue -- if Search(r'arraysize\(\w+\)', tok): continue -+ if re.search(r'sizeof\(.+\)', tok): continue -+ if re.search(r'arraysize\(\w+\)', tok): continue - - tok = tok.lstrip('(') - tok = tok.rstrip(')') - if not tok: continue -- if Match(r'\d+', tok): continue -- if Match(r'0[xX][0-9a-fA-F]+', tok): continue -- if Match(r'k[A-Z0-9]\w*', tok): continue -- if Match(r'(.+::)?k[A-Z0-9]\w*', tok): continue -- if Match(r'(.+::)?[A-Z][A-Z0-9_]*', tok): continue -+ if re.match(r'\d+', tok): continue -+ if re.match(r'0[xX][0-9a-fA-F]+', tok): continue -+ if re.match(r'k[A-Z0-9]\w*', tok): continue -+ if re.match(r'(.+::)?k[A-Z0-9]\w*', tok): continue -+ if re.match(r'(.+::)?[A-Z][A-Z0-9_]*', tok): continue - # A catch all for tricky sizeof cases, including 'sizeof expression', - # 'sizeof(*type)', 'sizeof(const type)', 'sizeof(struct StructName)' - # requires skipping the next token because we split on ' ' and '*'. -@@ -5393,7 +5355,7 @@ def CheckLanguage(filename, clean_lines, - # macros are typically OK, so we allow use of "namespace {" on lines - # that end with backslashes. - if (IsHeaderExtension(file_extension) -- and Search(r'\bnamespace\s*{', line) -+ and re.search(r'\bnamespace\s*{', line) - and line[-1] != '\\'): - error(filename, linenum, 'build/namespaces_headers', 4, - 'Do not use unnamed namespaces in header files. See ' -@@ -5413,7 +5375,7 @@ def CheckGlobalStatic(filename, clean_li - line = clean_lines.elided[linenum] - - # Match two lines at a time to support multiline declarations -- if linenum + 1 < clean_lines.NumLines() and not Search(r'[;({]', line): -+ if linenum + 1 < clean_lines.NumLines() and not re.search(r'[;({]', line): - line += clean_lines.elided[linenum + 1].strip() - - # Check for people declaring static/global STL strings at the top level. -@@ -5422,7 +5384,7 @@ def CheckGlobalStatic(filename, clean_li - # also because globals can be destroyed when some threads are still running. - # TODO(unknown): Generalize this to also find static unique_ptr instances. - # TODO(unknown): File bugs for clang-tidy to find these. -- match = Match( -+ match = re.match( - r'((?:|static +)(?:|const +))(?::*std::)?string( +const)? +' - r'([a-zA-Z0-9_:]+)\b(.*)', - line) -@@ -5444,10 +5406,10 @@ def CheckGlobalStatic(filename, clean_li - # matching identifiers. - # string Class::operator*() - if (match and -- not Search(r'\bstring\b(\s+const)?\s*[\*\&]\s*(const\s+)?\w', line) and -- not Search(r'\boperator\W', line) and -- not Match(r'\s*(<.*>)?(::[a-zA-Z0-9_]+)*\s*\(([^"]|$)', match.group(4))): -- if Search(r'\bconst\b', line): -+ not re.search(r'\bstring\b(\s+const)?\s*[\*\&]\s*(const\s+)?\w', line) and -+ not re.search(r'\boperator\W', line) and -+ not re.match(r'\s*(<.*>)?(::[a-zA-Z0-9_]+)*\s*\(([^"]|$)', match.group(4))): -+ if re.search(r'\bconst\b', line): - error(filename, linenum, 'runtime/string', 4, - 'For a static/global string constant, use a C style string ' - 'instead: "%schar%s %s[]".' % -@@ -5456,8 +5418,8 @@ def CheckGlobalStatic(filename, clean_li - error(filename, linenum, 'runtime/string', 4, - 'Static/global string variables are not permitted.') - -- if (Search(r'\b([A-Za-z0-9_]*_)\(\1\)', line) or -- Search(r'\b([A-Za-z0-9_]*_)\(CHECK_NOTNULL\(\1\)\)', line)): -+ if (re.search(r'\b([A-Za-z0-9_]*_)\(\1\)', line) or -+ re.search(r'\b([A-Za-z0-9_]*_)\(CHECK_NOTNULL\(\1\)\)', line)): - error(filename, linenum, 'runtime/init', 4, - 'You seem to be initializing a member variable with itself.') - -@@ -5474,7 +5436,7 @@ def CheckPrintf(filename, clean_lines, l - line = clean_lines.elided[linenum] - - # When snprintf is used, the second argument shouldn't be a literal. -- match = Search(r'snprintf\s*\(([^,]*),\s*([0-9]*)\s*,', line) -+ match = re.search(r'snprintf\s*\(([^,]*),\s*([0-9]*)\s*,', line) - if match and match.group(2) != '0': - # If 2nd arg is zero, snprintf is used to calculate size. - error(filename, linenum, 'runtime/printf', 3, -@@ -5482,10 +5444,10 @@ def CheckPrintf(filename, clean_lines, l - 'to snprintf.' % (match.group(1), match.group(2))) - - # Check if some verboten C functions are being used. -- if Search(r'\bsprintf\s*\(', line): -+ if re.search(r'\bsprintf\s*\(', line): - error(filename, linenum, 'runtime/printf', 5, - 'Never use sprintf. Use snprintf instead.') -- match = Search(r'\b(strcpy|strcat)\s*\(', line) -+ match = re.search(r'\b(strcpy|strcat)\s*\(', line) - if match: - error(filename, linenum, 'runtime/printf', 4, - 'Almost always, snprintf is better than %s' % match.group(1)) -@@ -5503,13 +5465,13 @@ def IsDerivedFunction(clean_lines, linen - """ - # Scan back a few lines for start of current function - for i in xrange(linenum, max(-1, linenum - 10), -1): -- match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i]) -+ match = re.match(r'^([^()]*\w+)\(', clean_lines.elided[i]) - if match: - # Look for "override" after the matching closing parenthesis - line, _, closing_paren = CloseExpression( - clean_lines, i, len(match.group(1))) - return (closing_paren >= 0 and -- Search(r'\boverride\b', line[closing_paren:])) -+ re.search(r'\boverride\b', line[closing_paren:])) - return False - - -@@ -5524,8 +5486,8 @@ def IsOutOfLineMethodDefinition(clean_li - """ - # Scan back a few lines for start of current function - for i in xrange(linenum, max(-1, linenum - 10), -1): -- if Match(r'^([^()]*\w+)\(', clean_lines.elided[i]): -- return Match(r'^[^()]*\w+::\w+\(', clean_lines.elided[i]) is not None -+ if re.match(r'^([^()]*\w+)\(', clean_lines.elided[i]): -+ return re.match(r'^[^()]*\w+::\w+\(', clean_lines.elided[i]) is not None - return False - - -@@ -5542,21 +5504,21 @@ def IsInitializerList(clean_lines, linen - for i in xrange(linenum, 1, -1): - line = clean_lines.elided[i] - if i == linenum: -- remove_function_body = Match(r'^(.*)\{\s*$', line) -+ remove_function_body = re.match(r'^(.*)\{\s*$', line) - if remove_function_body: - line = remove_function_body.group(1) - -- if Search(r'\s:\s*\w+[({]', line): -+ if re.search(r'\s:\s*\w+[({]', line): - # A lone colon tend to indicate the start of a constructor - # initializer list. It could also be a ternary operator, which - # also tend to appear in constructor initializer lists as - # opposed to parameter lists. - return True -- if Search(r'\}\s*,\s*$', line): -+ if re.search(r'\}\s*,\s*$', line): - # A closing brace followed by a comma is probably the end of a - # brace-initialized member in constructor initializer list. - return True -- if Search(r'[{};]\s*$', line): -+ if re.search(r'[{};]\s*$', line): - # Found one of the following: - # - A closing brace or semicolon, probably the end of the previous - # function. -@@ -5620,13 +5582,13 @@ def CheckForNonConstReference(filename, - # that spans more than 2 lines, please use a typedef. - if linenum > 1: - previous = None -- if Match(r'\s*::(?:[\w<>]|::)+\s*&\s*\S', line): -+ if re.match(r'\s*::(?:[\w<>]|::)+\s*&\s*\S', line): - # previous_line\n + ::current_line -- previous = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+[\w<>])\s*$', -+ previous = re.search(r'\b((?:const\s*)?(?:[\w<>]|::)+[\w<>])\s*$', - clean_lines.elided[linenum - 1]) -- elif Match(r'\s*[a-zA-Z_]([\w<>]|::)+\s*&\s*\S', line): -+ elif re.match(r'\s*[a-zA-Z_]([\w<>]|::)+\s*&\s*\S', line): - # previous_line::\n + current_line -- previous = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+::)\s*$', -+ previous = re.search(r'\b((?:const\s*)?(?:[\w<>]|::)+::)\s*$', - clean_lines.elided[linenum - 1]) - if previous: - line = previous.group(1) + line.lstrip() -@@ -5666,13 +5628,13 @@ def CheckForNonConstReference(filename, - if linenum > 0: - for i in xrange(linenum - 1, max(0, linenum - 10), -1): - previous_line = clean_lines.elided[i] -- if not Search(r'[),]\s*$', previous_line): -+ if not re.search(r'[),]\s*$', previous_line): - break -- if Match(r'^\s*:\s+\S', previous_line): -+ if re.match(r'^\s*:\s+\S', previous_line): - return - - # Avoid preprocessors -- if Search(r'\\\s*$', line): -+ if re.search(r'\\\s*$', line): - return - - # Avoid constructor initializer lists -@@ -5689,25 +5651,25 @@ def CheckForNonConstReference(filename, - r'operator\s*[<>][<>]|' - r'static_assert|COMPILE_ASSERT' - r')\s*\(') -- if Search(allowed_functions, line): -+ if re.search(allowed_functions, line): - return -- elif not Search(r'\S+\([^)]*$', line): -+ elif not re.search(r'\S+\([^)]*$', line): - # Don't see an allowed function on this line. Actually we - # didn't see any function name on this line, so this is likely a - # multi-line parameter list. Try a bit harder to catch this case. - for i in xrange(2): - if (linenum > i and -- Search(allowed_functions, clean_lines.elided[linenum - i - 1])): -+ re.search(allowed_functions, clean_lines.elided[linenum - i - 1])): - return - -- decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body -+ decls = re.sub(r'{[^}]*}', ' ', line) # exclude function body - for parameter in re.findall(_RE_PATTERN_REF_PARAM, decls): -- if (not Match(_RE_PATTERN_CONST_REF_PARAM, parameter) and -- not Match(_RE_PATTERN_REF_STREAM_PARAM, parameter)): -+ if (not re.match(_RE_PATTERN_CONST_REF_PARAM, parameter) and -+ not re.match(_RE_PATTERN_REF_STREAM_PARAM, parameter)): - error(filename, linenum, 'runtime/references', 2, - 'Is this a non-const reference? ' - 'If so, make const or use a pointer: ' + -- ReplaceAll(' *<', '<', parameter)) -+ re.sub(' *<', '<', parameter)) - - - def CheckCasts(filename, clean_lines, linenum, error): -@@ -5725,7 +5687,7 @@ def CheckCasts(filename, clean_lines, li - # I just try to capture the most common basic types, though there are more. - # Parameterless conversion functions, such as bool(), are allowed as they are - # probably a member operator declaration or default constructor. -- match = Search( -+ match = re.search( - r'(\bnew\s+(?:const\s+)?|\S<\s*(?:const\s+)?)?\b' - r'(int|float|double|bool|char|int32|uint32|int64|uint64)' - r'(\([^)].*)', line) -@@ -5749,7 +5711,7 @@ def CheckCasts(filename, clean_lines, li - - # Avoid arrays by looking for brackets that come after the closing - # parenthesis. -- if Match(r'\([^()]+\)\s*\[', match.group(3)): -+ if re.match(r'\([^()]+\)\s*\[', match.group(3)): - return - - # Other things to ignore: -@@ -5760,11 +5722,11 @@ def CheckCasts(filename, clean_lines, li - matched_funcptr = match.group(3) - if (matched_new_or_template is None and - not (matched_funcptr and -- (Match(r'\((?:[^() ]+::\s*\*\s*)?[^() ]+\)\s*\(', -+ (re.match(r'\((?:[^() ]+::\s*\*\s*)?[^() ]+\)\s*\(', - matched_funcptr) or - matched_funcptr.startswith('(*)'))) and -- not Match(r'\s*using\s+\S+\s*=\s*' + matched_type, line) and -- not Search(r'new\(\S+\)\s*' + matched_type, line)): -+ not re.match(r'\s*using\s+\S+\s*=\s*' + matched_type, line) and -+ not re.search(r'new\(\S+\)\s*' + matched_type, line)): - error(filename, linenum, 'readability/casting', 4, - 'Using deprecated casting style. ' - 'Use static_cast<%s>(...) instead' % -@@ -5797,7 +5759,7 @@ def CheckCasts(filename, clean_lines, li - # - # This is not a cast: - # reference_type&(int* function_param); -- match = Search( -+ match = re.search( - r'(?:[^\w]&\(([^)*][^)]*)\)[\w(])|' - r'(?:[^\w]&(static|dynamic|down|reinterpret)_cast\b)', line) - if match: -@@ -5805,7 +5767,7 @@ def CheckCasts(filename, clean_lines, li - # dereferenced by the casted pointer, as opposed to the casted - # pointer itself. - parenthesis_error = False -- match = Match(r'^(.*&(?:static|dynamic|down|reinterpret)_cast\b)<', line) -+ match = re.match(r'^(.*&(?:static|dynamic|down|reinterpret)_cast\b)<', line) - if match: - _, y1, x1 = CloseExpression(clean_lines, linenum, len(match.group(1))) - if x1 >= 0 and clean_lines.elided[y1][x1] == '(': -@@ -5814,7 +5776,7 @@ def CheckCasts(filename, clean_lines, li - extended_line = clean_lines.elided[y2][x2:] - if y2 < clean_lines.NumLines() - 1: - extended_line += clean_lines.elided[y2 + 1] -- if Match(r'\s*(?:->|\[)', extended_line): -+ if re.match(r'\s*(?:->|\[)', extended_line): - parenthesis_error = True - - if parenthesis_error: -@@ -5846,13 +5808,13 @@ def CheckCStyleCast(filename, clean_line - False otherwise. - """ - line = clean_lines.elided[linenum] -- match = Search(pattern, line) -+ match = re.search(pattern, line) - if not match: - return False - - # Exclude lines with keywords that tend to look like casts - context = line[0:match.start(1) - 1] -- if Match(r'.*\b(?:sizeof|alignof|alignas|[_A-Z][_A-Z0-9]*)\s*$', context): -+ if re.match(r'.*\b(?:sizeof|alignof|alignas|[_A-Z][_A-Z0-9]*)\s*$', context): - return False - - # Try expanding current context to see if we one level of -@@ -5860,7 +5822,7 @@ def CheckCStyleCast(filename, clean_line - if linenum > 0: - for i in xrange(linenum - 1, max(0, linenum - 5), -1): - context = clean_lines.elided[i] + context -- if Match(r'.*\b[_A-Z][_A-Z0-9]*\s*\((?:\([^()]*\)|[^()])*$', context): -+ if re.match(r'.*\b[_A-Z][_A-Z0-9]*\s*\((?:\([^()]*\)|[^()])*$', context): - return False - - # operator++(int) and operator--(int) -@@ -5871,7 +5833,7 @@ def CheckCStyleCast(filename, clean_line - # A single unnamed argument for a function tends to look like old style cast. - # If we see those, don't issue warnings for deprecated casts. - remainder = line[match.end(0):] -- if Match(r'^\s*(?:;|const\b|throw\b|final\b|override\b|[=>{),]|->)', -+ if re.match(r'^\s*(?:;|const\b|throw\b|final\b|override\b|[=>{),]|->)', - remainder): - return False - -@@ -5895,13 +5857,13 @@ def ExpectingFunctionArgs(clean_lines, l - of function types. - """ - line = clean_lines.elided[linenum] -- return (Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or -+ return (re.match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or - (linenum >= 2 and -- (Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\((?:\S+,)?\s*$', -+ (re.match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\((?:\S+,)?\s*$', - clean_lines.elided[linenum - 1]) or -- Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\(\s*$', -+ re.match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\(\s*$', - clean_lines.elided[linenum - 2]) or -- Search(r'\bstd::m?function\s*\<\s*$', -+ re.search(r'\bstd::m?function\s*\<\s*$', - clean_lines.elided[linenum - 1])))) - - -@@ -6023,7 +5985,7 @@ def FilesBelongToSameModule(filename_cc, - return (False, '') - - filename_cc = filename_cc[:-(len(fileinfo_cc.Extension()))] -- matched_test_suffix = Search(_TEST_FILE_SUFFIX, fileinfo_cc.BaseName()) -+ matched_test_suffix = re.search(_TEST_FILE_SUFFIX, fileinfo_cc.BaseName()) - if matched_test_suffix: - filename_cc = filename_cc[:-len(matched_test_suffix.group(1))] - -@@ -6207,20 +6169,20 @@ def CheckRedundantVirtual(filename, clea - """ - # Look for "virtual" on current line. - line = clean_lines.elided[linenum] -- virtual = Match(r'^(.*)(\bvirtual\b)(.*)$', line) -+ virtual = re.match(r'^(.*)(\bvirtual\b)(.*)$', line) - if not virtual: return - - # Ignore "virtual" keywords that are near access-specifiers. These - # are only used in class base-specifier and do not apply to member - # functions. -- if (Search(r'\b(public|protected|private)\s+$', virtual.group(1)) or -- Match(r'^\s+(public|protected|private)\b', virtual.group(3))): -+ if (re.search(r'\b(public|protected|private)\s+$', virtual.group(1)) or -+ re.match(r'^\s+(public|protected|private)\b', virtual.group(3))): - return - - # Ignore the "virtual" keyword from virtual base classes. Usually - # there is a column on the same line in these cases (virtual base - # classes are rare in google3 because multiple inheritance is rare). -- if Match(r'^.*[^:]:[^:].*$', line): return -+ if re.match(r'^.*[^:]:[^:].*$', line): return - - # Look for the next opening parenthesis. This is the start of the - # parameter list (possibly on the next line shortly after virtual). -@@ -6232,7 +6194,7 @@ def CheckRedundantVirtual(filename, clea - start_col = len(virtual.group(2)) - for start_line in xrange(linenum, min(linenum + 3, clean_lines.NumLines())): - line = clean_lines.elided[start_line][start_col:] -- parameter_list = Match(r'^([^(]*)\(', line) -+ parameter_list = re.match(r'^([^(]*)\(', line) - if parameter_list: - # Match parentheses to find the end of the parameter list - (_, end_line, end_col) = CloseExpression( -@@ -6247,7 +6209,7 @@ def CheckRedundantVirtual(filename, clea - # (possibly on the next few lines). - for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())): - line = clean_lines.elided[i][end_col:] -- match = Search(r'\b(override|final)\b', line) -+ match = re.search(r'\b(override|final)\b', line) - if match: - error(filename, linenum, 'readability/inheritance', 4, - ('"virtual" is redundant since function is ' -@@ -6256,7 +6218,7 @@ def CheckRedundantVirtual(filename, clea - # Set end_col to check whole lines after we are done with the - # first line. - end_col = 0 -- if Search(r'[^\w]\s*$', line): -+ if re.search(r'[^\w]\s*$', line): - break - - -@@ -6283,7 +6245,7 @@ def CheckRedundantOverrideOrFinal(filena - return - - # Check that at most one of "override" or "final" is present, not both -- if Search(r'\boverride\b', fragment) and Search(r'\bfinal\b', fragment): -+ if re.search(r'\boverride\b', fragment) and re.search(r'\bfinal\b', fragment): - error(filename, linenum, 'readability/inheritance', 4, - ('"override" is redundant since function is ' - 'already declared as "final"')) -@@ -6348,7 +6310,7 @@ def ShouldCheckNamespaceIndentation(nest - def CheckItemIndentationInNamespace(filename, raw_lines_no_comments, linenum, - error): - line = raw_lines_no_comments[linenum] -- if Match(r'^\s+', line): -+ if re.match(r'^\s+', line): - error(filename, linenum, 'runtime/indentation_namespace', 4, - 'Do not indent within a namespace') - -@@ -6409,7 +6371,7 @@ def FlagCxx11Features(filename, clean_li - """ - line = clean_lines.elided[linenum] - -- include = Match(r'\s*#\s*include\s+[<"]([^<"]+)[">]', line) -+ include = re.match(r'\s*#\s*include\s+[<"]([^<"]+)[">]', line) - - # Flag unapproved C++ TR1 headers. - if include and include.group(1).startswith('tr1/'): -@@ -6433,7 +6395,7 @@ def FlagCxx11Features(filename, clean_li - - # The only place where we need to worry about C++11 keywords and library - # features in preprocessor directives is in macro definitions. -- if Match(r'\s*#', line) and not Match(r'\s*#\s*define\b', line): return -+ if re.match(r'\s*#', line) and not re.match(r'\s*#\s*define\b', line): return - - # These are classes and free functions. The classes are always - # mentioned as std::*, but we only catch the free functions if -@@ -6443,7 +6405,7 @@ def FlagCxx11Features(filename, clean_li - 'alignment_of', - 'aligned_union', - ): -- if Search(r'\bstd::%s\b' % top_name, line): -+ if re.search(r'\bstd::%s\b' % top_name, line): - error(filename, linenum, 'build/c++11', 5, - ('std::%s is an unapproved C++11 class or function. Send c-style ' - 'an example of where it would make your code more readable, and ' -@@ -6461,7 +6423,7 @@ def FlagCxx14Features(filename, clean_li - """ - line = clean_lines.elided[linenum] - -- include = Match(r'\s*#\s*include\s+[<"]([^<"]+)[">]', line) -+ include = re.match(r'\s*#\s*include\s+[<"]([^<"]+)[">]', line) - - # Flag unapproved C++14 headers. - if include and include.group(1) in ('scoped_allocator', 'shared_mutex'): diff --git a/python-cpplint.changes b/python-cpplint.changes index a2bab20..4f8e07f 100644 --- a/python-cpplint.changes +++ b/python-cpplint.changes @@ -1,3 +1,57 @@ +------------------------------------------------------------------- +Fri Oct 31 02:26:02 UTC 2025 - Steve Kowalik + +- Update to 2.0.2: + * Drop Python 3.8 + * Don't err on non-const references by default + * fix(indentation_namespace): false positive for MemInitLists + * Fix missing comma between items in _CPP_HEADERS + * Fix false positive for indented parameters in namespaces + * IWYU: treat stdio.h the same way as cstdio + * PEP 621: Migrate from setup.{py, cfg} to pyproject.toml + * cpplint_clitest.py: Function names should be lowercase + * suppress C++-only categories on C file extensions + * You can now specify blocks of code that exclude linting with NOLINTBEGIN + and NOLINTEND + * The --filter option can now be only applied to a specific file or even a + specific line through utilizing colons + * NOLINT and NOLINTNEXTLINE comments now support a comma-separated list of + categories + * NOLINT and NOLINTNEXTLINE will now ignore categories known to be from + clang-tidy + * build/include-what-you-use no longer supports transitive headers from the + header for the current module for parity with the style guide + * build/include-what-you-use now supports a plethora of new functions + * build/include-what-you-use will no longer err on similarly-named classes + from other namespaces + * Indented functions inside namespaces will now be correctly erred on + * The check for C-style casts now looks for the standard fixed-width + integer typenames instead of non-standard ones (e.g. int32_t instead of + int32) + * readability/braces will realize that C++20 concepts require a semicolon + * C++20 headers will no longer be flagged as C headers + * Processing C++ files through stdin/piping is now fixed + * You can now specify the name of the CPPLINT.cfg file through --config as + long as it is in the same directory + * The new __VA_OPT__(,) will now be recognized by the Whitespace linter as + a function + * The check for including a source file's header file will now scan all + files with the same base name + * build/class and build/namespaces no longer check for whether a namespace + or class has a closing brace + * For header files, the check for a header guard's name will now be cached + and only run once, as opposed to previously being run on every line + * Usages of the deprecated sre_compile were refectored + * Usages of deprecated unittest aliases were refactored + * Typos in this changelog, comments and functions were fixed + * %-strings were modernized into f-strings +- Drop patches, all upstream: + * deprecated-unittest-aliases.patch + * drop-sre-compile.patch + * python312.patch +- Add patch do-not-use-codecs-open.patch: + * Do not use deprecated codecs.open() method. + ------------------------------------------------------------------- Mon Jul 7 09:42:55 UTC 2025 - Markéta Machová diff --git a/python-cpplint.spec b/python-cpplint.spec index cc9008e..201323b 100644 --- a/python-cpplint.spec +++ b/python-cpplint.spec @@ -1,7 +1,7 @@ # # spec file for package python-cpplint # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,19 +18,18 @@ %bcond_without libalternatives Name: python-cpplint -Version: 1.6.1 +Version: 2.0.2 Release: 0 Summary: An automated checker to make sure a C++ file follows Google's C++ style guide License: BSD-3-Clause URL: https://github.com/cpplint/cpplint Source: https://files.pythonhosted.org/packages/source/c/cpplint/cpplint-%{version}.tar.gz -# PATCH-FIX-UPSTREAM drop-sre-compile.patch gh#cpplint/cpplint#214 -Patch0: drop-sre-compile.patch -# PATCH-FIX-UPSTREAM python312.patch gh#cpplint/cpplint#243 -Patch1: python312.patch -# PATCH-FIX-UPSTREAM deprecated-unittest-aliases.patch gh#cpplint/cpplint#182 -Patch2: deprecated-unittest-aliases.patch +# PATCH-FIX-UPSTREAM gh#cpplint/cpplint#405 +Patch0: do-not-use-codecs-open.patch +BuildRequires: %{python_module base >= 3.9} BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest-cov} +BuildRequires: %{python_module pytest-timeout} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module testfixtures} @@ -51,10 +50,6 @@ in hopes that it can be merged in the future. %prep %autosetup -p1 -n cpplint-%{version} -sed -i -e '/^#!\//, 1d' cpplint.py -sed -i 's/pytest-runner==5.2//' setup.py -sed -i 's/pytest-cov//' test-requirements -sed -i 's/--cov-fail-under=75 --cov=cpplint//' setup.cfg %build %pyproject_wheel diff --git a/python312.patch b/python312.patch deleted file mode 100644 index 7e6c6cf..0000000 --- a/python312.patch +++ /dev/null @@ -1,2018 +0,0 @@ -From 0e855087765db4cbe8283f614238aaa0dba74ff6 Mon Sep 17 00:00:00 2001 -From: John Vandenberg -Date: Sun, 4 Feb 2024 06:33:12 +0800 -Subject: [PATCH] Fix support for Python 3.12 - -Removes 'lint' subcommand support from setup.py ---- - -From 0e855087765db4cbe8283f614238aaa0dba74ff6 Mon Sep 17 00:00:00 2001 -From: John Vandenberg -Date: Sun, 4 Feb 2024 06:33:12 +0800 -Subject: [PATCH] Fix support for Python 3.12 - -Removes 'lint' subcommand support from setup.py ---- - cpplint_unittest.py | 2 +- - setup.py | 38 +------------------------------------- - test-requirements | 1 - - 6 files changed, 13 insertions(+), 49 deletions(-) - -Index: cpplint-1.6.1/cpplint_unittest.py -=================================================================== ---- cpplint-1.6.1.orig/cpplint_unittest.py -+++ cpplint-1.6.1/cpplint_unittest.py -@@ -253,10 +253,10 @@ class CpplintTestBase(unittest.TestCase) - - # Perform lint and compare the error message with "expected_message". - def TestLint(self, code, expected_message): -- self.assertEquals(expected_message, self.PerformSingleLineLint(code)) -+ self.assertEqual(expected_message, self.PerformSingleLineLint(code)) - - def TestMultiLineLint(self, code, expected_message): -- self.assertEquals(expected_message, self.PerformMultiLineLint(code)) -+ self.assertEqual(expected_message, self.PerformMultiLineLint(code)) - - def TestMultiLineLintRE(self, code, expected_message_re): - message = self.PerformMultiLineLint(code) -@@ -265,11 +265,11 @@ class CpplintTestBase(unittest.TestCase) - expected_message_re + '"') - - def TestLanguageRulesCheck(self, file_name, code, expected_message): -- self.assertEquals(expected_message, -+ self.assertEqual(expected_message, - self.PerformLanguageRulesCheck(file_name, code)) - - def TestIncludeWhatYouUse(self, code, expected_message): -- self.assertEquals(expected_message, -+ self.assertEqual(expected_message, - self.PerformIncludeWhatYouUse(code)) - - def TestBlankLinesCheck(self, lines, start_errors, end_errors): -@@ -279,12 +279,12 @@ class CpplintTestBase(unittest.TestCase) - def doTestBlankLinesCheck(self, lines, start_errors, end_errors, extension): - error_collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData('foo.' + extension, extension, lines, error_collector) -- self.assertEquals( -+ self.assertEqual( - start_errors, - error_collector.Results().count( - 'Redundant blank line at the start of a code block ' - 'should be deleted. [whitespace/blank_line] [2]')) -- self.assertEquals( -+ self.assertEqual( - end_errors, - error_collector.Results().count( - 'Redundant blank line at the end of a code block ' -@@ -311,7 +311,7 @@ class CpplintTest(CpplintTestBase): - '} // namespace Test'] - - results = self.GetNamespaceResults(lines) -- self.assertEquals(results, 'Do not indent within a namespace ' -+ self.assertEqual(results, 'Do not indent within a namespace ' - ' [runtime/indentation_namespace] [4]') - - def testNameSpaceIndentationForClass(self): -@@ -322,7 +322,7 @@ class CpplintTest(CpplintTestBase): - '} // namespace Test'] - - results = self.GetNamespaceResults(lines) -- self.assertEquals(results, 'Do not indent within a namespace ' -+ self.assertEqual(results, 'Do not indent within a namespace ' - ' [runtime/indentation_namespace] [4]') - - def testNameSpaceIndentationNoError(self): -@@ -331,7 +331,7 @@ class CpplintTest(CpplintTestBase): - '} // namespace Test'] - - results = self.GetNamespaceResults(lines) -- self.assertEquals(results, '') -+ self.assertEqual(results, '') - - def testWhitespaceBeforeNamespace(self): - lines = [' namespace Test {', -@@ -339,7 +339,7 @@ class CpplintTest(CpplintTestBase): - ' } // namespace Test'] - - results = self.GetNamespaceResults(lines) -- self.assertEquals(results, '') -+ self.assertEqual(results, '') - - def testFalsePositivesNoError(self): - lines = ['namespace Test {', -@@ -350,34 +350,34 @@ class CpplintTest(CpplintTestBase): - '} // namespace Test'] - - results = self.GetNamespaceResults(lines) -- self.assertEquals(results, '') -+ self.assertEqual(results, '') - - # Test get line width. - def testGetLineWidth(self): -- self.assertEquals(0, cpplint.GetLineWidth('')) -- self.assertEquals(10, cpplint.GetLineWidth(unicode('x') * 10)) -- self.assertEquals(16, cpplint.GetLineWidth(unicode_escape_decode('\u90fd|\u9053|\u5e9c|\u770c|\u652f\u5e81'))) -- self.assertEquals(16, cpplint.GetLineWidth(u'都|道|府|県|支庁')) -- self.assertEquals(5 + 13 + 9, cpplint.GetLineWidth( -+ self.assertEqual(0, cpplint.GetLineWidth('')) -+ self.assertEqual(10, cpplint.GetLineWidth(unicode('x') * 10)) -+ self.assertEqual(16, cpplint.GetLineWidth(unicode_escape_decode('\u90fd|\u9053|\u5e9c|\u770c|\u652f\u5e81'))) -+ self.assertEqual(16, cpplint.GetLineWidth(u'都|道|府|県|支庁')) -+ self.assertEqual(5 + 13 + 9, cpplint.GetLineWidth( - u'd𝐱/dt' + u'f : t ⨯ 𝐱 → ℝ' + u't ⨯ 𝐱 → ℝ')) - - def testGetTextInside(self): -- self.assertEquals('', cpplint._GetTextInside('fun()', r'fun\(')) -- self.assertEquals('x, y', cpplint._GetTextInside('f(x, y)', r'f\(')) -- self.assertEquals('a(), b(c())', cpplint._GetTextInside( -+ self.assertEqual('', cpplint._GetTextInside('fun()', r'fun\(')) -+ self.assertEqual('x, y', cpplint._GetTextInside('f(x, y)', r'f\(')) -+ self.assertEqual('a(), b(c())', cpplint._GetTextInside( - 'printf(a(), b(c()))', r'printf\(')) -- self.assertEquals('x, y{}', cpplint._GetTextInside('f[x, y{}]', r'f\[')) -- self.assertEquals(None, cpplint._GetTextInside('f[a, b(}]', r'f\[')) -- self.assertEquals(None, cpplint._GetTextInside('f[x, y]', r'f\(')) -- self.assertEquals('y, h(z, (a + b))', cpplint._GetTextInside( -+ self.assertEqual('x, y{}', cpplint._GetTextInside('f[x, y{}]', r'f\[')) -+ self.assertEqual(None, cpplint._GetTextInside('f[a, b(}]', r'f\[')) -+ self.assertEqual(None, cpplint._GetTextInside('f[x, y]', r'f\(')) -+ self.assertEqual('y, h(z, (a + b))', cpplint._GetTextInside( - 'f(x, g(y, h(z, (a + b))))', r'g\(')) -- self.assertEquals('f(f(x))', cpplint._GetTextInside('f(f(f(x)))', r'f\(')) -+ self.assertEqual('f(f(x))', cpplint._GetTextInside('f(f(f(x)))', r'f\(')) - # Supports multiple lines. -- self.assertEquals('\n return loop(x);\n', -+ self.assertEqual('\n return loop(x);\n', - cpplint._GetTextInside( - 'int loop(int x) {\n return loop(x);\n}\n', r'\{')) - # '^' matches the beginning of each line. -- self.assertEquals('x, y', -+ self.assertEqual('x, y', - cpplint._GetTextInside( - '#include "inl.h" // skip #define\n' - '#define A2(x, y) a_inl_(x, y, __LINE__)\n' -@@ -385,23 +385,23 @@ class CpplintTest(CpplintTestBase): - r'^\s*#define\s*\w+\(')) - - def testFindNextMultiLineCommentStart(self): -- self.assertEquals(1, cpplint.FindNextMultiLineCommentStart([''], 0)) -+ self.assertEqual(1, cpplint.FindNextMultiLineCommentStart([''], 0)) - - lines = ['a', 'b', '/* c'] -- self.assertEquals(2, cpplint.FindNextMultiLineCommentStart(lines, 0)) -+ self.assertEqual(2, cpplint.FindNextMultiLineCommentStart(lines, 0)) - - lines = ['char a[] = "/*";'] # not recognized as comment. -- self.assertEquals(1, cpplint.FindNextMultiLineCommentStart(lines, 0)) -+ self.assertEqual(1, cpplint.FindNextMultiLineCommentStart(lines, 0)) - - def testFindNextMultiLineCommentEnd(self): -- self.assertEquals(1, cpplint.FindNextMultiLineCommentEnd([''], 0)) -+ self.assertEqual(1, cpplint.FindNextMultiLineCommentEnd([''], 0)) - lines = ['a', 'b', ' c */'] -- self.assertEquals(2, cpplint.FindNextMultiLineCommentEnd(lines, 0)) -+ self.assertEqual(2, cpplint.FindNextMultiLineCommentEnd(lines, 0)) - - def testRemoveMultiLineCommentsFromRange(self): - lines = ['a', ' /* comment ', ' * still comment', ' comment */ ', 'b'] - cpplint.RemoveMultiLineCommentsFromRange(lines, 1, 4) -- self.assertEquals(['a', '/**/', '/**/', '/**/', 'b'], lines) -+ self.assertEqual(['a', '/**/', '/**/', '/**/', 'b'], lines) - - def testSpacesAtEndOfLine(self): - self.TestLint( -@@ -516,7 +516,7 @@ class CpplintTest(CpplintTestBase): - '// ./command' + (' -verbose' * 80), - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - # LINT_C_FILE silences cast warnings for entire file. - error_collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData('test.h', 'h', -@@ -526,7 +526,7 @@ class CpplintTest(CpplintTestBase): - '// LINT_C_FILE', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - # Vim modes silence cast warnings for entire file. - for modeline in ['vi:filetype=c', - 'vi:sw=8 filetype=c', -@@ -562,7 +562,7 @@ class CpplintTest(CpplintTestBase): - '*/', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - # LINT_KERNEL_FILE silences whitespace/tab warnings for entire file. - error_collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData('test.h', 'h', -@@ -574,7 +574,7 @@ class CpplintTest(CpplintTestBase): - '// LINT_KERNEL_FILE', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - # NOLINT, NOLINTNEXTLINE silences the readability/braces warning for "};". - error_collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData('test.cc', 'cc', -@@ -589,7 +589,7 @@ class CpplintTest(CpplintTestBase): - '// LINT_KERNEL_FILE', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - - # Test Variable Declarations. - def testVariableDeclarations(self): -@@ -845,7 +845,7 @@ class CpplintTest(CpplintTestBase): - ' bool(int)> F;', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - - # Return types for function pointers - self.TestLint('typedef bool(FunctionPointer)();', '') -@@ -889,13 +889,13 @@ class CpplintTest(CpplintTestBase): - 'MOCK_METHOD1(method4, int(bool));', - 'const int kConstant = int(42);'], # true positive - error_collector) -- self.assertEquals( -+ self.assertEqual( - 0, - error_collector.Results().count( - ('Using deprecated casting style. ' - 'Use static_cast(...) instead ' - '[readability/casting] [4]'))) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.Results().count( - ('Using deprecated casting style. ' -@@ -941,11 +941,11 @@ class CpplintTest(CpplintTestBase): - def testIncludeWhatYouUseNoImplementationFiles(self): - code = 'std::vector foo;' - for extension in ['h', 'hpp', 'hxx', 'h++', 'cuh']: -- self.assertEquals('Add #include for vector<>' -+ self.assertEqual('Add #include for vector<>' - ' [build/include_what_you_use] [4]', - self.PerformIncludeWhatYouUse(code, 'foo.' + extension)) - for extension in ['c', 'cc', 'cpp', 'cxx', 'c++', 'cu']: -- self.assertEquals('', -+ self.assertEqual('', - self.PerformIncludeWhatYouUse(code, 'foo.' + extension)) - - def testIncludeWhatYouUse(self): -@@ -1166,7 +1166,7 @@ class CpplintTest(CpplintTestBase): - '#include "blah/a.h"', - filename='blah/a.cc', - io=MockIo(mock_header_contents)) -- self.assertEquals(message, '') -+ self.assertEqual(message, '') - - mock_header_contents = ['#include '] - message = self.PerformIncludeWhatYouUse( -@@ -1174,7 +1174,7 @@ class CpplintTest(CpplintTestBase): - std::set foo;""", - filename='blah/a.cc', - io=MockIo(mock_header_contents)) -- self.assertEquals(message, '') -+ self.assertEqual(message, '') - - # Make sure we can find the correct header file if the cc file seems to be - # a temporary file generated by Emacs's flymake. -@@ -1184,7 +1184,7 @@ class CpplintTest(CpplintTestBase): - std::set foo;""", - filename='blah/a_flymake.cc', - io=MockIo(mock_header_contents)) -- self.assertEquals(message, 'Add #include for set<> ' -+ self.assertEqual(message, 'Add #include for set<> ' - '[build/include_what_you_use] [4]') - - # If there's just a cc and the header can't be found then it's ok. -@@ -1192,7 +1192,7 @@ class CpplintTest(CpplintTestBase): - """#include "blah/a.h" - std::set foo;""", - filename='blah/a.cc') -- self.assertEquals(message, '') -+ self.assertEqual(message, '') - - # Make sure we find the headers with relative paths. - mock_header_contents = [''] -@@ -1201,46 +1201,46 @@ class CpplintTest(CpplintTestBase): - std::set foo;""" % os.path.basename(os.getcwd()), - filename='a.cc', - io=MockIo(mock_header_contents)) -- self.assertEquals(message, 'Add #include for set<> ' -+ self.assertEqual(message, 'Add #include for set<> ' - '[build/include_what_you_use] [4]') - - def testFilesBelongToSameModule(self): - f = cpplint.FilesBelongToSameModule -- self.assertEquals((True, ''), f('a.cc', 'a.h')) -- self.assertEquals((True, ''), f('base/google.cc', 'base/google.h')) -- self.assertEquals((True, ''), f('base/google_test.c', 'base/google.h')) -- self.assertEquals((True, ''), f('base/google_test.cc', 'base/google.h')) -- self.assertEquals((True, ''), f('base/google_test.cc', 'base/google.hpp')) -- self.assertEquals((True, ''), f('base/google_test.cxx', 'base/google.hxx')) -- self.assertEquals((True, ''), f('base/google_test.cpp', 'base/google.hpp')) -- self.assertEquals((True, ''), f('base/google_test.c++', 'base/google.h++')) -- self.assertEquals((True, ''), f('base/google_test.cu', 'base/google.cuh')) -- self.assertEquals((True, ''), -+ self.assertEqual((True, ''), f('a.cc', 'a.h')) -+ self.assertEqual((True, ''), f('base/google.cc', 'base/google.h')) -+ self.assertEqual((True, ''), f('base/google_test.c', 'base/google.h')) -+ self.assertEqual((True, ''), f('base/google_test.cc', 'base/google.h')) -+ self.assertEqual((True, ''), f('base/google_test.cc', 'base/google.hpp')) -+ self.assertEqual((True, ''), f('base/google_test.cxx', 'base/google.hxx')) -+ self.assertEqual((True, ''), f('base/google_test.cpp', 'base/google.hpp')) -+ self.assertEqual((True, ''), f('base/google_test.c++', 'base/google.h++')) -+ self.assertEqual((True, ''), f('base/google_test.cu', 'base/google.cuh')) -+ self.assertEqual((True, ''), - f('base/google_unittest.cc', 'base/google.h')) -- self.assertEquals((True, ''), -+ self.assertEqual((True, ''), - f('base/internal/google_unittest.cc', - 'base/public/google.h')) -- self.assertEquals((True, 'xxx/yyy/'), -+ self.assertEqual((True, 'xxx/yyy/'), - f('xxx/yyy/base/internal/google_unittest.cc', - 'base/public/google.h')) -- self.assertEquals((True, 'xxx/yyy/'), -+ self.assertEqual((True, 'xxx/yyy/'), - f('xxx/yyy/base/google_unittest.cc', - 'base/public/google.h')) -- self.assertEquals((True, ''), -+ self.assertEqual((True, ''), - f('base/google_unittest.cc', 'base/google-inl.h')) -- self.assertEquals((True, '/home/build/google3/'), -+ self.assertEqual((True, '/home/build/google3/'), - f('/home/build/google3/base/google.cc', 'base/google.h')) - -- self.assertEquals((False, ''), -+ self.assertEqual((False, ''), - f('/home/build/google3/base/google.cc', 'basu/google.h')) -- self.assertEquals((False, ''), f('a.cc', 'b.h')) -+ self.assertEqual((False, ''), f('a.cc', 'b.h')) - - def testCleanseLine(self): -- self.assertEquals('int foo = 0;', -+ self.assertEqual('int foo = 0;', - cpplint.CleanseComments('int foo = 0; // danger!')) -- self.assertEquals('int o = 0;', -+ self.assertEqual('int o = 0;', - cpplint.CleanseComments('int /* foo */ o = 0;')) -- self.assertEquals('foo(int a, int b);', -+ self.assertEqual('foo(int a, int b);', - cpplint.CleanseComments('foo(int a /* abc */, int b);')) - self.assertEqual('f(a, b);', - cpplint.CleanseComments('f(a, /* name */ b);')) -@@ -1378,7 +1378,7 @@ class CpplintTest(CpplintTestBase): - ['const char* str = "This is a\\', - ' multiline string.";'], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 2, # One per line. - error_collector.ResultList().count(multiline_string_error_message)) - -@@ -1731,7 +1731,7 @@ class CpplintTest(CpplintTestBase): - ' explicit Foo(const int arg, Args&&... args) {}', - '};'], - error_collector) -- self.assertEquals(0, error_collector.ResultList().count( -+ self.assertEqual(0, error_collector.ResultList().count( - 'Constructors that require multiple arguments should not be marked ' - 'explicit. [runtime/explicit] [0]')) - error_collector = ErrorCollector(self.assert_) -@@ -1741,7 +1741,7 @@ class CpplintTest(CpplintTestBase): - ' explicit Foo(Args&&... args) {}', - '};'], - error_collector) -- self.assertEquals(0, error_collector.ResultList().count( -+ self.assertEqual(0, error_collector.ResultList().count( - 'Constructors that require multiple arguments should not be marked ' - 'explicit. [runtime/explicit] [0]')) - error_collector = ErrorCollector(self.assert_) -@@ -1751,7 +1751,7 @@ class CpplintTest(CpplintTestBase): - ' Foo(const int arg, Args&&... args) {}', - '};'], - error_collector) -- self.assertEquals(1, error_collector.ResultList().count( -+ self.assertEqual(1, error_collector.ResultList().count( - 'Constructors callable with one argument should be marked explicit.' - ' [runtime/explicit] [5]')) - error_collector = ErrorCollector(self.assert_) -@@ -1761,7 +1761,7 @@ class CpplintTest(CpplintTestBase): - ' Foo(Args&&... args) {}', - '};'], - error_collector) -- self.assertEquals(1, error_collector.ResultList().count( -+ self.assertEqual(1, error_collector.ResultList().count( - 'Constructors callable with one argument should be marked explicit.' - ' [runtime/explicit] [5]')) - # Anything goes inside an assembly block -@@ -1776,16 +1776,16 @@ class CpplintTest(CpplintTestBase): - ' }', - '}'], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 0, - error_collector.ResultList().count( - 'Extra space before ( in function call [whitespace/parens] [4]')) -- self.assertEquals( -+ self.assertEqual( - 0, - error_collector.ResultList().count( - 'Closing ) should be moved to the previous line ' - '[whitespace/parens] [2]')) -- self.assertEquals( -+ self.assertEqual( - 0, - error_collector.ResultList().count( - 'Extra space before [ [whitespace/braces] [5]')) -@@ -1888,7 +1888,7 @@ class CpplintTest(CpplintTestBase): - ' LOCKS_EXCLUDED(lock) ' + virt_specifier + ';', - ''], - error_collector) -- self.assertEquals( -+ self.assertEqual( - [error_message, error_message, error_message], - error_collector.Results()) - -@@ -1914,7 +1914,7 @@ class CpplintTest(CpplintTestBase): - '}', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - - self.TestLint('void Finalize(AnnotationProto *final) override;', '') - -@@ -2085,7 +2085,7 @@ class CpplintTest(CpplintTestBase): - '};', - ''], - error_collector) -- self.assertEquals( -+ self.assertEqual( - ('%s should be the last thing in the class' % macro_name) + - ' [readability/constructors] [3]', - error_collector.Results()) -@@ -2104,7 +2104,7 @@ class CpplintTest(CpplintTestBase): - '};', - ''], - error_collector) -- self.assertEquals( -+ self.assertEqual( - ('%s should be the last thing in the class' % macro_name) + - ' [readability/constructors] [3]', - error_collector.Results()) -@@ -2141,7 +2141,7 @@ class CpplintTest(CpplintTestBase): - '}', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - - # Brace usage - def testBraces(self): -@@ -2450,7 +2450,7 @@ class CpplintTest(CpplintTestBase): - 'void f(int& q) {}', - ''], - error_collector) -- self.assertEquals( -+ self.assertEqual( - operand_error_message % 'int& q', - error_collector.Results()) - -@@ -2496,7 +2496,7 @@ class CpplintTest(CpplintTestBase): - ' initializer2_(a6 & b6) {}', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - - # Multi-line references - error_collector = ErrorCollector(self.assert_) -@@ -2518,7 +2518,7 @@ class CpplintTest(CpplintTestBase): - '}', - ''], - error_collector) -- self.assertEquals( -+ self.assertEqual( - [operand_error_message % 'Outer::Inner& nonconst_x', - operand_error_message % 'Outer::Inner& nonconst_y', - operand_error_message % 'Outer::Inner& nonconst_z'], -@@ -2538,7 +2538,7 @@ class CpplintTest(CpplintTestBase): - '}', - ''], - error_collector.Results()) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - - def testBraceAtBeginOfLine(self): - self.TestLint('{', -@@ -2567,7 +2567,7 @@ class CpplintTest(CpplintTestBase): - '}', - '#endif'], - error_collector) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - '{ should almost always be at the end of the previous line' - ' [whitespace/braces] [4]')) - -@@ -3079,7 +3079,7 @@ class CpplintTest(CpplintTestBase): - 'static_member_variable5;', - ''], - error_collector) -- self.assertEquals(error_collector.Results(), -+ self.assertEqual(error_collector.Results(), - [error_msg % 'const char Class::static_member_variable1', - error_msg % 'const char Class::static_member_variable2', - error_msg % 'const char Class::static_member_variable3', -@@ -3210,7 +3210,7 @@ class CpplintTest(CpplintTestBase): - error_collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData('foo.cc', 'cc', lines, error_collector) - # The warning appears only once. -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.Results().count( - 'Do not use namespace using-directives. ' -@@ -3234,7 +3234,7 @@ class CpplintTest(CpplintTestBase): - cpplint.ProcessFileData('foo.cc', 'cc', data.split('\n'), - error_collector) - # The warning appears only once. -- self.assertEquals( -+ self.assertEqual( - int(is_missing_eof), - error_collector.Results().count( - 'Could not find a newline character at the end of the file.' -@@ -3255,7 +3255,7 @@ class CpplintTest(CpplintTestBase): - unidata, - error_collector) - # The warning appears only once. -- self.assertEquals( -+ self.assertEqual( - int(has_invalid_utf8), - error_collector.Results().count( - 'Line contains invalid UTF-8' -@@ -3275,7 +3275,7 @@ class CpplintTest(CpplintTestBase): - cpplint.ProcessFileData('nul.cc', 'cc', - ['// Copyright 2014 Your Company.', - '\0', ''], error_collector) -- self.assertEquals( -+ self.assertEqual( - error_collector.Results(), - 'Line contains NUL byte. [readability/nul] [5]') - -@@ -3293,7 +3293,7 @@ class CpplintTest(CpplintTestBase): - unidata, - ''], - error_collector) -- self.assertEquals( -+ self.assertEqual( - error_collector.Results(), - ['Line contains invalid UTF-8 (or Unicode replacement character).' - ' [readability/utf8] [5]', -@@ -3343,7 +3343,7 @@ class CpplintTest(CpplintTestBase): - '', '', '', '', - '}'], - error_collector) -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'Redundant blank line at the end of a code block should be deleted.' - ' [whitespace/blank_line] [3]')) - -@@ -3360,7 +3360,7 @@ class CpplintTest(CpplintTestBase): - '', # Warning on this line - '}'], - error_collector) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - 'Redundant blank line at the end of a code block should be deleted.' - ' [whitespace/blank_line] [3]')) - -@@ -3373,10 +3373,10 @@ class CpplintTest(CpplintTestBase): - '', - '}'], - error_collector) -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'Redundant blank line at the start of a code block should be deleted.' - ' [whitespace/blank_line] [2]')) -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'Redundant blank line at the end of a code block should be deleted.' - ' [whitespace/blank_line] [3]')) - -@@ -3409,10 +3409,10 @@ class CpplintTest(CpplintTestBase): - ' int a;\\', - '};'], - error_collector) -- self.assertEquals(2, error_collector.Results().count( -+ self.assertEqual(2, error_collector.Results().count( - '"private:" should be preceded by a blank line' - ' [whitespace/blank_line] [3]')) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - '"protected:" should be preceded by a blank line' - ' [whitespace/blank_line] [3]')) - -@@ -3430,13 +3430,13 @@ class CpplintTest(CpplintTestBase): - ' };', - '};'], - error_collector) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - 'Do not leave a blank line after "public:"' - ' [whitespace/blank_line] [3]')) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - 'Do not leave a blank line after "protected:"' - ' [whitespace/blank_line] [3]')) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - 'Do not leave a blank line after "private:"' - ' [whitespace/blank_line] [3]')) - -@@ -3451,7 +3451,7 @@ class CpplintTest(CpplintTestBase): - ')"};', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - - def testElseOnSameLineAsClosingBraces(self): - error_collector = ErrorCollector(self.assert_) -@@ -3464,7 +3464,7 @@ class CpplintTest(CpplintTestBase): - '', - '}'], - error_collector) -- self.assertEquals(2, error_collector.Results().count( -+ self.assertEqual(2, error_collector.Results().count( - 'An else should appear on the same line as the preceding }' - ' [whitespace/newline] [4]')) - -@@ -3478,7 +3478,7 @@ class CpplintTest(CpplintTestBase): - '', - '}'], - error_collector) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - 'An else should appear on the same line as the preceding }' - ' [whitespace/newline] [4]')) - -@@ -3489,7 +3489,7 @@ class CpplintTest(CpplintTestBase): - '}', - 'else_function();'], - error_collector) -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'An else should appear on the same line as the preceding }' - ' [whitespace/newline] [4]')) - -@@ -3502,7 +3502,7 @@ class CpplintTest(CpplintTestBase): - '}', - 'sum += MathUtil::SafeIntRound(x); x += 0.1;'], - error_collector) -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'More than one command on the same line [whitespace/newline] [0]')) - - old_verbose_level = cpplint._cpplint_state.verbose_level -@@ -3521,7 +3521,7 @@ class CpplintTest(CpplintTestBase): - '[](const int i) { return i; };'], - error_collector) - cpplint._cpplint_state.verbose_level = old_verbose_level -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'More than one command on the same line [whitespace/newline] [0]')) - - error_collector = ErrorCollector(self.assert_) -@@ -3533,7 +3533,7 @@ class CpplintTest(CpplintTestBase): - '[](const int i) { return i > 0; });'], - error_collector) - cpplint._cpplint_state.verbose_level = old_verbose_level -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'More than one command on the same line [whitespace/newline] [0]')) - - error_collector = ErrorCollector(self.assert_) -@@ -3545,7 +3545,7 @@ class CpplintTest(CpplintTestBase): - 'this->ReadUnlock(); });'], - error_collector) - cpplint._cpplint_state.verbose_level = old_verbose_level -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'More than one command on the same line [whitespace/newline] [0]')) - - error_collector = ErrorCollector(self.assert_) -@@ -3557,7 +3557,7 @@ class CpplintTest(CpplintTestBase): - 'this->ReadUnlock(); }, object);'], - error_collector) - cpplint._cpplint_state.verbose_level = old_verbose_level -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'More than one command on the same line [whitespace/newline] [0]')) - - def testEndOfNamespaceComments(self): -@@ -3604,26 +3604,26 @@ class CpplintTest(CpplintTestBase): - ['} /* namespace c_style. */ \\', - ';'], - error_collector) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - 'Namespace should be terminated with "// namespace expected"' - ' [readability/namespace] [5]')) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - 'Namespace should be terminated with "// namespace outer"' - ' [readability/namespace] [5]')) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - 'Namespace should be terminated with "// namespace nested"' - ' [readability/namespace] [5]')) -- self.assertEquals(3, error_collector.Results().count( -+ self.assertEqual(3, error_collector.Results().count( - 'Anonymous namespace should be terminated with "// namespace"' - ' [readability/namespace] [5]')) -- self.assertEquals(2, error_collector.Results().count( -+ self.assertEqual(2, error_collector.Results().count( - 'Anonymous namespace should be terminated with "// namespace" or' - ' "// anonymous namespace"' - ' [readability/namespace] [5]')) -- self.assertEquals(1, error_collector.Results().count( -+ self.assertEqual(1, error_collector.Results().count( - 'Namespace should be terminated with "// namespace missing_comment"' - ' [readability/namespace] [5]')) -- self.assertEquals(0, error_collector.Results().count( -+ self.assertEqual(0, error_collector.Results().count( - 'Namespace should be terminated with "// namespace no_warning"' - ' [readability/namespace] [5]')) - -@@ -4088,38 +4088,38 @@ class CpplintTest(CpplintTestBase): - ['--filter=+a,b,-c']) - self.assertRaises(SystemExit, cpplint.ParseArguments, ['--headers']) - -- self.assertEquals(['foo.cc'], cpplint.ParseArguments(['foo.cc'])) -- self.assertEquals(old_output_format, cpplint._cpplint_state.output_format) -- self.assertEquals(old_verbose_level, cpplint._cpplint_state.verbose_level) -+ self.assertEqual(['foo.cc'], cpplint.ParseArguments(['foo.cc'])) -+ self.assertEqual(old_output_format, cpplint._cpplint_state.output_format) -+ self.assertEqual(old_verbose_level, cpplint._cpplint_state.verbose_level) - -- self.assertEquals(['foo.cc'], -+ self.assertEqual(['foo.cc'], - cpplint.ParseArguments(['--v=1', 'foo.cc'])) -- self.assertEquals(1, cpplint._cpplint_state.verbose_level) -- self.assertEquals(['foo.h'], -+ self.assertEqual(1, cpplint._cpplint_state.verbose_level) -+ self.assertEqual(['foo.h'], - cpplint.ParseArguments(['--v=3', 'foo.h'])) -- self.assertEquals(3, cpplint._cpplint_state.verbose_level) -- self.assertEquals(['foo.cpp'], -+ self.assertEqual(3, cpplint._cpplint_state.verbose_level) -+ self.assertEqual(['foo.cpp'], - cpplint.ParseArguments(['--verbose=5', 'foo.cpp'])) -- self.assertEquals(5, cpplint._cpplint_state.verbose_level) -+ self.assertEqual(5, cpplint._cpplint_state.verbose_level) - self.assertRaises(ValueError, - cpplint.ParseArguments, ['--v=f', 'foo.cc']) - -- self.assertEquals(['foo.cc'], -+ self.assertEqual(['foo.cc'], - cpplint.ParseArguments(['--output=emacs', 'foo.cc'])) -- self.assertEquals('emacs', cpplint._cpplint_state.output_format) -- self.assertEquals(['foo.h'], -+ self.assertEqual('emacs', cpplint._cpplint_state.output_format) -+ self.assertEqual(['foo.h'], - cpplint.ParseArguments(['--output=vs7', 'foo.h'])) -- self.assertEquals('vs7', cpplint._cpplint_state.output_format) -+ self.assertEqual('vs7', cpplint._cpplint_state.output_format) - self.assertRaises(SystemExit, - cpplint.ParseArguments, ['--output=blah', 'foo.cc']) - - filt = '-,+whitespace,-whitespace/indent' -- self.assertEquals(['foo.h'], -+ self.assertEqual(['foo.h'], - cpplint.ParseArguments(['--filter='+filt, 'foo.h'])) -- self.assertEquals(['-', '+whitespace', '-whitespace/indent'], -+ self.assertEqual(['-', '+whitespace', '-whitespace/indent'], - cpplint._cpplint_state.filters) - -- self.assertEquals(['foo.cc', 'foo.h'], -+ self.assertEqual(['foo.cc', 'foo.h'], - cpplint.ParseArguments(['foo.cc', 'foo.h'])) - - cpplint._hpp_headers = old_headers -@@ -4174,7 +4174,7 @@ class CpplintTest(CpplintTestBase): - os.path.join('src', 'nested', 'three.cpp')] - cpplint._excludes = None - actual = cpplint.ParseArguments(['--recursive', 'one.cpp', 'src']) -- self.assertEquals(set(expected), set(actual)) -+ self.assertEqual(set(expected), set(actual)) - finally: - os.chdir(working_dir) - shutil.rmtree(temp_dir) -@@ -4193,7 +4193,7 @@ class CpplintTest(CpplintTestBase): - cpplint._excludes = None - actual = cpplint.ParseArguments(['--recursive', '--extensions=cpp', - 'one.cpp', 'src']) -- self.assertEquals(set(expected), set(actual)) -+ self.assertEqual(set(expected), set(actual)) - finally: - os.chdir(working_dir) - shutil.rmtree(temp_dir) -@@ -4223,23 +4223,23 @@ class CpplintTest(CpplintTestBase): - ] - cpplint._excludes = None - actual = cpplint.ParseArguments(['src']) -- self.assertEquals(set(['src']), set(actual)) -+ self.assertEqual(set(['src']), set(actual)) - - cpplint._excludes = None - actual = cpplint.ParseArguments(['--recursive', 'src']) -- self.assertEquals(set(expected), set(actual)) -+ self.assertEqual(set(expected), set(actual)) - - expected = [os.path.join('src', 'one.cc')] - cpplint._excludes = None - actual = cpplint.ParseArguments(['--recursive', - '--exclude=src{0}t*'.format(os.sep), 'src']) -- self.assertEquals(set(expected), set(actual)) -+ self.assertEqual(set(expected), set(actual)) - - expected = [os.path.join('src', 'one.cc')] - cpplint._excludes = None - actual = cpplint.ParseArguments(['--recursive', - '--exclude=src/two.cc', '--exclude=src/three.cc', 'src']) -- self.assertEquals(set(expected), set(actual)) -+ self.assertEqual(set(expected), set(actual)) - - expected = set([ - os.path.join('src2', 'one.cc'), -@@ -4249,7 +4249,7 @@ class CpplintTest(CpplintTestBase): - cpplint._excludes = None - actual = cpplint.ParseArguments(['--recursive', - '--exclude=src', '.']) -- self.assertEquals(expected, set(actual)) -+ self.assertEqual(expected, set(actual)) - finally: - os.chdir(working_dir) - shutil.rmtree(temp_dir) -@@ -4262,7 +4262,7 @@ class CpplintTest(CpplintTestBase): - '' - '' - '') -- self.assertEquals(expected, cpplint._cpplint_state.FormatJUnitXML()) -+ self.assertEqual(expected, cpplint._cpplint_state.FormatJUnitXML()) - - cpplint._cpplint_state._junit_errors = ['ErrMsg1'] - cpplint._cpplint_state._junit_failures = [] -@@ -4270,7 +4270,7 @@ class CpplintTest(CpplintTestBase): - '' - 'ErrMsg1' - '') -- self.assertEquals(expected, cpplint._cpplint_state.FormatJUnitXML()) -+ self.assertEqual(expected, cpplint._cpplint_state.FormatJUnitXML()) - - cpplint._cpplint_state._junit_errors = ['ErrMsg1', 'ErrMsg2'] - cpplint._cpplint_state._junit_failures = [] -@@ -4278,7 +4278,7 @@ class CpplintTest(CpplintTestBase): - '' - 'ErrMsg1\nErrMsg2' - '') -- self.assertEquals(expected, cpplint._cpplint_state.FormatJUnitXML()) -+ self.assertEqual(expected, cpplint._cpplint_state.FormatJUnitXML()) - - cpplint._cpplint_state._junit_errors = ['ErrMsg'] - cpplint._cpplint_state._junit_failures = [ -@@ -4288,7 +4288,7 @@ class CpplintTest(CpplintTestBase): - 'ErrMsg' - '5: FailMsg [category/subcategory] ' - '[3]') -- self.assertEquals(expected, cpplint._cpplint_state.FormatJUnitXML()) -+ self.assertEqual(expected, cpplint._cpplint_state.FormatJUnitXML()) - - cpplint._cpplint_state._junit_errors = [] - cpplint._cpplint_state._junit_failures = [ -@@ -4301,7 +4301,7 @@ class CpplintTest(CpplintTestBase): - ' [3]\n19: FailMsg3 [category/subcategory] [3]' - '99: FailMsg2 ' - '[category/subcategory] [3]') -- self.assertEquals(expected, cpplint._cpplint_state.FormatJUnitXML()) -+ self.assertEqual(expected, cpplint._cpplint_state.FormatJUnitXML()) - - cpplint._cpplint_state._junit_errors = ['&'] - cpplint._cpplint_state._junit_failures = [ -@@ -4312,16 +4312,16 @@ class CpplintTest(CpplintTestBase): - '5: ' - '&</failure> [category/subcategory] [3]' - '') -- self.assertEquals(expected, cpplint._cpplint_state.FormatJUnitXML()) -+ self.assertEqual(expected, cpplint._cpplint_state.FormatJUnitXML()) - - finally: - cpplint._cpplint_state._junit_errors = [] - cpplint._cpplint_state._junit_failures = [] - - def testQuiet(self): -- self.assertEquals(cpplint._cpplint_state.quiet, False) -+ self.assertEqual(cpplint._cpplint_state.quiet, False) - cpplint.ParseArguments(['--quiet', 'one.cpp']) -- self.assertEquals(cpplint._cpplint_state.quiet, True) -+ self.assertEqual(cpplint._cpplint_state.quiet, True) - - def testLineLength(self): - old_line_length = cpplint._line_length -@@ -4390,7 +4390,7 @@ class CpplintTest(CpplintTestBase): - '#endif', - ''], - error_collector) -- self.assertEquals( -+ self.assertEqual( - ['"path/duplicate.h" already included at path/self.cc:3 ' - '[build/include] [4]'], - error_collector.ResultList()) -@@ -4499,7 +4499,7 @@ class CpplintTest(CpplintTestBase): - # No guard at all: expect one error. - error_collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData(file_path, 'h', [], error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - 'No #ifndef header guard found, suggested CPP variable is: %s' -@@ -4512,13 +4512,13 @@ class CpplintTest(CpplintTestBase): - ['// Copyright 2014 Your Company.', - '// NOLINT(build/header_guard)', ''], - error_collector) -- self.assertEquals([], error_collector.ResultList()) -+ self.assertEqual([], error_collector.ResultList()) - - # Wrong guard - error_collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef FOO_H', '#define FOO_H'], error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - '#ifndef header guard has wrong style, please use: %s' -@@ -4529,7 +4529,7 @@ class CpplintTest(CpplintTestBase): - error_collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData(file_path, 'h', - ['#ifndef %s' % expected_guard], error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - 'No #ifndef header guard found, suggested CPP variable is: %s' -@@ -4542,7 +4542,7 @@ class CpplintTest(CpplintTestBase): - ['#ifndef %s' % expected_guard, - '#define FOO_H'], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - 'No #ifndef header guard found, suggested CPP variable is: %s' -@@ -4556,7 +4556,7 @@ class CpplintTest(CpplintTestBase): - '#define %s' % expected_guard, - ''], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - '#endif line should be "#endif // %s"' -@@ -4570,7 +4570,7 @@ class CpplintTest(CpplintTestBase): - '#define %s' % expected_guard, - '#endif'], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - '#endif line should be "#endif // %s"' -@@ -4584,7 +4584,7 @@ class CpplintTest(CpplintTestBase): - '#define %s_' % expected_guard, - '#endif'], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - '#endif line should be "#endif // %s"' -@@ -4623,7 +4623,7 @@ class CpplintTest(CpplintTestBase): - '#define %s_' % expected_guard, - '#endif // %s_' % expected_guard], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - '#ifndef header guard has wrong style, please use: %s' -@@ -4639,13 +4639,13 @@ class CpplintTest(CpplintTestBase): - '#define FOO', - '#endif // FOO'], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - '#ifndef header guard has wrong style, please use: %s' - ' [build/header_guard] [5]' % expected_guard), - error_collector.ResultList()) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - '#endif line should be "#endif // %s"' -@@ -4659,13 +4659,13 @@ class CpplintTest(CpplintTestBase): - '#define FOO', - '#endif // FOO NOLINT'], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 0, - error_collector.ResultList().count( - '#ifndef header guard has wrong style, please use: %s' - ' [build/header_guard] [5]' % expected_guard), - error_collector.ResultList()) -- self.assertEquals( -+ self.assertEqual( - 0, - error_collector.ResultList().count( - '#endif line should be "#endif // %s"' -@@ -4678,7 +4678,7 @@ class CpplintTest(CpplintTestBase): - cpplint.ProcessFileData(test_file, 'h', - ['// Copyright 2014 Your Company.', ''], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - 'No #ifndef header guard found, suggested CPP variable is: %s' -@@ -4694,13 +4694,13 @@ class CpplintTest(CpplintTestBase): - '#define FOO', - '#endif // FOO'], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - '#ifndef header guard has wrong style, please use: %s' - ' [build/header_guard] [5]' % expected_guard), - error_collector.ResultList()) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count( - '#endif line should be "#endif // %s"' -@@ -4712,7 +4712,7 @@ class CpplintTest(CpplintTestBase): - cpplint.ProcessFileData('mydir/foo.h', 'h', - ['// Copyright 2014 Your Company.', '#pragma once', ''], - error_collector) -- self.assertEquals([], error_collector.ResultList()) -+ self.assertEqual([], error_collector.ResultList()) - - def testBuildHeaderGuardWithRoot(self): - temp_directory = os.path.realpath(tempfile.mkdtemp()) -@@ -4743,7 +4743,7 @@ class CpplintTest(CpplintTestBase): - # when the root directory of the repository is properly deduced. - return - -- self.assertEquals('CPPLINT_CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - # - # test --root flags: -@@ -4753,7 +4753,7 @@ class CpplintTest(CpplintTestBase): - # left-strip the header guard by using a root dir inside of the repo dir. - # relative directory - cpplint._root = 'cpplint' -- self.assertEquals('CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - - nested_header_directory = os.path.join(header_directory, "nested") -@@ -4763,22 +4763,22 @@ class CpplintTest(CpplintTestBase): - - cpplint._root = os.path.join('cpplint', 'nested') - actual = cpplint.GetHeaderGuardCPPVariable(nested_file_path) -- self.assertEquals('CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_TEST_HEADER_H_', - actual) - - # absolute directory - # (note that CPPLINT.cfg root=setting is always made absolute) - cpplint._root = header_directory -- self.assertEquals('CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - - cpplint._root = nested_header_directory -- self.assertEquals('CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(nested_file_path)) - - # --root flag is ignored if an non-existent directory is specified. - cpplint._root = 'NON_EXISTENT_DIR' -- self.assertEquals('CPPLINT_CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - - # prepend to the header guard by using a root dir that is more outer -@@ -4795,7 +4795,7 @@ class CpplintTest(CpplintTestBase): - # do not hardcode the 'styleguide' repository name, it could be anything. - expected_prefix = re.sub(r'[^a-zA-Z0-9]', '_', styleguide_dir_name).upper() + '_' - # do not have 'styleguide' repo in '/' -- self.assertEquals('%sCPPLINT_CPPLINT_TEST_HEADER_H_' % (expected_prefix), -+ self.assertEqual('%sCPPLINT_CPPLINT_TEST_HEADER_H_' % (expected_prefix), - cpplint.GetHeaderGuardCPPVariable(file_path)) - - # To run the 'relative path' tests, we must be in the directory of this test file. -@@ -4806,13 +4806,13 @@ class CpplintTest(CpplintTestBase): - styleguide_rel_path = os.path.relpath(styleguide_path, this_files_path) - # '..' - cpplint._root = styleguide_rel_path -- self.assertEquals('CPPLINT_CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - - styleguide_rel_path = os.path.relpath(styleguide_parent_path, - this_files_path) # '../..' - cpplint._root = styleguide_rel_path -- self.assertEquals('%sCPPLINT_CPPLINT_TEST_HEADER_H_' % (expected_prefix), -+ self.assertEqual('%sCPPLINT_CPPLINT_TEST_HEADER_H_' % (expected_prefix), - cpplint.GetHeaderGuardCPPVariable(file_path)) - - cpplint._root = None -@@ -4906,19 +4906,19 @@ class CpplintTest(CpplintTestBase): - shutil.rmtree(temp_directory) - - def testPathSplitToList(self): -- self.assertEquals([''], -+ self.assertEqual([''], - cpplint.PathSplitToList(os.path.join(''))) - -- self.assertEquals(['.'], -+ self.assertEqual(['.'], - cpplint.PathSplitToList(os.path.join('.'))) - -- self.assertEquals(['..'], -+ self.assertEqual(['..'], - cpplint.PathSplitToList(os.path.join('..'))) - -- self.assertEquals(['..', 'a', 'b'], -+ self.assertEqual(['..', 'a', 'b'], - cpplint.PathSplitToList(os.path.join('..', 'a', 'b'))) - -- self.assertEquals(['a', 'b', 'c', 'd'], -+ self.assertEqual(['a', 'b', 'c', 'd'], - cpplint.PathSplitToList(os.path.join('a', 'b', 'c', 'd'))) - - def testBuildHeaderGuardWithRepository(self): -@@ -4934,31 +4934,31 @@ class CpplintTest(CpplintTestBase): - open(file_path, 'a').close() - - # search for .svn if _repository is not specified -- self.assertEquals('TRUNK_CPPLINT_CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('TRUNK_CPPLINT_CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - - # use the provided repository root for header guards - cpplint._repository = os.path.relpath(trunk_dir) -- self.assertEquals('CPPLINT_CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - cpplint._repository = os.path.abspath(trunk_dir) -- self.assertEquals('CPPLINT_CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - - # ignore _repository if it doesnt exist - cpplint._repository = os.path.join(temp_directory, 'NON_EXISTANT') -- self.assertEquals('TRUNK_CPPLINT_CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('TRUNK_CPPLINT_CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - - # ignore _repository if it exists but file isn't in it - cpplint._repository = os.path.relpath(temp_directory2) -- self.assertEquals('TRUNK_CPPLINT_CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('TRUNK_CPPLINT_CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - - # _root should be relative to _repository - cpplint._repository = os.path.relpath(trunk_dir) - cpplint._root = 'cpplint' -- self.assertEquals('CPPLINT_TEST_HEADER_H_', -+ self.assertEqual('CPPLINT_TEST_HEADER_H_', - cpplint.GetHeaderGuardCPPVariable(file_path)) - - finally: -@@ -4996,7 +4996,7 @@ class CpplintTest(CpplintTestBase): - r'fprintf(file, "\(%d", value);', - r'vsnprintf(buffer, sizeof(buffer), "\\\{%d", ap);'], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 4, - error_collector.Results().count( - '%, [, (, and { are undefined character escapes. Unescape them.' -@@ -5011,7 +5011,7 @@ class CpplintTest(CpplintTestBase): - r'printf(R"(\[%s)", R"(\])");', - ''], - error_collector) -- self.assertEquals('', error_collector.Results()) -+ self.assertEqual('', error_collector.Results()) - - def testRuntimePrintfFormat(self): - self.TestLint( -@@ -5123,7 +5123,7 @@ class CpplintTest(CpplintTestBase): - # There should be a copyright message in the first 10 lines - error_collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData(file_path, 'cc', [], error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count(legal_copyright_message)) - -@@ -5132,7 +5132,7 @@ class CpplintTest(CpplintTestBase): - file_path, 'cc', - ['' for unused_i in range(10)] + [copyright_line], - error_collector) -- self.assertEquals( -+ self.assertEqual( - 1, - error_collector.ResultList().count(legal_copyright_message)) - -@@ -5182,7 +5182,7 @@ class Cxx11Test(CpplintTestBase): - collector = ErrorCollector(self.assert_) - cpplint.ProcessFileData(filename, extension, lines, collector) - error_list = collector.ResultList() -- self.assertEquals(count, len(error_list), error_list) -+ self.assertEqual(count, len(error_list), error_list) - - def TestCxx11Feature(self, code, expected_error): - lines = code.split('\n') -@@ -5190,7 +5190,7 @@ class Cxx11Test(CpplintTestBase): - cpplint.RemoveMultiLineComments('foo.h', lines, collector) - clean_lines = cpplint.CleansedLines(lines) - cpplint.FlagCxx11Features('foo.cc', clean_lines, 0, collector) -- self.assertEquals(expected_error, collector.Results()) -+ self.assertEqual(expected_error, collector.Results()) - - def testBlockedHeaders(self): - self.TestCxx11Feature('#include ', -@@ -5248,7 +5248,7 @@ class Cxx14Test(CpplintTestBase): - cpplint.RemoveMultiLineComments('foo.h', lines, collector) - clean_lines = cpplint.CleansedLines(lines) - cpplint.FlagCxx14Features('foo.cc', clean_lines, 0, collector) -- self.assertEquals(expected_error, collector.Results()) -+ self.assertEqual(expected_error, collector.Results()) - - def testBlockedHeaders(self): - self.TestCxx14Feature('#include ', -@@ -5269,17 +5269,17 @@ class CleansedLinesTest(unittest.TestCas - 'Line 5 "foo"'] - - clean_lines = cpplint.CleansedLines(lines) -- self.assertEquals(lines, clean_lines.raw_lines) -- self.assertEquals(5, clean_lines.NumLines()) -+ self.assertEqual(lines, clean_lines.raw_lines) -+ self.assertEqual(5, clean_lines.NumLines()) - -- self.assertEquals(['Line 1', -+ self.assertEqual(['Line 1', - 'Line 2', - 'Line 3', - 'Line 4', - 'Line 5 "foo"'], - clean_lines.lines) - -- self.assertEquals(['Line 1', -+ self.assertEqual(['Line 1', - 'Line 2', - 'Line 3', - 'Line 4', -@@ -5288,48 +5288,48 @@ class CleansedLinesTest(unittest.TestCas - - def testInitEmpty(self): - clean_lines = cpplint.CleansedLines([]) -- self.assertEquals([], clean_lines.raw_lines) -- self.assertEquals(0, clean_lines.NumLines()) -+ self.assertEqual([], clean_lines.raw_lines) -+ self.assertEqual(0, clean_lines.NumLines()) - - def testCollapseStrings(self): - collapse = cpplint.CleansedLines._CollapseStrings -- self.assertEquals('""', collapse('""')) # "" (empty) -- self.assertEquals('"""', collapse('"""')) # """ (bad) -- self.assertEquals('""', collapse('"xyz"')) # "xyz" (string) -- self.assertEquals('""', collapse('"\\\""')) # "\"" (string) -- self.assertEquals('""', collapse('"\'"')) # "'" (string) -- self.assertEquals('"\"', collapse('"\"')) # "\" (bad) -- self.assertEquals('""', collapse('"\\\\"')) # "\\" (string) -- self.assertEquals('"', collapse('"\\\\\\"')) # "\\\" (bad) -- self.assertEquals('""', collapse('"\\\\\\\\"')) # "\\\\" (string) -- -- self.assertEquals('\'\'', collapse('\'\'')) # '' (empty) -- self.assertEquals('\'\'', collapse('\'a\'')) # 'a' (char) -- self.assertEquals('\'\'', collapse('\'\\\'\'')) # '\'' (char) -- self.assertEquals('\'', collapse('\'\\\'')) # '\' (bad) -- self.assertEquals('', collapse('\\012')) # '\012' (char) -- self.assertEquals('', collapse('\\xfF0')) # '\xfF0' (char) -- self.assertEquals('', collapse('\\n')) # '\n' (char) -- self.assertEquals(r'\#', collapse('\\#')) # '\#' (bad) -- -- self.assertEquals('"" + ""', collapse('"\'" + "\'"')) -- self.assertEquals("'', ''", collapse("'\"', '\"'")) -- self.assertEquals('""[0b10]', collapse('"a\'b"[0b1\'0]')) -- -- self.assertEquals('42', collapse("4'2")) -- self.assertEquals('0b0101', collapse("0b0'1'0'1")) -- self.assertEquals('1048576', collapse("1'048'576")) -- self.assertEquals('0X100000', collapse("0X10'0000")) -- self.assertEquals('0004000000', collapse("0'004'000'000")) -- self.assertEquals('1.602176565e-19', collapse("1.602'176'565e-19")) -- self.assertEquals('\'\' + 0xffff', collapse("'i' + 0xf'f'f'f")) -- self.assertEquals('sizeof\'\' == 1', collapse("sizeof'x' == 1")) -- self.assertEquals('0x.03p100', collapse('0x.0\'3p1\'0\'0')) -- self.assertEquals('123.45', collapse('1\'23.4\'5')) -+ self.assertEqual('""', collapse('""')) # "" (empty) -+ self.assertEqual('"""', collapse('"""')) # """ (bad) -+ self.assertEqual('""', collapse('"xyz"')) # "xyz" (string) -+ self.assertEqual('""', collapse('"\\\""')) # "\"" (string) -+ self.assertEqual('""', collapse('"\'"')) # "'" (string) -+ self.assertEqual('"\"', collapse('"\"')) # "\" (bad) -+ self.assertEqual('""', collapse('"\\\\"')) # "\\" (string) -+ self.assertEqual('"', collapse('"\\\\\\"')) # "\\\" (bad) -+ self.assertEqual('""', collapse('"\\\\\\\\"')) # "\\\\" (string) -+ -+ self.assertEqual('\'\'', collapse('\'\'')) # '' (empty) -+ self.assertEqual('\'\'', collapse('\'a\'')) # 'a' (char) -+ self.assertEqual('\'\'', collapse('\'\\\'\'')) # '\'' (char) -+ self.assertEqual('\'', collapse('\'\\\'')) # '\' (bad) -+ self.assertEqual('', collapse('\\012')) # '\012' (char) -+ self.assertEqual('', collapse('\\xfF0')) # '\xfF0' (char) -+ self.assertEqual('', collapse('\\n')) # '\n' (char) -+ self.assertEqual(r'\#', collapse('\\#')) # '\#' (bad) -+ -+ self.assertEqual('"" + ""', collapse('"\'" + "\'"')) -+ self.assertEqual("'', ''", collapse("'\"', '\"'")) -+ self.assertEqual('""[0b10]', collapse('"a\'b"[0b1\'0]')) -+ -+ self.assertEqual('42', collapse("4'2")) -+ self.assertEqual('0b0101', collapse("0b0'1'0'1")) -+ self.assertEqual('1048576', collapse("1'048'576")) -+ self.assertEqual('0X100000', collapse("0X10'0000")) -+ self.assertEqual('0004000000', collapse("0'004'000'000")) -+ self.assertEqual('1.602176565e-19', collapse("1.602'176'565e-19")) -+ self.assertEqual('\'\' + 0xffff', collapse("'i' + 0xf'f'f'f")) -+ self.assertEqual('sizeof\'\' == 1', collapse("sizeof'x' == 1")) -+ self.assertEqual('0x.03p100', collapse('0x.0\'3p1\'0\'0')) -+ self.assertEqual('123.45', collapse('1\'23.4\'5')) - -- self.assertEquals('StringReplace(body, "", "");', -+ self.assertEqual('StringReplace(body, "", "");', - collapse('StringReplace(body, "\\\\", "\\\\\\\\");')) -- self.assertEquals('\'\' ""', -+ self.assertEqual('\'\' ""', - collapse('\'"\' "foo"')) - - -@@ -5446,7 +5446,7 @@ class OrderOfIncludesTest(CpplintTestBas - classify_include(file_info('foo/foo.cc'), - 'string', - False)) -- self.assertEquals(cpplint._OTHER_HEADER, -+ self.assertEqual(cpplint._OTHER_HEADER, - classify_include(file_info('foo/foo.cc'), - 'boost/any.hpp', - True)) -@@ -5662,7 +5662,7 @@ class CheckForFunctionLengthsTest(Cpplin - code: C++ source code expected to generate a warning message. - expected_message: Message expected to be generated by the C++ code. - """ -- self.assertEquals(expected_message, -+ self.assertEqual(expected_message, - self.PerformFunctionLengthsCheck(code)) - - def TriggerLines(self, error_level): -@@ -6040,7 +6040,7 @@ class CloseExpressionTest(unittest.TestC - (18, 47, 20, 1)] - for p in positions: - (_, line, column) = cpplint.CloseExpression(self.lines, p[0], p[1]) -- self.assertEquals((p[2], p[3]), (line, column)) -+ self.assertEqual((p[2], p[3]), (line, column)) - - def testReverseCloseExpression(self): - # List of positions to test: -@@ -6060,7 +6060,7 @@ class CloseExpressionTest(unittest.TestC - (20, 0, 18, 47)] - for p in positions: - (_, line, column) = cpplint.ReverseCloseExpression(self.lines, p[0], p[1]) -- self.assertEquals((p[2], p[3]), (line, column)) -+ self.assertEqual((p[2], p[3]), (line, column)) - - - class NestingStateTest(unittest.TestCase): -@@ -6077,155 +6077,155 @@ class NestingStateTest(unittest.TestCase - - def testEmpty(self): - self.UpdateWithLines([]) -- self.assertEquals(self.nesting_state.stack, []) -+ self.assertEqual(self.nesting_state.stack, []) - - def testNamespace(self): - self.UpdateWithLines(['namespace {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], - cpplint._NamespaceInfo)) - self.assertTrue(self.nesting_state.stack[0].seen_open_brace) -- self.assertEquals(self.nesting_state.stack[0].name, '') -+ self.assertEqual(self.nesting_state.stack[0].name, '') - - self.UpdateWithLines(['namespace outer { namespace inner']) -- self.assertEquals(len(self.nesting_state.stack), 3) -+ self.assertEqual(len(self.nesting_state.stack), 3) - self.assertTrue(self.nesting_state.stack[0].seen_open_brace) - self.assertTrue(self.nesting_state.stack[1].seen_open_brace) - self.assertFalse(self.nesting_state.stack[2].seen_open_brace) -- self.assertEquals(self.nesting_state.stack[0].name, '') -- self.assertEquals(self.nesting_state.stack[1].name, 'outer') -- self.assertEquals(self.nesting_state.stack[2].name, 'inner') -+ self.assertEqual(self.nesting_state.stack[0].name, '') -+ self.assertEqual(self.nesting_state.stack[1].name, 'outer') -+ self.assertEqual(self.nesting_state.stack[2].name, 'inner') - - self.UpdateWithLines(['{']) - self.assertTrue(self.nesting_state.stack[2].seen_open_brace) - - self.UpdateWithLines(['}', '}}']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - def testDecoratedClass(self): - self.UpdateWithLines(['class Decorated_123 API A {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'A') -+ self.assertEqual(self.nesting_state.stack[0].name, 'A') - self.assertFalse(self.nesting_state.stack[0].is_derived) -- self.assertEquals(self.nesting_state.stack[0].class_indent, 0) -+ self.assertEqual(self.nesting_state.stack[0].class_indent, 0) - self.UpdateWithLines(['}']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - def testInnerClass(self): - self.UpdateWithLines(['class A::B::C {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'A::B::C') -+ self.assertEqual(self.nesting_state.stack[0].name, 'A::B::C') - self.assertFalse(self.nesting_state.stack[0].is_derived) -- self.assertEquals(self.nesting_state.stack[0].class_indent, 0) -+ self.assertEqual(self.nesting_state.stack[0].class_indent, 0) - self.UpdateWithLines(['}']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - def testClass(self): - self.UpdateWithLines(['class A {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'A') -+ self.assertEqual(self.nesting_state.stack[0].name, 'A') - self.assertFalse(self.nesting_state.stack[0].is_derived) -- self.assertEquals(self.nesting_state.stack[0].class_indent, 0) -+ self.assertEqual(self.nesting_state.stack[0].class_indent, 0) - - self.UpdateWithLines(['};', - 'struct B : public A {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'B') -+ self.assertEqual(self.nesting_state.stack[0].name, 'B') - self.assertTrue(self.nesting_state.stack[0].is_derived) - - self.UpdateWithLines(['};', - 'class C', - ': public A {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'C') -+ self.assertEqual(self.nesting_state.stack[0].name, 'C') - self.assertTrue(self.nesting_state.stack[0].is_derived) - - self.UpdateWithLines(['};', - 'template']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - self.UpdateWithLines(['class D {', ' class E {']) -- self.assertEquals(len(self.nesting_state.stack), 2) -+ self.assertEqual(len(self.nesting_state.stack), 2) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'D') -+ self.assertEqual(self.nesting_state.stack[0].name, 'D') - self.assertFalse(self.nesting_state.stack[0].is_derived) - self.assertTrue(isinstance(self.nesting_state.stack[1], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[1].name, 'E') -+ self.assertEqual(self.nesting_state.stack[1].name, 'E') - self.assertFalse(self.nesting_state.stack[1].is_derived) -- self.assertEquals(self.nesting_state.stack[1].class_indent, 2) -- self.assertEquals(self.nesting_state.InnermostClass().name, 'E') -+ self.assertEqual(self.nesting_state.stack[1].class_indent, 2) -+ self.assertEqual(self.nesting_state.InnermostClass().name, 'E') - - self.UpdateWithLines(['}', '}']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - def testClassAccess(self): - self.UpdateWithLines(['class A {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].access, 'private') -+ self.assertEqual(self.nesting_state.stack[0].access, 'private') - - self.UpdateWithLines([' public:']) -- self.assertEquals(self.nesting_state.stack[0].access, 'public') -+ self.assertEqual(self.nesting_state.stack[0].access, 'public') - self.UpdateWithLines([' protracted:']) -- self.assertEquals(self.nesting_state.stack[0].access, 'public') -+ self.assertEqual(self.nesting_state.stack[0].access, 'public') - self.UpdateWithLines([' protected:']) -- self.assertEquals(self.nesting_state.stack[0].access, 'protected') -+ self.assertEqual(self.nesting_state.stack[0].access, 'protected') - self.UpdateWithLines([' private:']) -- self.assertEquals(self.nesting_state.stack[0].access, 'private') -+ self.assertEqual(self.nesting_state.stack[0].access, 'private') - - self.UpdateWithLines([' struct B {']) -- self.assertEquals(len(self.nesting_state.stack), 2) -+ self.assertEqual(len(self.nesting_state.stack), 2) - self.assertTrue(isinstance(self.nesting_state.stack[1], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[1].access, 'public') -- self.assertEquals(self.nesting_state.stack[0].access, 'private') -+ self.assertEqual(self.nesting_state.stack[1].access, 'public') -+ self.assertEqual(self.nesting_state.stack[0].access, 'private') - - self.UpdateWithLines([' protected :']) -- self.assertEquals(self.nesting_state.stack[1].access, 'protected') -- self.assertEquals(self.nesting_state.stack[0].access, 'private') -+ self.assertEqual(self.nesting_state.stack[1].access, 'protected') -+ self.assertEqual(self.nesting_state.stack[0].access, 'private') - - self.UpdateWithLines([' }', '}']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - def testStruct(self): - self.UpdateWithLines(['struct A {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'A') -+ self.assertEqual(self.nesting_state.stack[0].name, 'A') - self.assertFalse(self.nesting_state.stack[0].is_derived) - - self.UpdateWithLines(['}', - 'void Func(struct B arg) {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertFalse(isinstance(self.nesting_state.stack[0], - cpplint._ClassInfo)) - - self.UpdateWithLines(['}']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - def testPreprocessor(self): -- self.assertEquals(len(self.nesting_state.pp_stack), 0) -+ self.assertEqual(len(self.nesting_state.pp_stack), 0) - self.UpdateWithLines(['#if MACRO1']) -- self.assertEquals(len(self.nesting_state.pp_stack), 1) -+ self.assertEqual(len(self.nesting_state.pp_stack), 1) - self.UpdateWithLines(['#endif']) -- self.assertEquals(len(self.nesting_state.pp_stack), 0) -+ self.assertEqual(len(self.nesting_state.pp_stack), 0) - - self.UpdateWithLines(['#ifdef MACRO2']) -- self.assertEquals(len(self.nesting_state.pp_stack), 1) -+ self.assertEqual(len(self.nesting_state.pp_stack), 1) - self.UpdateWithLines(['#else']) -- self.assertEquals(len(self.nesting_state.pp_stack), 1) -+ self.assertEqual(len(self.nesting_state.pp_stack), 1) - self.UpdateWithLines(['#ifdef MACRO3']) -- self.assertEquals(len(self.nesting_state.pp_stack), 2) -+ self.assertEqual(len(self.nesting_state.pp_stack), 2) - self.UpdateWithLines(['#elif MACRO4']) -- self.assertEquals(len(self.nesting_state.pp_stack), 2) -+ self.assertEqual(len(self.nesting_state.pp_stack), 2) - self.UpdateWithLines(['#endif']) -- self.assertEquals(len(self.nesting_state.pp_stack), 1) -+ self.assertEqual(len(self.nesting_state.pp_stack), 1) - self.UpdateWithLines(['#endif']) -- self.assertEquals(len(self.nesting_state.pp_stack), 0) -+ self.assertEqual(len(self.nesting_state.pp_stack), 0) - - self.UpdateWithLines(['#ifdef MACRO5', - 'class A {', -@@ -6234,162 +6234,162 @@ class NestingStateTest(unittest.TestCase - '#else', - 'class C {', - '#endif']) -- self.assertEquals(len(self.nesting_state.pp_stack), 0) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.pp_stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'A') -+ self.assertEqual(self.nesting_state.stack[0].name, 'A') - self.UpdateWithLines(['};']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - self.UpdateWithLines(['class D', - '#ifdef MACRO7']) -- self.assertEquals(len(self.nesting_state.pp_stack), 1) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.pp_stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'D') -+ self.assertEqual(self.nesting_state.stack[0].name, 'D') - self.assertFalse(self.nesting_state.stack[0].is_derived) - - self.UpdateWithLines(['#elif MACRO8', - ': public E']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[0].name, 'D') -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[0].name, 'D') - self.assertTrue(self.nesting_state.stack[0].is_derived) - self.assertFalse(self.nesting_state.stack[0].seen_open_brace) - - self.UpdateWithLines(['#else', - '{']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[0].name, 'D') -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[0].name, 'D') - self.assertFalse(self.nesting_state.stack[0].is_derived) - self.assertTrue(self.nesting_state.stack[0].seen_open_brace) - - self.UpdateWithLines(['#endif']) -- self.assertEquals(len(self.nesting_state.pp_stack), 0) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[0].name, 'D') -+ self.assertEqual(len(self.nesting_state.pp_stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[0].name, 'D') - self.assertFalse(self.nesting_state.stack[0].is_derived) - self.assertFalse(self.nesting_state.stack[0].seen_open_brace) - - self.UpdateWithLines([';']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - def testTemplate(self): - self.UpdateWithLines(['template >']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - self.UpdateWithLines(['class A {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'A') -+ self.assertEqual(self.nesting_state.stack[0].name, 'A') - - self.UpdateWithLines(['};', - 'template class B>', - 'class C']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'C') -+ self.assertEqual(self.nesting_state.stack[0].name, 'C') - self.UpdateWithLines([';']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - self.UpdateWithLines(['class D : public Tmpl']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'D') -+ self.assertEqual(self.nesting_state.stack[0].name, 'D') - - self.UpdateWithLines(['{', '};']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - self.UpdateWithLines(['template ', - 'static void Func() {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertFalse(isinstance(self.nesting_state.stack[0], - cpplint._ClassInfo)) - self.UpdateWithLines(['}', - 'template class K {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'K') -+ self.assertEqual(self.nesting_state.stack[0].name, 'K') - - def testTemplateDefaultArg(self): - self.UpdateWithLines([ - 'template > class unique_ptr {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(self.nesting_state.stack[0], isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) - - def testTemplateInnerClass(self): - self.UpdateWithLines(['class A {', - ' public:']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) - - self.UpdateWithLines([' template ', - ' class C >', - ' : public A {']) -- self.assertEquals(len(self.nesting_state.stack), 2) -+ self.assertEqual(len(self.nesting_state.stack), 2) - self.assertTrue(isinstance(self.nesting_state.stack[1], cpplint._ClassInfo)) - - def testArguments(self): - self.UpdateWithLines(['class A {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'A') -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 0) -+ self.assertEqual(self.nesting_state.stack[0].name, 'A') -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 0) - - self.UpdateWithLines([' void Func(', - ' struct X arg1,']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 1) - self.UpdateWithLines([' struct X *arg2);']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 0) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 0) - - self.UpdateWithLines(['};']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - self.UpdateWithLines(['struct B {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - self.assertTrue(isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) -- self.assertEquals(self.nesting_state.stack[0].name, 'B') -+ self.assertEqual(self.nesting_state.stack[0].name, 'B') - - self.UpdateWithLines(['#ifdef MACRO', - ' void Func(', - ' struct X arg1']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 1) - self.UpdateWithLines(['#else']) - -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 0) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 0) - self.UpdateWithLines([' void Func(', - ' struct X arg1']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 1) - - self.UpdateWithLines(['#endif']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 1) - self.UpdateWithLines([' struct X *arg2);']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 0) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 0) - - self.UpdateWithLines(['};']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - def testInlineAssembly(self): - self.UpdateWithLines(['void CopyRow_SSE2(const uint8* src, uint8* dst,', - ' int count) {']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 0) -- self.assertEquals(self.nesting_state.stack[-1].inline_asm, cpplint._NO_ASM) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 0) -+ self.assertEqual(self.nesting_state.stack[-1].inline_asm, cpplint._NO_ASM) - - self.UpdateWithLines([' asm volatile (']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 1) -- self.assertEquals(self.nesting_state.stack[-1].inline_asm, -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 1) -+ self.assertEqual(self.nesting_state.stack[-1].inline_asm, - cpplint._INSIDE_ASM) - - self.UpdateWithLines([' "sub %0,%1 \\n"', -@@ -6406,40 +6406,40 @@ class NestingStateTest(unittest.TestCase - ' "+r"(count) // %2', - ' :', - ' : "memory", "cc"']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 1) -- self.assertEquals(self.nesting_state.stack[-1].inline_asm, -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 1) -+ self.assertEqual(self.nesting_state.stack[-1].inline_asm, - cpplint._INSIDE_ASM) - - self.UpdateWithLines(['#if defined(__SSE2__)', - ' , "xmm0", "xmm1"']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 1) -- self.assertEquals(self.nesting_state.stack[-1].inline_asm, -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 1) -+ self.assertEqual(self.nesting_state.stack[-1].inline_asm, - cpplint._INSIDE_ASM) - - self.UpdateWithLines(['#endif']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 1) -- self.assertEquals(self.nesting_state.stack[-1].inline_asm, -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 1) -+ self.assertEqual(self.nesting_state.stack[-1].inline_asm, - cpplint._INSIDE_ASM) - - self.UpdateWithLines([' );']) -- self.assertEquals(len(self.nesting_state.stack), 1) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 0) -- self.assertEquals(self.nesting_state.stack[-1].inline_asm, cpplint._END_ASM) -+ self.assertEqual(len(self.nesting_state.stack), 1) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 0) -+ self.assertEqual(self.nesting_state.stack[-1].inline_asm, cpplint._END_ASM) - - self.UpdateWithLines(['__asm {']) -- self.assertEquals(len(self.nesting_state.stack), 2) -- self.assertEquals(self.nesting_state.stack[-1].open_parentheses, 0) -- self.assertEquals(self.nesting_state.stack[-1].inline_asm, -+ self.assertEqual(len(self.nesting_state.stack), 2) -+ self.assertEqual(self.nesting_state.stack[-1].open_parentheses, 0) -+ self.assertEqual(self.nesting_state.stack[-1].inline_asm, - cpplint._BLOCK_ASM) - - self.UpdateWithLines(['}']) -- self.assertEquals(len(self.nesting_state.stack), 1) -+ self.assertEqual(len(self.nesting_state.stack), 1) - - self.UpdateWithLines(['}']) -- self.assertEquals(len(self.nesting_state.stack), 0) -+ self.assertEqual(len(self.nesting_state.stack), 0) - - - class QuietTest(unittest.TestCase): -@@ -6476,7 +6476,7 @@ class QuietTest(unittest.TestCase): - def testNonQuietWithErrors(self): - # This will fail: the test header is missing a copyright and header guard. - (return_code, output) = self._runCppLint() -- self.assertEquals(1, return_code) -+ self.assertEqual(1, return_code) - # Always-on behavior: Print error messages as they come up. - self.assertIn("[legal/copyright]", output) - self.assertIn("[build/header_guard]", output) -@@ -6487,7 +6487,7 @@ class QuietTest(unittest.TestCase): - def testQuietWithErrors(self): - # When there are errors, behavior is identical to not passing --quiet. - (return_code, output) = self._runCppLint('--quiet') -- self.assertEquals(1, return_code) -+ self.assertEqual(1, return_code) - self.assertIn("[legal/copyright]", output) - self.assertIn("[build/header_guard]", output) - # Even though --quiet was used, print these since there were errors. -@@ -6499,7 +6499,7 @@ class QuietTest(unittest.TestCase): - (return_code, output) = self._runCppLint('--filter=' + - '-legal/copyright,' + - '-build/header_guard') -- self.assertEquals(0, return_code, output) -+ self.assertEqual(0, return_code, output) - # No cpplint errors are printed since there were no errors. - self.assertNotIn("[legal/copyright]", output) - self.assertNotIn("[build/header_guard]", output) -@@ -6513,7 +6513,7 @@ class QuietTest(unittest.TestCase): - '--filter=' + - '-legal/copyright,' + - '-build/header_guard') -- self.assertEquals(0, return_code, output) -+ self.assertEqual(0, return_code, output) - # No cpplint errors are printed since there were no errors. - self.assertNotIn("[legal/copyright]", output) - self.assertNotIn("[build/header_guard]", output) -@@ -6522,11 +6522,11 @@ class QuietTest(unittest.TestCase): - self.assertNotIn("Done processing", output) - self.assertNotIn("Total errors found:", output) - # Output with no errors must be completely blank! -- self.assertEquals("", output) -+ self.assertEqual("", output) - - # class FileFilterTest(unittest.TestCase): - # def testFilterExcludedFiles(self): --# self.assertEquals([], _FilterExcludedFiles([])) -+# self.assertEqual([], _FilterExcludedFiles([])) - - # pylint: disable=C6409 - def setUp(): -Index: cpplint-1.6.1/setup.py -=================================================================== ---- cpplint-1.6.1.orig/setup.py -+++ cpplint-1.6.1/setup.py -@@ -1,40 +1,7 @@ - #! /usr/bin/env python -- --from setuptools import setup, Command --from subprocess import check_call --from distutils.spawn import find_executable -+from setuptools import setup - import cpplint as cpplint - --class Cmd(Command): -- ''' -- Superclass for other commands to run via setup.py, declared in setup.cfg. -- These commands will auto-install setup_requires in a temporary folder. -- ''' -- user_options = [ -- ('executable', 'e', 'The executable to use for the command') -- ] -- -- def initialize_options(self): -- self.executable = find_executable(self.executable) -- -- def finalize_options(self): -- pass -- -- def execute(self, *k): -- check_call((self.executable,) + k) -- -- --class Lint(Cmd): -- '''run with python setup.py lint''' -- description = 'Run linting of the code' -- user_options = Cmd.user_options + [ -- ('jobs', 'j', 'Use multiple processes to speed up the linting') -- ] -- executable = 'pylint' -- -- def run(self): -- self.execute('cpplint.py') -- - # some pip versions bark on comments (e.g. on travis) - def read_without_comments(filename): - with open(filename) as f: -@@ -80,7 +47,4 @@ setup(name='cpplint', - extras_require={ - 'test': test_required, - 'dev': read_without_comments('dev-requirements') + test_required -- }, -- cmdclass={ -- 'lint': Lint - })