Skip to content

Commit cf5535e

Browse files
authored
Merge pull request #1948 from kursatyurt/pre-commit-hooks
Pre-commit hooks for Formatting
2 parents 316ef59 + 18fbded commit cf5535e

File tree

316 files changed

+52218
-43629
lines changed

Some content is hidden

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

316 files changed

+52218
-43629
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ BasedOnStyle: Google
22
PointerAlignment: Left
33
DerivePointerAlignment: false
44
ColumnLimit: 120
5+
SortIncludes: Never

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ assignees: ''
2626
- C++ compiler and version: [e.g., g++ (GCC) 4.8.5]
2727
- MPI implementation and version: [e.g., OpenMPI 3.0.0]
2828
- SU2 Version: [e.g., v6.2.0]
29-

.github/pull_request_template.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Proposed Changes
22
*Give a brief overview of your contribution here in a few sentences.*
3-
3+
44

55

66
## Related Work
@@ -14,5 +14,6 @@
1414
- [ ] I am submitting my contribution to the develop branch.
1515
- [ ] My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
1616
- [ ] My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
17+
- [ ] I used the pre-commit hook to prevent dirty commits and used `pre-commit run --all` to format old commits.
1718
- [ ] I have added a test case that demonstrates my contribution, if necessary.
1819
- [ ] I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

.github/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ changelog:
1717
- title: 'Other Changes'
1818
labels:
1919
- "*"
20-

.github/workflows/code-style.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Code Style
2+
on:
3+
pull_request:
4+
paths:
5+
- "**.[ch]pp"
6+
- "**.[ch]"
7+
- "**.cfg"
8+
- "**.py"
9+
10+
jobs:
11+
formatting:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Setup python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.10'
20+
check-latest: true
21+
- name: Install pre-commit
22+
run: pip install pre-commit
23+
- name: Run checks
24+
run: pre-commit run -a -v
25+
- name: Git status
26+
if: always()
27+
run: git status
28+
- name: Full diff
29+
if: always()
30+
run: git diff

.github/workflows/release-management.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,3 @@ jobs:
6565
asset_path: ${{matrix.os_bin}}.zip
6666
asset_name: SU2-${{ steps.update_release.outputs.tagname }}-${{matrix.os_bin}}.zip
6767
asset_content_type: application/zip
68-

.lgtm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extraction:
22
cpp:
33
prepare:
4-
packages:
4+
packages:
55
- libboost-all-dev
66
configure:
77
command:

.pep8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[pycodestyle]
2+
max_line_length = 120
3+
ignore = E402
4+
in-place = true
5+
aggressive = 2
6+
recursive = true

.pre-commit-config.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
repos:
2+
# Official repo for the clang-format hook
3+
- repo: https://github.com/pre-commit/mirrors-clang-format
4+
rev: "v15.0.7"
5+
hooks:
6+
- id: clang-format
7+
exclude: |
8+
(?x)^(
9+
^Common/include/CConfig.hpp|
10+
^Common/include/option_structure.hpp|
11+
^Common/src/CConfig.cpp|
12+
^SU2_CFD|
13+
^externals|
14+
^subprojects|
15+
^TestCases|
16+
^legacy
17+
)
18+
types_or: [c++, c]
19+
# black repo for python formatting
20+
- repo: https://github.com/ambv/black
21+
rev: 22.6.0
22+
hooks:
23+
- id: black
24+
exclude: |
25+
(?x)^(
26+
^SU2_CFD|
27+
^externals|
28+
^subprojects|
29+
^TestCases|
30+
^legacy
31+
)
32+
# Official repo for default hooks
33+
- repo: https://github.com/pre-commit/pre-commit-hooks
34+
rev: "v4.4.0"
35+
hooks:
36+
- id: mixed-line-ending
37+
exclude: |
38+
(?x)^(
39+
^SU2_CFD|
40+
^externals|
41+
^subprojects|
42+
^TestCases|
43+
^legacy
44+
)
45+
- id: trailing-whitespace
46+
exclude: |
47+
(?x)^(
48+
^SU2_CFD|
49+
^externals|
50+
^subprojects|
51+
^TestCases|
52+
^legacy
53+
)
54+
- id: end-of-file-fixer
55+
exclude: |
56+
(?x)^(
57+
^SU2_CFD|
58+
^externals|
59+
^subprojects|
60+
^TestCases|
61+
^legacy
62+
)

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ sudo: required
66

77
language: c++
88

9-
cache:
9+
cache:
1010
- ccache
1111
- pip
12-
- directories:
12+
- directories:
1313
- $HOME/.pyenv_cache
1414

1515
compiler:
@@ -19,7 +19,7 @@ notifications:
1919
email:
2020
recipients:
2121
22-
22+
2323
branches:
2424
only:
2525
- develop
@@ -81,7 +81,7 @@ before_script:
8181

8282
# Get the tutorial cases
8383
- git clone --depth=1 -b develop https://github.com/su2code/su2code.github.io ./Tutorials
84-
84+
8585
# Enter the SU2/TestCases/ directory, which is now ready to run
8686
- cd TestCases/
8787

0 commit comments

Comments
 (0)