Skip to content

Commit b5ddf55

Browse files
authored
Merge branch 'develop' into printing
2 parents 2e723e9 + d67ae99 commit b5ddf55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4978
-1357
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test
2+
on: [push, pull_request]
3+
jobs:
4+
build-test:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
python-version: ['3.9', 'pypy3.10']
9+
fail-fast: false
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
architecture: x64
21+
cache: 'pip'
22+
cache-dependency-path: '**/dev-requirements'
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
python -m pip install -e .[dev]
27+
- name: Test with tox
28+
run: tox

.pre-commit-hooks.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- id: cpplint
2+
name: cpplint
3+
description: Static code analysis of C/C++ files
4+
language: python
5+
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
6+
entry: cpplint

.pylintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[BASIC]
22
include-naming-hint=yes
3-
method-rgx=[A-Z_][A-Za-z0-9]{2,49}$
4-
function-rgx=[A-Z_][A-Za-z0-9]{2,49}$|main|unicode_escape_decode
3+
method-rgx=[A-Z_][A-Za-z0-9]{2,49}$|__init__
4+
function-rgx=[A-Z_][A-Za-z0-9]{2,49}$|main
55
const-rgx=[a-zA-Z_][A-Za-z0-9_]{2,49}$
66
variable-rgx=[a-z_][a-z0-9_]{0,49}$
77
argument-rgx=[a-z_][a-z0-9_]{0,49}$
@@ -15,6 +15,7 @@ disable=
1515
no-else-return,
1616
no-self-use,
1717
consider-merging-isinstance,
18+
consider-using-min-builtin,
1819
bad-continuation,
1920
fixme,
2021
bad-option-value,

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

CONTRIBUTING.rst

Lines changed: 63 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Thanks for your interest in contributing to cpplint.
66
Any kinds of contributions are welcome: Bug reports, Documentation, Patches.
77

88
However cpplint is a bit special as a project because it aims to closely follow what Google does in the upstream repository.
9-
That means Google remains the source of all major requirements and functinoality of cpplint, where as this fork adds extensions to cpplint run on more environments and in more companies.
9+
That means Google remains the source of all major requirements and functionality of cpplint, where as this fork adds extensions to cpplint run on more environments and in more companies.
1010
The difference between this cpplint and Google should remain so small that anyone can at a glance see there is no added change that could be regarded as a security vulnerability.
1111

1212
Here are some tips to make best use of your time:
@@ -29,40 +29,77 @@ Non-Goals:
2929
Development
3030
-----------
3131

