forked from cda-tum/mqt-qmap
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add pre-commit configuration (cda-tum#101)
This PR adds an initial [pre-commit](https://pre-commit.com/) configuration to the SyReC project. Pre-commit is used for ensuring proper formatting across the whole code base and all file types and additionally lints the Python part of the project. Running it is as easy as ```console nox -rs lint ``` > `nox` is best installed via `pipx install nox` (or `brew install nox` if you are on macOS). If you don't have `pipx` (pip for applications) you can install it with `pip install pipx` (or `brew install pipx` if you are on macOS). Most formatting guidelines are applied automatically. For the linter warnings, suggestions are provided in many cases. This PR also runs pre-commit over the complete code base and applies all suggestions and formatting guidelines. Signed-off-by: burgholzer <[email protected]>
- Loading branch information
1 parent
a62dd68
commit 41b3b5e
Showing
32 changed files
with
925 additions
and
571 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 |
---|---|---|
@@ -1,82 +1,82 @@ | ||
# Generated from CLion C/C++ Code Style settings | ||
BasedOnStyle: LLVM | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: Consecutive | ||
AlignConsecutiveDeclarations: Consecutive | ||
AlignEscapedNewlines: Left | ||
AlignOperands: AlignAfterOperator | ||
AlignTrailingComments: true | ||
AllowAllArgumentsOnNextLine: true | ||
BasedOnStyle: LLVM | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: Consecutive | ||
AlignConsecutiveDeclarations: Consecutive | ||
AlignEscapedNewlines: Left | ||
AlignOperands: AlignAfterOperator | ||
AlignTrailingComments: true | ||
AllowAllArgumentsOnNextLine: true | ||
AllowAllConstructorInitializersOnNextLine: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: Empty | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortEnumsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortIfStatementsOnASingleLine: WithoutElse | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BreakBeforeBraces: Custom | ||
AllowShortBlocksOnASingleLine: Empty | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortEnumsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortIfStatementsOnASingleLine: WithoutElse | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakTemplateDeclarations: Yes | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterControlStatement: Never | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeTernaryOperators: false | ||
BreakConstructorInitializers: AfterColon | ||
BreakInheritanceList: AfterColon | ||
ColumnLimit: 0 | ||
CompactNamespaces: false | ||
ContinuationIndentWidth: 8 | ||
Cpp11BracedListStyle: true | ||
DeriveLineEnding: true | ||
EmptyLineBeforeAccessModifier: LogicalBlock | ||
IncludeBlocks: Regroup | ||
IndentCaseBlocks: false | ||
IndentCaseLabels: true | ||
IndentPPDirectives: BeforeHash | ||
IndentWidth: 4 | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
Language: Cpp | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: All | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PointerAlignment: Left | ||
ReflowComments: false | ||
SortIncludes: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCaseColon: false | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: false | ||
SpaceBeforeInheritanceColon: false | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: false | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInConditionalStatement: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: c++17 | ||
TabWidth: 4 | ||
UseTab: Never | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterUnion: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeTernaryOperators: false | ||
BreakConstructorInitializers: AfterColon | ||
BreakInheritanceList: AfterColon | ||
ColumnLimit: 0 | ||
CompactNamespaces: false | ||
ContinuationIndentWidth: 8 | ||
Cpp11BracedListStyle: true | ||
DeriveLineEnding: true | ||
EmptyLineBeforeAccessModifier: LogicalBlock | ||
IncludeBlocks: Regroup | ||
IndentCaseBlocks: false | ||
IndentCaseLabels: true | ||
IndentPPDirectives: BeforeHash | ||
IndentWidth: 4 | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
Language: Cpp | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: All | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PointerAlignment: Left | ||
ReflowComments: false | ||
SortIncludes: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCaseColon: false | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: false | ||
SpaceBeforeInheritanceColon: false | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: false | ||
SpaceBeforeSquareBrackets: false | ||
SpaceInEmptyBlock: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInAngles: false | ||
SpacesInConditionalStatement: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: c++17 | ||
TabWidth: 4 | ||
UseTab: Never |
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,4 @@ | ||
format: | ||
line_width: 100 | ||
keyword_case: "upper" | ||
autosort: true |
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,17 @@ | ||
[flake8] | ||
extend-select = B9 | ||
extend-ignore = E203, E231, E501, E722, W503, B950, B014, W504, E123, E126, E226, E121 | ||
max-line-length = 120 | ||
show-source = true | ||
exclude = | ||
.git, | ||
.idea, | ||
.eggs, | ||
__pycache__, | ||
.tox, | ||
docs/source/conf.py, | ||
build, | ||
.nox, | ||
venv, | ||
.venv | ||
application-import-names = mqt.qmap |
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
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gitsubmodule" | ||
directory: "/" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "friday" | ||
time: "06:00" | ||
day: "friday" | ||
time: "06:00" | ||
assignees: | ||
- "burgholzer" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "friday" | ||
time: "06:00" | ||
day: "friday" | ||
time: "06:00" | ||
assignees: | ||
- "burgholzer" | ||
|
||
- package-ecosystem: "pip" | ||
directory: "/" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "friday" | ||
time: "06:00" | ||
day: "friday" | ||
time: "06:00" | ||
assignees: | ||
- "burgholzer" |
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 |
---|---|---|
|
@@ -2,9 +2,9 @@ name: CI | |
|
||
on: | ||
push: | ||
branches: [ main, master ] | ||
branches: [main, master] | ||
pull_request: | ||
branches: [ main, master ] | ||
branches: [main, master] | ||
workflow_dispatch: | ||
|
||
defaults: | ||
|
@@ -13,7 +13,7 @@ defaults: | |
|
||
env: | ||
BUILD_TYPE: Release | ||
CMAKE_BUILD_PARALLEL_LEVEL: 2 | ||
CMAKE_BUILD_PARALLEL_LEVEL: 3 | ||
Z3_GIT_TAG: z3-4.8.17 | ||
|
||
jobs: | ||
|
@@ -25,8 +25,8 @@ jobs: | |
submodules: recursive | ||
- uses: DoozyX/[email protected] | ||
with: | ||
source: 'apps include src test mqt/qmap' | ||
extensions: 'h,hpp,c,cpp' | ||
source: "apps include src test mqt/qmap" | ||
extensions: "h,hpp,c,cpp" | ||
clangFormatVersion: 12 | ||
|
||
ubuntu-ci: | ||
|
@@ -40,23 +40,23 @@ jobs: | |
- uses: actions/setup-python@v4 | ||
name: Install Python | ||
with: | ||
python-version: '3.10' | ||
python-version: "3.10" | ||
|
||
- name: Installing boost | ||
run: sudo apt-get install -y libboost-program-options-dev | ||
run: sudo apt-get install -y libboost-program-options-dev | ||
|
||
- name: Install Z3 | ||
run: python -m pip install z3-solver | ||
run: python -m pip install z3-solver | ||
|
||
- name: Configure CMake | ||
run: | | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$pythonLocation/lib/python3.10/site-packages/z3/lib | ||
export Z3_ROOT=$pythonLocation/lib/python3.10/site-packages/z3 | ||
export Z3_DIR=$pythonLocation/lib/python3.10/site-packages/z3 | ||
cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_QMAP_TESTS=ON -DBINDINGS=ON | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$pythonLocation/lib/python3.10/site-packages/z3/lib | ||
export Z3_ROOT=$pythonLocation/lib/python3.10/site-packages/z3 | ||
export Z3_DIR=$pythonLocation/lib/python3.10/site-packages/z3 | ||
cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_QMAP_TESTS=ON -DBINDINGS=ON | ||
- name: Build | ||
run: | | ||
run: | | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_exact | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic_test | ||
|
@@ -68,18 +68,18 @@ jobs: | |
|
||
- name: Coverage | ||
run: | | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$pythonLocation/lib/python3.10/site-packages/z3/lib | ||
export Z3_ROOT=$pythonLocation/lib/python3.10/site-packages/z3 | ||
export Z3_DIR=$pythonLocation/lib/python3.10/site-packages/z3 | ||
cmake -S "${{github.workspace}}" -B "${{github.workspace}}/buildCov" -DCMAKE_BUILD_TYPE=Debug -DBUILD_QMAP_TESTS=ON -DCOVERAGE=ON -DBINDINGS=ON | ||
cmake --build "${{github.workspace}}/buildCov" --config Debug --target qmap_exact_test | ||
cmake --build "${{github.workspace}}/buildCov" --config Debug --target qmap_heuristic_test | ||
cd buildCov/test | ||
ctest -C $BUILD_TYPE --output-on-failure | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$pythonLocation/lib/python3.10/site-packages/z3/lib | ||
export Z3_ROOT=$pythonLocation/lib/python3.10/site-packages/z3 | ||
export Z3_DIR=$pythonLocation/lib/python3.10/site-packages/z3 | ||
cmake -S "${{github.workspace}}" -B "${{github.workspace}}/buildCov" -DCMAKE_BUILD_TYPE=Debug -DBUILD_QMAP_TESTS=ON -DCOVERAGE=ON -DBINDINGS=ON | ||
cmake --build "${{github.workspace}}/buildCov" --config Debug --target qmap_exact_test | ||
cmake --build "${{github.workspace}}/buildCov" --config Debug --target qmap_heuristic_test | ||
cd buildCov/test | ||
ctest -C $BUILD_TYPE --output-on-failure | ||
- name: Upload coverage to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
gcov: true | ||
gcov: true | ||
gcov_ignore: "extern/**/*" | ||
|
||
macOS-ci: | ||
|
@@ -91,17 +91,17 @@ jobs: | |
submodules: recursive | ||
|
||
- name: Installing boost and Z3 | ||
run: brew install boost z3 | ||
run: brew install boost z3 | ||
|
||
- name: Configure CMake | ||
run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_QMAP_TESTS=ON | ||
run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_QMAP_TESTS=ON | ||
|
||
- name: Build | ||
run: | | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_exact | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic_test | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_exact_test | ||
run: | | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_exact | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic_test | ||
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_exact_test | ||
- name: Test | ||
working-directory: ${{github.workspace}}/build/test | ||
|
@@ -117,28 +117,28 @@ jobs: | |
- uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- name: Cache Z3 | ||
id: cache-z3 | ||
id: cache-z3 | ||
uses: actions/cache@v3 | ||
with: | ||
path: z3 | ||
key: ci-${{ runner.OS }}-${{ env.Z3_GIT_TAG }}-${{ hashFiles('**/ci.yml') }} | ||
|
||
- name: Building Z3 | ||
if: steps.cache-z3.outputs.cache-hit != 'true' | ||
if: steps.cache-z3.outputs.cache-hit != 'true' | ||
run: | | ||
git clone --branch $Z3_GIT_TAG --depth 1 https://github.com/Z3Prover/z3.git | ||
cmake -S z3 -B z3/build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G "Visual Studio 17 2022" -A x64 -DZ3_BUILD_LIBZ3_SHARED=FALSE -DZ3_BUILD_EXECUTABLE=False -DZ3_BUILD_TEST_EXECUTABLES=False | ||
cmake --build z3/build --config $BUILD_TYPE | ||
git clone --branch $Z3_GIT_TAG --depth 1 https://github.com/Z3Prover/z3.git | ||
cmake -S z3 -B z3/build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G "Visual Studio 17 2022" -A x64 -DZ3_BUILD_LIBZ3_SHARED=FALSE -DZ3_BUILD_EXECUTABLE=False -DZ3_BUILD_TEST_EXECUTABLES=False | ||
cmake --build z3/build --config $BUILD_TYPE | ||
- name: Configure CMake | ||
run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -T "ClangCl" -DZ3_ROOT=z3/build -DBUILD_QMAP_TESTS=ON | ||
|
||
- name: Build | ||
run: cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE | ||
- name: Build | ||
run: cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE | ||
|
||
- name: Test | ||
- name: Test | ||
working-directory: ${{github.workspace}}/build/test | ||
run: | | ||
cd $BUILD_TYPE | ||
./qmap_exact_test | ||
./qmap_heuristic_test | ||
cd $BUILD_TYPE | ||
./qmap_exact_test | ||
./qmap_heuristic_test |
Oops, something went wrong.