Accepting request 1314617 from devel:languages:python
- 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
OBS-URL: https://build.opensuse.org/request/show/1314617
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-cpplint?expand=0&rev=10
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d430ce8f67afc1839340e60daa89e90de08b874bc27149833077bba726dfc13a
|
||||
size 364487
|
||||
3
cpplint-2.0.2.tar.gz
Normal file
3
cpplint-2.0.2.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8a5971e4b5490133e425284f0c566c7ade0b959e61018d2c9af3ff7f357ddc57
|
||||
size 373781
|
||||
@@ -1,780 +0,0 @@
|
||||
From ea0004c2ae98c4e275f58d20bf42095160171f87 Mon Sep 17 00:00:00 2001
|
||||
From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
|
||||
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<int(bool)>', '')
|
||||
|
||||
- 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<typename... Args>',
|
||||
@@ -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<typename... Args>',
|
||||
@@ -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<typename... Args>',
|
||||
@@ -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<typename... Args>',
|
||||
@@ -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):
|
||||
45
do-not-use-codecs-open.patch
Normal file
45
do-not-use-codecs-open.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From fe579d0e248f2f1f977ecb902f7a2eb1a4a66eef Mon Sep 17 00:00:00 2001
|
||||
From: Steve Kowalik <steven@wedontsleep.org>
|
||||
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'.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,57 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 31 02:26:02 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- 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á <mmachova@suse.com>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
2018
python312.patch
2018
python312.patch
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user