-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cpp-linter action (and improve coverage #199)
* Add cpp-linter action * Include OpenCV to lint frqi.cpp * Add to .gitignore * Added tests/coverage * Refactored ShorSim to increase coverage * Remove non-emulated shor sim (see issue #26) * Use plain std::unique_ptr to store the quantum computation for the simulators
- Loading branch information
Showing
39 changed files
with
1,477 additions
and
1,584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
FormatStyle: file | ||
|
||
Checks: | | ||
clang-diagnostic-*, | ||
clang-analyzer-*, | ||
boost-*, | ||
bugprone-*, | ||
-bugprone-easily-swappable-parameters, | ||
clang-analyzer-*, | ||
cppcoreguidelines-*, | ||
-cppcoreguidelines-non-private-member-variables-in-classes, | ||
-cppcoreguidelines-special-member-functions, | ||
-cppcoreguidelines-avoid-magic-numbers, | ||
-cppcoreguidelines-macro-usage, | ||
google-*, | ||
-google-readability-todo, | ||
-google-build-using-namespace, | ||
misc-*, | ||
-misc-no-recursion, | ||
-misc-non-private-member-variables-in-classes, | ||
modernize-*, | ||
-modernize-use-trailing-return-type, | ||
performance-*, | ||
portability-*, | ||
readability-*, | ||
-readability-identifier-length, | ||
-readability-magic-numbers, | ||
-readability-function-cognitive-complexity | ||
CheckOptions: | ||
- key: readability-identifier-naming.ClassCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.ClassIgnoredRegexp | ||
value: ".*ZX.*|.*SWAP.*|.*CEX.*|.*DD.*|.*EQ.*" | ||
- key: readability-identifier-naming.ConstantParameterCase | ||
value: camelBack | ||
- key: readability-identifier-naming.EnumCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.EnumConstantCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.FunctionCase | ||
value: camelBack | ||
- key: readability-identifier-naming.FunctionIgnoredRegexp | ||
value: ".*ZX.*|.*SWAP.*|.*CEX.*|.*DD.*|.*EQ.*" | ||
- key: readability-identifier-naming.GlobalConstantCase | ||
value: UPPER_CASE | ||
- key: readability-identifier-naming.IgnoreMainLikeFunctions | ||
value: "true" | ||
- key: readability-identifier-naming.LocalConstantCase | ||
value: camelBack | ||
- key: readability-identifier-naming.LocalVariableCase | ||
value: camelBack | ||
- key: readability-identifier-naming.MemberCase | ||
value: camelBack | ||
- key: readability-identifier-naming.MemberIgnoredRegexp | ||
value: ".*ZX.*|.*SWAP.*|.*CEX.*|.*DD.*|.*EQ.*" | ||
- key: readability-identifier-naming.MethodCase | ||
value: camelBack | ||
- key: readability-identifier-naming.ParameterCase | ||
value: camelBack | ||
- key: readability-identifier-naming.ParameterIgnoredRegexp | ||
value: ".*ZX.*|.*SWAP.*|.*CEX.*|.*DD.*|.*EQ.*|.*_" | ||
- key: readability-identifier-naming.ConstantParameterIgnoredRegexp | ||
value: ".*ZX.*|.*SWAP.*|.*CEX.*|.*DD.*|.*EQ.*|.*_" | ||
- key: readability-identifier-naming.NamespaceCase | ||
value: lower_case | ||
- key: readability-identifier-naming.StaticConstantCase | ||
value: UPPER_CASE | ||
- key: readability-identifier-naming.StructCase | ||
value: CamelCase | ||
- key: readability-identifier-naming.VariableCase | ||
value: camelBack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: cpp-linter | ||
|
||
on: | ||
pull_request: | ||
merge_group: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
cpp-linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Install OpenCV | ||
run: sudo apt install libopencv-dev | ||
- name: Generate compilation database | ||
run: CC=clang-14 CXX=clang++-14 cmake -S . -B build -DBINDINGS=ON -DBUILD_DDSIM_TESTS=ON | ||
- name: Run cpp-linter | ||
id: linter | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
pipx run cpp-linter \ | ||
--version=14 \ | ||
--style="file" \ | ||
--tidy-checks="" \ | ||
--thread-comments=true \ | ||
--files-changed-only=true \ | ||
--ignore="build" \ | ||
--database=build | ||
- name: Fail if linter found errors | ||
if: steps.linter.outputs.checks-failed > 0 | ||
run: echo "Linter found errors" && exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ __pycache__/ | |
.pytest_cache/ | ||
.ipynb_checkpoints/ | ||
.ruff_cache/ | ||
.cpp-linter_cache/ | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.