Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang tidy pr #5

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion StdAny/StdAny/.clang-tidy → .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,bugprone-*,clang-analyzer-*,mpi-*,misc-*,readability-*'
WarningsAsErrors: ''
HeaderFilterRegex: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: 'file'
CheckOptions:
Expand Down Expand Up @@ -184,4 +184,30 @@ CheckOptions:
value: ''
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ClassMemberPrefix
value: s_
- key: readability-identifier-naming.ClassMemberCase
value: camelBack
- key: readability-identifier-naming.MemberPrefix
value: m_
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.MethodCase
value: camelBack
- key: readability-identifier-naming.ConstantParameterCase
value: lower_case
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantCase
value: camelBack
- key: readability-identifier-naming.NamespaceCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.MacroDefinitionCase
value: UPPER_CASE
- key: readability-identifier-naming.FunctionCase
value: camelBack

2 changes: 2 additions & 0 deletions .github/actions/clang-tidy-review/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/venv
**/__pycache__
167 changes: 167 additions & 0 deletions .github/actions/clang-tidy-review/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv*/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Generated by review action
clang-tidy-review-output.json
clang-tidy-review-metadata.json

# Generated by clang-tidy
clang_tidy_review.yaml
21 changes: 21 additions & 0 deletions .github/actions/clang-tidy-review/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ubuntu:24.04

RUN apt update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends\
build-essential cmake git \
tzdata \
clang-tidy-14 \
clang-tidy-15 \
clang-tidy-16 \
clang-tidy-17 \
clang-tidy-18 \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/

COPY . /clang_tidy_review/

RUN python3 -m pip install --break-system-packages /clang_tidy_review/post/clang_tidy_review

ENTRYPOINT ["review"]
21 changes: 21 additions & 0 deletions .github/actions/clang-tidy-review/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Peter Hill

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
95 changes: 95 additions & 0 deletions .github/actions/clang-tidy-review/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: 'clang-tidy review'
author: 'Peter Hill'
description: 'Create a pull request review based on warnings from clang-tidy'
branding:
icon: 'book-open'
color: 'red'
inputs:
token:
description: 'Authentication token'
default: ${{ github.token }}
required: false
build_dir:
description: 'Directory containing the compile_commands.json file'
default: '.'
required: false
base_dir:
description: 'Absolute path to initial working directory. Useful if generating `compile_commands.json` outside of the Action'
default: ${{ github.workspace }}
require: false
clang_tidy_version:
description: 'Version of clang-tidy to use; one of 14, 15, 16, 17, 18'
default: '18'
required: false
clang_tidy_checks:
description: 'List of checks'
default: '-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*'
required: false
config_file:
description: 'Location of .clang-tidy config file. If specified, takes preference over `clang_tidy_checks`'
default: ''
required: false
include:
description: 'Comma-separated list of files or patterns to include'
default: "*.[ch],*.[ch]xx,*.[ch]pp,*.[ch]++,*.cc,*.hh"
required: false
exclude:
description: 'Comma-separated list of files or patterns to exclude'
required: false
default: ''
apt_packages:
description: 'Comma-separated list of apt packages to install'
required: false
default: ''
cmake_command:
description: 'If set, run CMake as part of the action using this command'
required: false
default: ''
max_comments:
description: 'Maximum number of comments to post at once'
required: false
default: '25'
lgtm_comment_body:
description: 'Message to post on PR if no issues are found. An empty string will post no LGTM comment.'
required: false
default: 'clang-tidy review says "All clean, LGTM! :+1:"'
split_workflow:
description: "Only generate but don't post the review, leaving it for the second workflow. Relevant when receiving PRs from forks that don't have the required permissions to post reviews."
required: false
default: false
annotations:
description: "Use annotations instead of comments. See README for limitations on annotations"
required: false
default: false
parallel:
description: "Number of tidy instances to be run in parallel. Zero will automatically determine the right number."
required: false
default: "0"
pr:
default: ${{ github.event.pull_request.number }}
repo:
default: ${{ github.repository }}
outputs:
total_comments:
description: 'Total number of warnings from clang-tidy'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- --clang_tidy_binary=clang-tidy-${{ inputs.clang_tidy_version }}
- --token=${{ inputs.token }}
- --repo=${{ inputs.repo }}
- --pr=${{ inputs.pr }}
- --build_dir=${{ inputs.build_dir }}
- --base_dir=${{ inputs.base_dir }}
- --clang_tidy_checks=${{ inputs.clang_tidy_checks }}
- --config_file=${{ inputs.config_file }}
- --include='${{ inputs.include }}'
- --exclude='${{ inputs.exclude }}'
- --apt-packages=${{ inputs.apt_packages }}
- --cmake-command='${{ inputs.cmake_command }}'
- --max-comments=${{ inputs.max_comments }}
- --lgtm-comment-body='${{ inputs.lgtm_comment_body }}'
- --split_workflow=${{ inputs.split_workflow }}
- --annotations=${{ inputs.annotations }}
- --parallel=${{ inputs.parallel }}
8 changes: 8 additions & 0 deletions .github/actions/clang-tidy-review/post/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3

COPY clang_tidy_review /clang_tidy_review

RUN pip3 install --upgrade pip && \
pip3 install /clang_tidy_review

ENTRYPOINT ["post"]
3 changes: 3 additions & 0 deletions .github/actions/clang-tidy-review/post/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Clang-Tidy Review - Post

This is a child-action that only posts the review from the [parent action](../README.md).
Loading
Loading