32+
For many tasks, it is okay to just develop using a single installed python version. But if you need to test/debug the project in multiple python versions, you need to install those versions::
33+
34+
1. (Optional) Install multiple python versions
35+
36+
1. (Optional) Install [pyenv](https://github.com/pyenv/pyenv-installer) to manage python versions
37+
2. (Optional) Using pyenv, install the python versions used in testing::
38+
39+
pyenv install 2.7.16
40+
pyenv install 3.6.8
41+
# ...
42+
pyenv local 2.7.16 3.6.8 ...
43+
44+
It may be okay to run and test python against locally installed libraries, but if you need to have a consistent build, it is recommended to manage your environment using virtualenv: [virtualenv](https://virtualenv.pypa.io/en/latest/ ), [virtualenvwrapper](https://pypi.org/project/virtualenvwrapper/ ):
45+
46+
1. (Optional) Setup a local virtual environment with all necessary tools and libraries::
47+
48+
mkvirtualenv cpplint [-p /usr/bin/python3]
49+
pip install .[dev]
50+
51+
Alternatively you can locally install patches like this::
52+
53+
pip install -e .[dev]
54+
# for usage without virtualenv, add --user
55+
3256
You can setup your local environment for developing patches for cpplint like this:
3357

3458
.. code-block:: bash
3559
36-
pip install --user -e .[dev]
37-
./setup.py lint
38-
./setup.py style
60+
# run a single test
61+
pytest --no-cov cpplint_unittest.py -k testExclude
62+
# run a single CLI integration test
63+
pytest --no-cov cpplint_clitest.py -k testSillySample
64+
# run all tests
3965
./setup.py test
66+
./setup.py lint
4067
./setup.py ci # all the above
41-
./tox # all of the above in all python environments
68+
./flake8
69+
tox # all of the above in all python environments
4270
4371
Releasing
4472
---------
4573

74+
The release process first prepares the documentation, then publishes to testpypi to verify, then releases to real pypi. Testpypi acts like real pypi, so broken releases cannot be deleted. For a typical bugfixing release, no special issue on testpypi is expected (but it's still good practice).
75+
4676
To release a new version:
4777

4878
.. code-block:: bash
4979
50-
vi setup.py # increment the version
80+
# prepare files for release
81+
vi cpplint.py # increment the version
5182
vi changelog.rst # log changes
52-
git add setup.py changelog.rst
53-
git commit -m "Releasing 0.0.6"
54-
git tag 0.0.6
55-
git push
56-
git push --tags
57-
pip install --upgrade setuptools wheels twine
83+
git add cpplint.py changelog.rst
84+
git commit -m "Releasing x.y.z"
85+
# test-release (on env by mkvirtualenv -p /usr/bin/python3)
86+
pip install --upgrade setuptools wheel twine
87+
rm -rf dist
88+
# Test release, requires account on testpypi
5889
python3 setup.py sdist bdist_wheel
59-
twine upload dist/*
90+
twine upload --repository testpypi dist/*
91+
# ... Check website and downloads from https://test.pypi.org/project/cpplint/
92+
# Actual release
93+
twine upload dist/*
94+
git tag x.y.z
95+
git push --tags
6096
97+
After releasing, it is be good practice to comment on github for closed tickets, to notify authors.
6198

6299
Catching up with Upstream
63100
-------------------------
64101

65-
For maintainers, it is a regular duty to look at what cpplint changes were merged upstream, to include them in this fork.
102+
For maintainers, it is a regular duty to look at what cpplint changes were merged upstream, to include them in this fork (though these updates happen once per year and less).
66103

67104
Checkout here and upstream google:
68105

@@ -77,13 +114,22 @@ To incorporate google's changes:
77114
.. code-block:: bash
78115
79116
git fetch google gh-pages
117+
118+
## Merge workflow (clean, no new commits)
119+
git checkout master -b updates
120+
git merge google/gh-pages # this will have a lot of conflicts
121+
# ... solve conflicts
122+
git merge -- continue
123+
124+
## Rebase workflow (dirty, creates new commits)
80125
git checkout -b updates FETCH_HEAD
81126
git rebase master # this will have a lot of conflicts, most of which can be solved with the next command (run repeatedly)
82127
# solve conflicts with files deleted in our fork (this is idempotent and safe to be called. when cpplint.py has conflicts, it will do nothing)
83-
git status | grep 'new file:' | awk '{print $3}' | xargs -r git rm --cached ; git status | grep 'deleted by us' | awk '{print $4}' | xargs -r git rm ; git status --untracked-files=no | grep 'nothing to commit' && git rebase --skip
128+
git status | grep 'new file:' | awk '{print $3}' | xargs -r git rm --cached ; git status | grep 'deleted by us' | awk '{print $4}' | xargs -r git rm
129+
git status --untracked-files=no | grep 'nothing to commit' && git rebase --skip
84130
85131
git push -u origin updates
86-
# check travis
132+
# check github action
87133
git push origin --delete updates
88134
89135
git rebase updates master
@@ -103,7 +149,7 @@ Setup fetching of pull requests in .git/config:
103149
url = https://github.com/google/styleguide
104150
fetch = +refs/heads/*:refs/remotes/google/*
105151
# following line should be new, fetches PRs from google/styleguides
106-
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
152+
fetch = +refs/pull/*/head:refs/remotes/google/pr/*
107153
108154
109155
To compare this for with upstream (after git fetch):

MANIFEST.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# MANIFEST.in file required to deliver test files with source tar
22
include *.py
33
include LICENSE
4+
include test-requirements
5+
include dev-requirements
46

57
# all samples for clitest
68
graft samples
9+
10+
global-exclude .tox
11+
global-exclude *~
12+
global-exclude __pycache__
13+
global-exclude .coverage
14+
global-exclude *.py[co]
15+
global-exclude *.db
16+
global-exclude .git*
17+
global-exclude *.orig

README.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
cpplint - static code checker for C++
22
=====================================
33

4-
.. image:: https://travis-ci.org/cpplint/cpplint.svg?branch=master
5-
:target: https://travis-ci.org/cpplint/cpplint
6-
74
.. image:: https://img.shields.io/pypi/v/cpplint.svg
85
:target: https://pypi.python.org/pypi/cpplint
96

@@ -26,9 +23,10 @@ cpplint - static code checker for C++
2623
:target: https://pypi.python.org/pypi/cpplint
2724

2825
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>`_.
29-
Cpplint is developed and maintained by Google Inc. at `google/styleguide <https://github.com/google/styleguide>`_, also see see the `wikipedia entry <http://en.wikipedia.org/wiki/Cpplint>`_
26+
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>`_
3027

3128
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.
29+
Also see discussion here https://github.com/google/styleguide/pull/528.
3230

3331

3432
Installation
@@ -56,17 +54,18 @@ For full usage instructions, run:
5654
Changes
5755
-------
5856

59-
The modifications in this fork are minor fixes and cosmetic changes:
57+
The modifications in this fork are minor fixes and cosmetic changes, such as:
6058

61-
* more default extensions
6259
* python 3 compatibility
60+
* more default file extensions
6361
* customizable file extensions with the --extensions argument
64-
* continuous integration on travis
62+
* continuous integration on github
6563
* support for recursive file discovery via the --recursive argument
6664
* support for excluding files via --exclude
6765
* JUnit XML output format
6866
* Overriding repository root auto-detection via --repository
6967
* Support ``#pragma once`` as an alternative to header include guards
68+
* ... and a few more (most of which are open PRs on upstream)
7069

7170

7271
Acknowledgements

0 commit comments

Comments
 (0)