Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-cpplint for openSUSE:Factory checked in at 2023-04-10 21:24:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cpplint (Old) and /work/SRC/openSUSE:Factory/.python-cpplint.new.19717 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cpplint" Mon Apr 10 21:24:50 2023 rev:6 rq:1078255 version:1.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cpplint/python-cpplint.changes 2020-08-31 16:51:38.252394778 +0200 +++ /work/SRC/openSUSE:Factory/.python-cpplint.new.19717/python-cpplint.changes 2023-04-10 21:24:51.328754232 +0200 @@ -1,0 +2,20 @@ +Mon Apr 10 12:03:48 UTC 2023 - Daniel Garcia <daniel.gar...@suse.com> + +- Add drop-sre-compile.patch upstream patch to fix issues with + deprecated usage of sre_compile gh#cpplint/cpplint#214 +- Update to 1.6.1 + * Fix #195 Fix post increment/decrement operator causing a false positive. + * Fix #202 .hh files should not be considered sytem headers + * Fix #207 Python2 incompatibility for loading CPPLINT.cfg file + * Fix #184 NOLINT(clang-analyzer) comments should not cause warnings +- 1.6.0 (2022-02-19) + * Fix #188: "Include the directory when naming header files" also + for header files with other names like "*.hpp" +- 1.5.5 (2021-05-20) + * Fix #172: Added 'size_t' to typecasts detected by CheckCStyleCast + * Fixed wrong CLI help text: Each filter needs + or - + * Fix #164: add elif as an exception for CheckSpacingForFunctionCall() + * Fix google#346: --root option not working on windows due to + slashes in path + +------------------------------------------------------------------- Old: ---- cpplint-1.5.4.tar.gz New: ---- cpplint-1.6.1.tar.gz drop-sre-compile.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cpplint.spec ++++++ --- /var/tmp/diff_new_pack.nB7ZPu/_old 2023-04-10 21:24:54.416772206 +0200 +++ /var/tmp/diff_new_pack.nB7ZPu/_new 2023-04-10 21:24:54.464772485 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-cpplint # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,21 +16,22 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-cpplint -Version: 1.5.4 +Version: 1.6.1 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 BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module testfixtures} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives BuildArch: noarch %python_subpackages @@ -42,9 +43,9 @@ in hopes that it can be merged in the future. %prep -%setup -q -n cpplint-%{version} +%autosetup -p1 -n cpplint-%{version} sed -i -e '/^#!\//, 1d' cpplint.py -sed -i 's/pytest-runner//' setup.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 @@ -69,6 +70,7 @@ %license LICENSE %doc README.rst %python_alternative %{_bindir}/cpplint -%{python_sitelib}/* +%{python_sitelib}/cpplint* +%pycache_only %{python_sitelib}/__pycache__ %changelog ++++++ cpplint-1.5.4.tar.gz -> cpplint-1.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/PKG-INFO new/cpplint-1.6.1/PKG-INFO --- old/cpplint-1.5.4/PKG-INFO 2020-08-18 02:50:19.000000000 +0200 +++ new/cpplint-1.6.1/PKG-INFO 2022-08-20 16:13:02.822642600 +0200 @@ -1,97 +1,13 @@ Metadata-Version: 2.1 Name: cpplint -Version: 1.5.4 +Version: 1.6.1 Summary: Automated checker to ensure C++ files follow Google's style guide Home-page: https://github.com/cpplint/cpplint +Download-URL: https://github.com/cpplint/cpplint Maintainer: cpplint Developers Maintainer-email: see_git...@nospam.com License: BSD-3-Clause -Download-URL: https://github.com/cpplint/cpplint -Description: cpplint - static code checker for C++ - ===================================== - - .. image:: https://travis-ci.org/cpplint/cpplint.svg?branch=master - :target: https://travis-ci.org/cpplint/cpplint - - .. image:: https://img.shields.io/pypi/v/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/pyversions/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/status/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/l/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/dd/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/dw/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/dm/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - Cpplint is a command-line tool to check C/C++ files for style issues following `Google's C++ style guide <http://google.github.io/styleguide/cppguide.html>`_. - Cpplint is developed and maintained by Google Inc. at `google/styleguide <https://github.com/google/styleguide>`_, also see the `wikipedia entry <http://en.wikipedia.org/wiki/Cpplint>`_ - - While Google maintains cpplint, Google is not (very) responsive to issues and pull requests, this fork aims to be (somewhat) more open to add fixes to cpplint to enable fixes, when those fixes make cpplint usable in wider contexts. - Also see discussion here https://github.com/google/styleguide/pull/528. - - - Installation - ============ - - - To install cpplint from PyPI, run: - - .. code-block:: bash - - $ pip install cpplint - - Then run it with: - - .. code-block:: bash - - $ cpplint [OPTIONS] files - - For full usage instructions, run: - - .. code-block:: bash - - $ cpplint --help - - Changes - ------- - - The modifications in this fork are minor fixes and cosmetic changes, such as: - - * python 3 compatibility - * more default file extensions - * customizable file extensions with the --extensions argument - * continuous integration on travis - * support for recursive file discovery via the --recursive argument - * support for excluding files via --exclude - * JUnit XML output format - * Overriding repository root auto-detection via --repository - * Support ``#pragma once`` as an alternative to header include guards - * ... and a few more (most of which are open PRs on upstream) - - - Acknowledgements - ---------------- - - Thanks to Google Inc. for open-sourcing their in-house tool. - Thanks to maintainers of the fork - - * `tkruse <https://github.com/tkruse>`_ - * `mattyclarkson <https://github.com/mattyclarkson>`_ - * `theandrewdavis <https://github.com/theandrewdavis>`_ - Keywords: lint,python,c++ -Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 @@ -106,3 +22,84 @@ Classifier: License :: Freely Distributable Provides-Extra: test Provides-Extra: dev +License-File: LICENSE + +cpplint - static code checker for C++ +===================================== + +.. image:: https://img.shields.io/pypi/v/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/pyversions/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/status/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/l/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/dd/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/dw/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/dm/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +Cpplint is a command-line tool to check C/C++ files for style issues following `Google's C++ style guide <http://google.github.io/styleguide/cppguide.html>`_. +Cpplint is developed and maintained by Google Inc. at `google/styleguide <https://github.com/google/styleguide>`_, also see the `wikipedia entry <http://en.wikipedia.org/wiki/Cpplint>`_ + +While Google maintains cpplint, Google is not (very) responsive to issues and pull requests, this fork aims to be (somewhat) more open to add fixes to cpplint to enable fixes, when those fixes make cpplint usable in wider contexts. +Also see discussion here https://github.com/google/styleguide/pull/528. + + +Installation +============ + + +To install cpplint from PyPI, run: + +.. code-block:: bash + + $ pip install cpplint + +Then run it with: + +.. code-block:: bash + + $ cpplint [OPTIONS] files + +For full usage instructions, run: + +.. code-block:: bash + + $ cpplint --help + +Changes +------- + +The modifications in this fork are minor fixes and cosmetic changes, such as: + +* python 3 compatibility +* more default file extensions +* customizable file extensions with the --extensions argument +* continuous integration on github +* support for recursive file discovery via the --recursive argument +* support for excluding files via --exclude +* JUnit XML output format +* Overriding repository root auto-detection via --repository +* Support ``#pragma once`` as an alternative to header include guards +* ... and a few more (most of which are open PRs on upstream) + + +Acknowledgements +---------------- + +Thanks to Google Inc. for open-sourcing their in-house tool. +Thanks to maintainers of the fork + +* `tkruse <https://github.com/tkruse>`_ +* `mattyclarkson <https://github.com/mattyclarkson>`_ +* `theandrewdavis <https://github.com/theandrewdavis>`_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/README.rst new/cpplint-1.6.1/README.rst --- old/cpplint-1.5.4/README.rst 2020-08-05 02:41:14.000000000 +0200 +++ new/cpplint-1.6.1/README.rst 2022-04-18 11:38:55.000000000 +0200 @@ -1,9 +1,6 @@ cpplint - static code checker for C++ ===================================== -.. image:: https://travis-ci.org/cpplint/cpplint.svg?branch=master - :target: https://travis-ci.org/cpplint/cpplint - .. image:: https://img.shields.io/pypi/v/cpplint.svg :target: https://pypi.python.org/pypi/cpplint @@ -62,7 +59,7 @@ * python 3 compatibility * more default file extensions * customizable file extensions with the --extensions argument -* continuous integration on travis +* continuous integration on github * support for recursive file discovery via the --recursive argument * support for excluding files via --exclude * JUnit XML output format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/cpplint.egg-info/PKG-INFO new/cpplint-1.6.1/cpplint.egg-info/PKG-INFO --- old/cpplint-1.5.4/cpplint.egg-info/PKG-INFO 2020-08-18 02:50:19.000000000 +0200 +++ new/cpplint-1.6.1/cpplint.egg-info/PKG-INFO 2022-08-20 16:13:02.000000000 +0200 @@ -1,97 +1,13 @@ Metadata-Version: 2.1 Name: cpplint -Version: 1.5.4 +Version: 1.6.1 Summary: Automated checker to ensure C++ files follow Google's style guide Home-page: https://github.com/cpplint/cpplint +Download-URL: https://github.com/cpplint/cpplint Maintainer: cpplint Developers Maintainer-email: see_git...@nospam.com License: BSD-3-Clause -Download-URL: https://github.com/cpplint/cpplint -Description: cpplint - static code checker for C++ - ===================================== - - .. image:: https://travis-ci.org/cpplint/cpplint.svg?branch=master - :target: https://travis-ci.org/cpplint/cpplint - - .. image:: https://img.shields.io/pypi/v/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/pyversions/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/status/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/l/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/dd/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/dw/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - .. image:: https://img.shields.io/pypi/dm/cpplint.svg - :target: https://pypi.python.org/pypi/cpplint - - Cpplint is a command-line tool to check C/C++ files for style issues following `Google's C++ style guide <http://google.github.io/styleguide/cppguide.html>`_. - Cpplint is developed and maintained by Google Inc. at `google/styleguide <https://github.com/google/styleguide>`_, also see the `wikipedia entry <http://en.wikipedia.org/wiki/Cpplint>`_ - - While Google maintains cpplint, Google is not (very) responsive to issues and pull requests, this fork aims to be (somewhat) more open to add fixes to cpplint to enable fixes, when those fixes make cpplint usable in wider contexts. - Also see discussion here https://github.com/google/styleguide/pull/528. - - - Installation - ============ - - - To install cpplint from PyPI, run: - - .. code-block:: bash - - $ pip install cpplint - - Then run it with: - - .. code-block:: bash - - $ cpplint [OPTIONS] files - - For full usage instructions, run: - - .. code-block:: bash - - $ cpplint --help - - Changes - ------- - - The modifications in this fork are minor fixes and cosmetic changes, such as: - - * python 3 compatibility - * more default file extensions - * customizable file extensions with the --extensions argument - * continuous integration on travis - * support for recursive file discovery via the --recursive argument - * support for excluding files via --exclude - * JUnit XML output format - * Overriding repository root auto-detection via --repository - * Support ``#pragma once`` as an alternative to header include guards - * ... and a few more (most of which are open PRs on upstream) - - - Acknowledgements - ---------------- - - Thanks to Google Inc. for open-sourcing their in-house tool. - Thanks to maintainers of the fork - - * `tkruse <https://github.com/tkruse>`_ - * `mattyclarkson <https://github.com/mattyclarkson>`_ - * `theandrewdavis <https://github.com/theandrewdavis>`_ - Keywords: lint,python,c++ -Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 @@ -106,3 +22,84 @@ Classifier: License :: Freely Distributable Provides-Extra: test Provides-Extra: dev +License-File: LICENSE + +cpplint - static code checker for C++ +===================================== + +.. image:: https://img.shields.io/pypi/v/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/pyversions/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/status/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/l/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/dd/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/dw/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +.. image:: https://img.shields.io/pypi/dm/cpplint.svg + :target: https://pypi.python.org/pypi/cpplint + +Cpplint is a command-line tool to check C/C++ files for style issues following `Google's C++ style guide <http://google.github.io/styleguide/cppguide.html>`_. +Cpplint is developed and maintained by Google Inc. at `google/styleguide <https://github.com/google/styleguide>`_, also see the `wikipedia entry <http://en.wikipedia.org/wiki/Cpplint>`_ + +While Google maintains cpplint, Google is not (very) responsive to issues and pull requests, this fork aims to be (somewhat) more open to add fixes to cpplint to enable fixes, when those fixes make cpplint usable in wider contexts. +Also see discussion here https://github.com/google/styleguide/pull/528. + + +Installation +============ + + +To install cpplint from PyPI, run: + +.. code-block:: bash + + $ pip install cpplint + +Then run it with: + +.. code-block:: bash + + $ cpplint [OPTIONS] files + +For full usage instructions, run: + +.. code-block:: bash + + $ cpplint --help + +Changes +------- + +The modifications in this fork are minor fixes and cosmetic changes, such as: + +* python 3 compatibility +* more default file extensions +* customizable file extensions with the --extensions argument +* continuous integration on github +* support for recursive file discovery via the --recursive argument +* support for excluding files via --exclude +* JUnit XML output format +* Overriding repository root auto-detection via --repository +* Support ``#pragma once`` as an alternative to header include guards +* ... and a few more (most of which are open PRs on upstream) + + +Acknowledgements +---------------- + +Thanks to Google Inc. for open-sourcing their in-house tool. +Thanks to maintainers of the fork + +* `tkruse <https://github.com/tkruse>`_ +* `mattyclarkson <https://github.com/mattyclarkson>`_ +* `theandrewdavis <https://github.com/theandrewdavis>`_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/cpplint.egg-info/SOURCES.txt new/cpplint-1.6.1/cpplint.egg-info/SOURCES.txt --- old/cpplint-1.5.4/cpplint.egg-info/SOURCES.txt 2020-08-18 02:50:19.000000000 +0200 +++ new/cpplint-1.6.1/cpplint.egg-info/SOURCES.txt 2022-08-20 16:13:02.000000000 +0200 @@ -23,6 +23,9 @@ samples/boost-sample/include/boost/math/octonion.hpp samples/boost-sample/src/inspect/unnamed_namespace_check.hpp samples/boost-sample/src/tr1/c_policy.hpp +samples/cfg-file/CPPLINT.cfg +samples/cfg-file/simple.def +samples/cfg-file/src/sillycode.cpp samples/chromium-sample/README.md samples/chromium-sample/simple.def samples/chromium-sample/src/chrome_content_renderer_client.cc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/cpplint.egg-info/entry_points.txt new/cpplint-1.6.1/cpplint.egg-info/entry_points.txt --- old/cpplint-1.5.4/cpplint.egg-info/entry_points.txt 2020-08-18 02:50:19.000000000 +0200 +++ new/cpplint-1.6.1/cpplint.egg-info/entry_points.txt 2022-08-20 16:13:02.000000000 +0200 @@ -1,3 +1,2 @@ [console_scripts] cpplint = cpplint:main - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/cpplint.egg-info/requires.txt new/cpplint-1.6.1/cpplint.egg-info/requires.txt --- old/cpplint-1.5.4/cpplint.egg-info/requires.txt 2020-08-18 02:50:19.000000000 +0200 +++ new/cpplint-1.6.1/cpplint.egg-info/requires.txt 2022-08-20 16:13:02.000000000 +0200 @@ -1,9 +1,11 @@ [dev] -flake8>=3.7.8 -pylint>=1.8.4 +flake8>=4.0.1 +flake8-polyfill +pylint>=2.11.0 tox>=3.0.0 tox-pyenv +importlib-metadata>=0.12 pytest<5.0,>=4.6 pytest-cov pyparsing<3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/cpplint.py new/cpplint-1.6.1/cpplint.py --- old/cpplint-1.5.4/cpplint.py 2020-08-18 02:48:26.000000000 +0200 +++ new/cpplint-1.6.1/cpplint.py 2022-08-20 16:10:33.000000000 +0200 @@ -41,6 +41,11 @@ same line, but it is far from perfect (in either direction). """ +# cpplint predates fstrings +# pylint: disable=consider-using-f-string + +# pylint: disable=invalid-name + import codecs import copy import getopt @@ -59,9 +64,10 @@ # if empty, use defaults _valid_extensions = set([]) -__VERSION__ = '1.5.4' +__VERSION__ = '1.6.1' try: + # -- pylint: disable=used-before-assignment xrange # Python 2 except NameError: # -- pylint: disable=redefined-builtin @@ -127,11 +133,11 @@ error messages whose category names pass the filters will be printed. (Category names are printed with the message and look like "[whitespace/indent]".) Filters are evaluated left to right. - "-FOO" and "FOO" means "do not print categories that start with FOO". + "-FOO" means "do not print categories that start with FOO". "+FOO" means "do print categories that start with FOO". Examples: --filter=-whitespace,+whitespace/braces - --filter=whitespace,runtime/printf,+runtime/printf_format + --filter=-whitespace,-runtime/printf,+runtime/printf_format --filter=-,+build/include_what_you_use To see a list of all the categories used in cpplint, pass no arg: @@ -368,6 +374,12 @@ 'readability/function', ] +# These prefixes for categories should be ignored since they relate to other +# tools which also use the NOLINT syntax, e.g. clang-tidy. +_OTHER_NOLINT_CATEGORY_PREFIXES = [ + 'clang-analyzer', + ] + # The default state of the category filter. This is overridden by the --filter= # flag. By default all errors are on, so only add here categories that should be # off by default (i.e., categories that must be enabled by the --filter= flags). @@ -872,12 +884,14 @@ _include_order = "default" try: + # -- pylint: disable=used-before-assignment unicode except NameError: # -- pylint: disable=redefined-builtin basestring = unicode = str try: + # -- pylint: disable=used-before-assignment long except NameError: # -- pylint: disable=redefined-builtin @@ -979,6 +993,9 @@ category = category[1:-1] if category in _ERROR_CATEGORIES: _error_suppressions.setdefault(category, set()).add(suppressed_line) + elif any(c for c in _OTHER_NOLINT_CATEGORY_PREFIXES if category.startswith(c)): + # Ignore any categories from other tools. + pass elif category not in _LEGACY_ERROR_CATEGORIES: error(filename, linenum, 'readability/nolint', 5, 'Unknown NOLINT error category: %s' % category) @@ -1915,6 +1932,7 @@ self.raw_lines = lines self.num_lines = len(lines) self.lines_without_raw_strings = CleanseRawStrings(lines) + # # pylint: disable=consider-using-enumerate for linenum in range(len(self.lines_without_raw_strings)): self.lines.append(CleanseComments( self.lines_without_raw_strings[linenum])) @@ -2337,7 +2355,8 @@ # --root=.. , will prepend the outer directory to the header guard full_path = fileinfo.FullName() - root_abspath = os.path.abspath(_root) + # adapt slashes for windows + root_abspath = os.path.abspath(_root).replace('\\', '/') maybe_path = StripListPrefix(PathSplitToList(full_path), PathSplitToList(root_abspath)) @@ -3471,7 +3490,7 @@ # 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|for|while|switch|return|new|delete|catch|sizeof)\b', + not 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 @@ -5005,7 +5024,8 @@ or Search(r'(?:%s)\/.*\.h' % "|".join(C_STANDARD_HEADER_FOLDERS), include)) # Headers with C++ extensions shouldn't be considered C system headers - is_system = used_angle_brackets and not os.path.splitext(include)[1] in ['.hpp', '.hxx', '.h++'] + include_ext = os.path.splitext(include)[1] + is_system = used_angle_brackets and not include_ext in ['.hh', '.hpp', '.hxx', '.h++'] if is_system: if is_cpp_header: @@ -5067,10 +5087,12 @@ # # We also make an exception for Lua headers, which follow google # naming convention but not the include convention. - match = Match(r'#include\s*"([^/]+\.h)"', line) - if match and not _THIRD_PARTY_HEADERS_PATTERN.match(match.group(1)): - error(filename, linenum, 'build/include_subdir', 4, - 'Include the directory when naming .h files') + match = Match(r'#include\s*"([^/]+\.(.*))"', line) + if match: + if (IsHeaderExtension(match.group(2)) and + not _THIRD_PARTY_HEADERS_PATTERN.match(match.group(1))): + error(filename, linenum, 'build/include_subdir', 4, + 'Include the directory when naming header files') # we shouldn't include a file more than once. actually, there are a # handful of instances where doing so is okay, but in general it's @@ -5751,7 +5773,7 @@ if not expecting_function: CheckCStyleCast(filename, clean_lines, linenum, 'static_cast', - r'\((int|float|double|bool|char|u?int(16|32|64))\)', error) + r'\((int|float|double|bool|char|u?int(16|32|64)|size_t)\)', error) # This doesn't catch all cases. Consider (const char * const)"hello". # @@ -5843,7 +5865,8 @@ return False # operator++(int) and operator--(int) - if context.endswith(' operator++') or context.endswith(' operator--'): + if (context.endswith(' operator++') or context.endswith(' operator--') or + context.endswith('::operator++') or context.endswith('::operator--')): return False # A single unnamed argument for a function tends to look like old style cast. @@ -6522,7 +6545,7 @@ continue try: - with open(cfg_file) as file_handle: + with codecs.open(cfg_file, 'r', 'utf8', 'replace') as file_handle: for line in file_handle: line, _, _ = line.partition('#') # Remove comments. if not line.strip(): @@ -6686,10 +6709,10 @@ Args: message: The optional error message. """ - sys.stderr.write(_USAGE % (list(GetAllExtensions()), - ','.join(list(GetAllExtensions())), - GetHeaderExtensions(), - ','.join(GetHeaderExtensions()))) + sys.stderr.write(_USAGE % (sorted(list(GetAllExtensions())), + ','.join(sorted(list(GetAllExtensions()))), + sorted(GetHeaderExtensions()), + ','.join(sorted(GetHeaderExtensions())))) if message: sys.exit('\nFATAL ERROR: ' + message) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/cpplint_clitest.py new/cpplint-1.6.1/cpplint_clitest.py --- old/cpplint-1.5.4/cpplint_clitest.py 2020-08-05 02:41:14.000000000 +0200 +++ new/cpplint-1.6.1/cpplint_clitest.py 2022-08-20 15:27:23.000000000 +0200 @@ -86,10 +86,10 @@ cls._root = os.path.realpath(tempfile.mkdtemp()) shutil.copytree('samples', os.path.join(cls._root, 'samples')) cls.prepare_directory(cls._root) - except Exception as e: + except Exception: try: cls.tearDownClass() - except Exception as e2: + except Exception: pass raise @@ -166,6 +166,9 @@ def testSillySample(self): self.checkAllInFolder('./samples/silly-sample', 4) + def testCfgFileSample(self): + self.checkAllInFolder('./samples/cfg-file', 1) + def testBoostSample(self): self.checkAllInFolder('./samples/boost-sample', 4) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/cpplint_unittest.py new/cpplint-1.6.1/cpplint_unittest.py --- old/cpplint-1.5.4/cpplint_unittest.py 2020-08-05 02:42:58.000000000 +0200 +++ new/cpplint-1.6.1/cpplint_unittest.py 2022-08-20 15:27:23.000000000 +0200 @@ -136,6 +136,7 @@ class EnterableList(list): def __enter__(self): return self + def __exit__(self, type, value, tb): return self self.mock_file = EnterableList(mock_file) @@ -351,7 +352,6 @@ results = self.GetNamespaceResults(lines) self.assertEquals(results, '') - # Test get line width. def testGetLineWidth(self): self.assertEquals(0, cpplint.GetLineWidth('')) @@ -632,6 +632,10 @@ 'uint64 a = (uint64)1.0;', 'Using C-style cast. Use static_cast<uint64>(...) instead' ' [readability/casting] [4]') + self.TestLint( + 'size_t a = (size_t)1.0;', + 'Using C-style cast. Use static_cast<size_t>(...) instead' + ' [readability/casting] [4]') # These shouldn't be recognized casts. self.TestLint('u a = (u)NULL;', '') @@ -649,6 +653,8 @@ self.TestLint('void F(int (Class::member)(int*));', '') self.TestLint('void F(int (Class::member)(int), int param);', '') self.TestLint('void F(int (Class::member)(int*), int param);', '') + self.TestLint('X Class::operator++(int)', '') + self.TestLint('X Class::operator--(int)', '') # These should not be recognized (lambda functions without arg names). self.TestLint('[](int/*unused*/) -> bool {', '') @@ -1249,20 +1255,19 @@ def testRawStrings(self): self.TestMultiLineLint( - """ - int main() { - struct A { - A(std::string s, A&& a); - }; - }""", + """ + int main() { + struct A { + A(std::string s, A&& a); + }; + }""", '') - self.TestMultiLineLint( - """ - template <class T, class D = default_delete<T>> class unique_ptr { - public: - unique_ptr(unique_ptr&& u) noexcept; - };""", + """ + template <class T, class D = default_delete<T>> class unique_ptr { + public: + unique_ptr(unique_ptr&& u) noexcept; + };""", '') self.TestMultiLineLint( """ @@ -1961,7 +1966,6 @@ self.TestLint(' VLOG(FATAL)', errmsg) self.TestLint(' VLOG(DFATAL)', errmsg) - # Test potential format string bugs like printf(foo). def testFormatStrings(self): self.TestLint('printf("foo")', '') @@ -2962,7 +2966,6 @@ 'Missing space around colon in range-based for loop' ' [whitespace/forcolon] [2]') - # Static or global STL strings. def testStaticOrGlobalSTLStrings(self): # A template for the error message for a const global/static string. @@ -3185,8 +3188,8 @@ self.TestLint('//====', '') self.TestLint('//////', '') self.TestLint('////// x', '') - self.TestLint('///< x', '') # After-member Doxygen comment - self.TestLint('//!< x', '') # After-member Doxygen comment + self.TestLint('///< x', '') # After-member Doxygen comment + self.TestLint('//!< x', '') # After-member Doxygen comment self.TestLint('////x', 'Should have a space between // and comment' ' [whitespace/comments] [4]') self.TestLint('//}', '') @@ -3281,9 +3284,9 @@ error_collector = ErrorCollector(self.assert_) raw_bytes = codecs_latin_encode('\xe9x\0') if sys.version_info < (3,): - unidata = unicode(raw_bytes, 'utf8', 'replace') + unidata = unicode(raw_bytes, 'utf8', 'replace') else: - unidata = str(raw_bytes, 'utf8', 'replace') + unidata = str(raw_bytes, 'utf8', 'replace') cpplint.ProcessFileData( 'nul_utf8.cc', 'cc', ['// Copyright 2014 Your Company.', @@ -4038,6 +4041,22 @@ [] { if (true); }); }""", '') + self.TestMultiLineLint( + """ + #if(A == 0) + foo(); + #elif(A == 1) + bar(); + #endif""", + '') + self.TestMultiLineLint( + """ + #if (A == 0) + foo(); + #elif (A == 1) + bar(); + #endif""", + '') def testTab(self): self.TestLint('\tint a;', @@ -4776,7 +4795,7 @@ # 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.assertEquals('%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. @@ -4791,9 +4810,9 @@ cpplint.GetHeaderGuardCPPVariable(file_path)) styleguide_rel_path = os.path.relpath(styleguide_parent_path, - this_files_path) # '../..' + this_files_path) # '../..' cpplint._root = styleguide_rel_path - self.assertEquals('%sCPPLINT_CPPLINT_TEST_HEADER_H_' %(expected_prefix), + self.assertEquals('%sCPPLINT_CPPLINT_TEST_HEADER_H_' % (expected_prefix), cpplint.GetHeaderGuardCPPVariable(file_path)) cpplint._root = None @@ -4951,8 +4970,13 @@ def testBuildInclude(self): # Test that include statements have slashes in them. self.TestLint('#include "foo.h"', - 'Include the directory when naming .h files' + 'Include the directory when naming header files' ' [build/include_subdir] [4]') + self.TestLint('#include "bar.hh"', + 'Include the directory when naming header files' + ' [build/include_subdir] [4]') + self.TestLint('#include "baz.aa"', '') + self.TestLint('#include "dir/foo.h"', '') self.TestLint('#include "Python.h"', '') self.TestLint('#include "lua.h"', '') @@ -6097,7 +6121,7 @@ self.assertEquals(self.nesting_state.stack[0].class_indent, 0) self.UpdateWithLines(['}']) self.assertEquals(len(self.nesting_state.stack), 0) - + def testClass(self): self.UpdateWithLines(['class A {']) self.assertEquals(len(self.nesting_state.stack), 1) @@ -6292,7 +6316,7 @@ def testTemplateDefaultArg(self): self.UpdateWithLines([ - 'template <class T, class D = default_delete<T>> class unique_ptr {',]) + 'template <class T, class D = default_delete<T>> class unique_ptr {']) self.assertEquals(len(self.nesting_state.stack), 1) self.assertTrue(self.nesting_state.stack[0], isinstance(self.nesting_state.stack[0], cpplint._ClassInfo)) @@ -6436,7 +6460,7 @@ cmd_line = [self.python_executable, cpplint_abspath] + \ list(args) + \ - [ self.cpplint_test_h ] + [self.cpplint_test_h] return_code = 0 try: @@ -6500,9 +6524,9 @@ # Output with no errors must be completely blank! self.assertEquals("", output) -#class FileFilterTest(unittest.TestCase): -# def testFilterExcludedFiles(self): -# self.assertEquals([], _FilterExcludedFiles([])) +# class FileFilterTest(unittest.TestCase): +# def testFilterExcludedFiles(self): +# self.assertEquals([], _FilterExcludedFiles([])) # pylint: disable=C6409 def setUp(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/dev-requirements new/cpplint-1.6.1/dev-requirements --- old/cpplint-1.5.4/dev-requirements 2020-08-05 02:41:14.000000000 +0200 +++ new/cpplint-1.6.1/dev-requirements 2022-04-18 11:38:55.000000000 +0200 @@ -1,12 +1,9 @@ # requirements to run development steps # also change in tox.ini -flake8>=3.7.8 -pylint>=1.8.4 +flake8>=4.0.1 +flake8-polyfill +pylint>=2.11.0 tox>=3.0.0 tox-pyenv - -# Below only run with python3, installed in tox.ini -# mypy -# coala -# coala-bears +importlib-metadata>=0.12 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/samples/boost-sample/exclude.def new/cpplint-1.6.1/samples/boost-sample/exclude.def --- old/cpplint-1.5.4/samples/boost-sample/exclude.def 2020-08-05 02:41:14.000000000 +0200 +++ new/cpplint-1.6.1/samples/boost-sample/exclude.def 2022-08-20 15:27:23.000000000 +0200 @@ -3,9 +3,10 @@ 4 Done processing src/inspect/unnamed_namespace_check.hpp Done processing src/tr1/c_policy.hpp -Total errors found: 106 +Total errors found: 107 src/inspect/unnamed_namespace_check.hpp:0: No #ifndef header guard found, suggested CPP variable is: SAMPLES_BOOST_SAMPLE_SRC_INSPECT_UNNAMED_NAMESPACE_CHECK_HPP_ [build/header_guard] [5] +src/inspect/unnamed_namespace_check.hpp:11: Include the directory when naming header files [build/include_subdir] [4] src/inspect/unnamed_namespace_check.hpp:14: Do not use unnamed namespaces in header files. See https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Namespaces for more information. [build/namespaces_headers] [4] src/inspect/unnamed_namespace_check.hpp:18: At least two spaces is best between code and comments [whitespace/comments] [2] src/inspect/unnamed_namespace_check.hpp:19: Closing ) should be moved to the previous line [whitespace/parens] [2] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/samples/boost-sample/headers_inspect.def new/cpplint-1.6.1/samples/boost-sample/headers_inspect.def --- old/cpplint-1.5.4/samples/boost-sample/headers_inspect.def 2020-08-05 02:41:14.000000000 +0200 +++ new/cpplint-1.6.1/samples/boost-sample/headers_inspect.def 2022-08-20 15:27:23.000000000 +0200 @@ -2,9 +2,10 @@ 1 3 Done processing src/inspect/unnamed_namespace_check.hpp -Total errors found: 40 +Total errors found: 41 src/inspect/unnamed_namespace_check.hpp:0: No #ifndef header guard found, suggested CPP variable is: SAMPLES_BOOST_SAMPLE_SRC_INSPECT_UNNAMED_NAMESPACE_CHECK_HPP_ [build/header_guard] [5] +src/inspect/unnamed_namespace_check.hpp:11: Include the directory when naming header files [build/include_subdir] [4] src/inspect/unnamed_namespace_check.hpp:14: Do not use unnamed namespaces in header files. See https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Namespaces for more information. [build/namespaces_headers] [4] src/inspect/unnamed_namespace_check.hpp:18: At least two spaces is best between code and comments [whitespace/comments] [2] src/inspect/unnamed_namespace_check.hpp:19: Closing ) should be moved to the previous line [whitespace/parens] [2] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/samples/cfg-file/CPPLINT.cfg new/cpplint-1.6.1/samples/cfg-file/CPPLINT.cfg --- old/cpplint-1.5.4/samples/cfg-file/CPPLINT.cfg 1970-01-01 01:00:00.000000000 +0100 +++ new/cpplint-1.6.1/samples/cfg-file/CPPLINT.cfg 2022-08-20 15:27:23.000000000 +0200 @@ -0,0 +1,3 @@ +set noparent +filter=-whitespace,-build/include_what_you_use +linelength=80 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/samples/cfg-file/simple.def new/cpplint-1.6.1/samples/cfg-file/simple.def --- old/cpplint-1.5.4/samples/cfg-file/simple.def 1970-01-01 01:00:00.000000000 +0100 +++ new/cpplint-1.6.1/samples/cfg-file/simple.def 2022-08-20 15:27:23.000000000 +0200 @@ -0,0 +1,26 @@ +src/*.cpp +1 +3 +Done processing src/sillycode.cpp +Total errors found: 19 + +src/sillycode.cpp:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5] +src/sillycode.cpp:3: Found C system header after C++ system header. Should be: sillycode.h, c system, c++ system, other. [build/include_order] [4] +src/sillycode.cpp:14: Is this a non-const reference? If so, make const or use a pointer: vector<string>& v [runtime/references] [2] +src/sillycode.cpp:40: If/else bodies with multiple statements require braces [readability/braces] [4] +src/sillycode.cpp:66: Single-parameter constructors should be marked explicit. [runtime/explicit] [5] +src/sillycode.cpp:76: Single-parameter constructors should be marked explicit. [runtime/explicit] [5] +src/sillycode.cpp:85: Constructors callable with one argument should be marked explicit. [runtime/explicit] [5] +src/sillycode.cpp:118: Is this a non-const reference? If so, make const or use a pointer: N::X& a [runtime/references] [2] +src/sillycode.cpp:118: Is this a non-const reference? If so, make const or use a pointer: N::X& b [runtime/references] [2] +src/sillycode.cpp:123: Is this a non-const reference? If so, make const or use a pointer: N::X& a [runtime/references] [2] +src/sillycode.cpp:123: Is this a non-const reference? If so, make const or use a pointer: N::X& b [runtime/references] [2] +src/sillycode.cpp:171: Do not use variable-length arrays. Use an appropriately named ('k' followed by CamelCase) compile-time constant for the size. [runtime/arrays] [1] +src/sillycode.cpp:178: Static/global string variables are not permitted. [runtime/string] [4] +src/sillycode.cpp:199: If an else has a brace on one side, it should have it on both [readability/braces] [5] +src/sillycode.cpp:202: If an else has a brace on one side, it should have it on both [readability/braces] [5] +src/sillycode.cpp:208: Static/global string variables are not permitted. [runtime/string] [4] +src/sillycode.cpp:227: Static/global string variables are not permitted. [runtime/string] [4] +src/sillycode.cpp:228: Using C-style cast. Use reinterpret_cast<double*>(...) instead [readability/casting] [4] +src/sillycode.cpp:243: Using C-style cast. Use reinterpret_cast<derived2*>(...) instead [readability/casting] [4] + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/samples/cfg-file/src/sillycode.cpp new/cpplint-1.6.1/samples/cfg-file/src/sillycode.cpp --- old/cpplint-1.5.4/samples/cfg-file/src/sillycode.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/cpplint-1.6.1/samples/cfg-file/src/sillycode.cpp 2022-08-20 15:27:23.000000000 +0200 @@ -0,0 +1,262 @@ +#include <vector> + +#include <gtest/test.h> + +#include <something.hh> +class Date { + // ... +public: + Month month() const; // do + int month(); // don't + // ... +}; + +void do_something(vector<string>& v) +{ + string val; + cin >> val; + // ... + int index = 0; // bad + for (int i = 0; i < v.size(); ++i) + if (v[i] == val) { + index = i; + break; + } + // ... +} + +struct X { + char ch; + int i; + string s; + char ch2; + + X& operator=(const X& a); + X(const X&); +}; + +X waste(const char* p) +{ + if (p == nullptr) throw Nullptr_error{}; + int n = strlen(p); + auto buf = new char[n]; + if (buf == nullptr) throw Allocation_error{}; + for (int i = 0; i < n; ++i) buf[i] = p[i]; + // ... manipulate buffer ... + X x; + x.ch = 'a'; + x.s = string(n); // give x.s space for *ps + for (int i = 0; i < x.s.size(); ++i) x.s[i] = buf[i]; // copy buf into x.s + delete buf; + return x; +} + +void driver() +{ + X x = waste("Typical argument"); + // ... +} + +class X { // BAD + int i; + string s; + int j; +public: + X() :i{666}, s{"qqq"} { } // j is uninitialized + X(int ii) :i{ii} {} // s is "" and j is uninitialized + // ... +}; + +class X2 { + int i {666}; + string s {"qqq"}; + int j {0}; +public: + X2() = default; // all members are initialized to their defaults + X2(int ii) :i{ii} {} // s and j initialized to their defaults + // ... +}; + +class X3 { // BAD: inexplicit, argument passing overhead + int i; + string s; + int j; +public: + X3(int ii = 666, const string& ss = "qqq", int jj = 0) + :i{ii}, s{ss}, j{jj} { } // all members are initialized to their defaults + // ... +}; + + +class Foo { + string s; + int i; +public: + Foo& operator=(Foo&& a); + // ... +}; + +Foo& Foo::operator=(Foo&& a) // OK, but there is a cost +{ + if (this == &a) return *this; // this line is redundant + s = std::move(a.s); + i = a.i; + return *this; +} + +template<typename T> +class Vector2 { + // ... + Vector2(Vector2&& a) { *this = a; } // just use the copy + Vector2& operator=(Vector2&& a) { *this = a; } // just use the copy + //... +public: + T* elem; + int sz; +}; + +void f2(N::X& a, N::X& b) +{ + swap(a,b); // calls N::swap +} + +void f3(N::X& a, N::X& b) +{ + using std::swap; // make std::swap available + swap(a,b); // calls N::swap if it exists, otherwise std::swap +} + + +// webcolors.h (third party header) +#define RED 0xFF0000 +#define GREEN 0x00FF00 +#define BLUE 0x0000FF + +// productinfo.h +// The following define product subtypes based on color +#define RED 0 +#define PURPLE 1 +#define BLUE 2 + +int webby = BLUE; // webby==2; probably not what was desired + +enum class Webcolor { red=0xFF0000, green=0x00FF00, blue=0x0000FF }; +enum class Productinfo { red=0, purple=1, blue=2 }; + +int webby = blue; // error: be specific +Webcolor webby = Webcolor::blue; + +enum Webcolor { red=0xFF0000, green=0x00FF00, blue=0x0000FF }; +enum Productinfo { red=0, purple=1, blue=2 }; + +int webby = blue; // error, ambiguous: be specific +Webcolor webby = Webcolor::blue; + +enum class Webcolor { red=0xFF0000, green=0x00FF00, blue=0x0000FF }; +enum class Productinfo { red=0, purple=1, blue=2 }; + +int webby = blue; // error: blue undefined in this scope +Webcolor webby = Webcolor::blue; + + +void sink(unique_ptr<widget>); // consumes the widget + +void sink(widget*); // just uses the widget + +void thinko(const unique_ptr<widget>&); // usually not what you want + +void reseat(unique_ptr<widget>&); // "will" or "might" reseat pointer + +constexpr int max = 8*1024; +int buf[max]; // OK, but suspicious: uninitialized +f.read(buf, max); + +constexpr int max = 8*1024; +int buf[max] = {0}; // better in some situations +f.read(buf, max); + +string s; // s is default initialized to "" +cin >> s; // s expands to hold the string + + +error_code ec; +Value v = [&] { + auto p = get_value(); // get_value() returns a pair<error_code, Value> + ec = p.first; + return p.second; +}(); + +Value v = [] { + auto p = get_value(); // get_value() returns a pair<error_code, Value> + if (p.first) throw Bad_value{p.first}; + return p.second; +}(); + +SomeLargeType var; // ugly CaMeLcAsEvArIaBlE + +if (cond) // some non-trivial condition + Set(&var); +else if (cond2 || !cond3) { + var = Set2(3.14); +} +else { + var = 0; + for (auto& e : something) + var += e; +} + +string var = [&]{ + if (!in) return ""; // default + string s; + for (char c : in >> c) + s += toupper(c); + return s; +}(); // note () + +void use(int n) +{ + switch (n) { // good + case 0: // ... + case 7: // ... + } +} + +int n = numeric_limits<int>::max(); +int m = n + 1; // bad + +std::string s = "hello world"; +double* p = (double*)(&s); // BAD + +class base { public: virtual ~base() = 0; }; + +class derived1 : public base { }; + +class derived2 : public base { + std::string s; +public: + std::string get_s() { return s; } +}; + +derived1 d1; +base* p = &d1; // ok, implicit conversion to pointer to base is fine + +derived2* p2 = (derived2*)(p); // BAD, tries to treat d1 as a derived2, which it is not +cout << p2.get_s(); // tries to access d1's nonexistent string member, instead sees arbitrary bytes near d1 + +void f(const int& i) { + (int&)(i) = 42; // BAD +} + +static int i = 0; +static const int j = 0; + +f(i); // silent side effect +f(j); // undefined behavior + + +auto x = m*v1 + vv; // multiply m with v1 and add the result to vv + +int i; +for (i = 0; i < max; ++i); // bug waiting to happen +if (i == j) + return i; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/samples/chromium-sample/simple.def new/cpplint-1.6.1/samples/chromium-sample/simple.def --- old/cpplint-1.5.4/samples/chromium-sample/simple.def 2020-08-05 02:41:14.000000000 +0200 +++ new/cpplint-1.6.1/samples/chromium-sample/simple.def 2022-08-20 15:27:23.000000000 +0200 @@ -7,7 +7,7 @@ Done processing src/io_thread.h Total errors found: 13 -src/chrome_content_renderer_client.cc:113: Include the directory when naming .h files [build/include_subdir] [4] +src/chrome_content_renderer_client.cc:113: Include the directory when naming header files [build/include_subdir] [4] src/chrome_content_renderer_client.cc:1156: Use int16/int64/etc, rather than the C type long [runtime/int] [4] src/chrome_content_renderer_client.cc:1161: Use int16/int64/etc, rather than the C type long [runtime/int] [4] src/chrome_content_renderer_client.cc:5: samples/chromium-sample/src/chrome_content_renderer_client.cc should include its header file samples/chromium-sample/src/chrome_content_renderer_client.h [build/include] [5] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/samples/codelite-sample/simple.def new/cpplint-1.6.1/samples/codelite-sample/simple.def --- old/cpplint-1.5.4/samples/codelite-sample/simple.def 2020-08-05 02:41:14.000000000 +0200 +++ new/cpplint-1.6.1/samples/codelite-sample/simple.def 2022-08-20 15:27:23.000000000 +0200 @@ -3,10 +3,10 @@ 4 Done processing src/pptable.cpp Done processing src/pptable.h -Total errors found: 680 +Total errors found: 681 src/pptable.cpp:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5] -src/pptable.cpp:1: Include the directory when naming .h files [build/include_subdir] [4] +src/pptable.cpp:1: Include the directory when naming header files [build/include_subdir] [4] src/pptable.cpp:6: { should almost always be at the end of the previous line [whitespace/braces] [4] src/pptable.cpp:7: Tab found; better to use spaces [whitespace/tab] [1] src/pptable.cpp:8: Tab found; better to use spaces [whitespace/tab] [1] @@ -332,6 +332,7 @@ src/pptable.cpp:341: Tab found; better to use spaces [whitespace/tab] [1] src/pptable.cpp:341: Missing spaces around = [whitespace/operators] [4] src/pptable.cpp:341: Missing spaces around < [whitespace/operators] [3] +src/pptable.cpp:341: Using C-style cast. Use static_cast<size_t>(...) instead [readability/casting] [4] src/pptable.cpp:342: Tab found; better to use spaces [whitespace/tab] [1] src/pptable.cpp:343: Tab found; better to use spaces [whitespace/tab] [1] src/pptable.cpp:345: Tab found; better to use spaces [whitespace/tab] [1] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/samples/silly-sample/src/sillycode.cpp new/cpplint-1.6.1/samples/silly-sample/src/sillycode.cpp --- old/cpplint-1.5.4/samples/silly-sample/src/sillycode.cpp 2020-08-05 02:59:48.000000000 +0200 +++ new/cpplint-1.6.1/samples/silly-sample/src/sillycode.cpp 2022-08-20 15:29:41.000000000 +0200 @@ -2,7 +2,7 @@ #include <gtest/test.h> - +#include <something.hh> class Date { // ... public: @@ -31,7 +31,7 @@ string s; char ch2; - X& operator=(const X& a); + X& operator=(const X& a); // NOLINT(clang-analyzer-valist.Uninitialized) X(const X&); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/samples/vlc-sample/simple.def new/cpplint-1.6.1/samples/vlc-sample/simple.def --- old/cpplint-1.5.4/samples/vlc-sample/simple.def 2020-08-05 02:41:14.000000000 +0200 +++ new/cpplint-1.6.1/samples/vlc-sample/simple.def 2022-08-20 15:27:23.000000000 +0200 @@ -11,7 +11,7 @@ src/libvlc.c:48: Found C system header after other header. Should be: libvlc.h, c system, c++ system, other. [build/include_order] [4] src/libvlc.c:49: Found C system header after other header. Should be: libvlc.h, c system, c++ system, other. [build/include_order] [4] src/libvlc.c:50: Found C system header after other header. Should be: libvlc.h, c system, c++ system, other. [build/include_order] [4] -src/libvlc.c:71: Include the directory when naming .h files [build/include_subdir] [4] +src/libvlc.c:71: Include the directory when naming header files [build/include_subdir] [4] src/libvlc.c:75: Found C system header after other header. Should be: libvlc.h, c system, c++ system, other. [build/include_order] [4] src/libvlc.c:86: Extra space before [ [whitespace/braces] [5] src/libvlc.c:86: Extra space after ( in function call [whitespace/parens] [4] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/setup.cfg new/cpplint-1.6.1/setup.cfg --- old/cpplint-1.5.4/setup.cfg 2020-08-18 02:50:19.000000000 +0200 +++ new/cpplint-1.6.1/setup.cfg 2022-08-20 16:13:02.822642600 +0200 @@ -1,7 +1,5 @@ [aliases] test = pytest -style = flake8 -ci = lint style test [tool:pytest] python_files = *test.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cpplint-1.5.4/setup.py new/cpplint-1.6.1/setup.py --- old/cpplint-1.5.4/setup.py 2020-08-05 02:41:14.000000000 +0200 +++ new/cpplint-1.6.1/setup.py 2022-04-18 11:38:55.000000000 +0200 @@ -73,7 +73,7 @@ long_description=open('README.rst').read(), license='BSD-3-Clause', setup_requires=[ - "pytest-runner" + "pytest-runner==5.2" ], tests_require=test_required, # extras_require allow pip install .[dev] ++++++ drop-sre-compile.patch ++++++ ++++ 1775 lines (skipped)