Skip to content

Commit 8a37d6a

Browse files
authored
Merge pull request #2152 from Exiv2/mainClangFormat
clang-format whole project + new CI workflow for checking style
2 parents 98f9822 + 9111801 commit 8a37d6a

File tree

216 files changed

+73719
-79040
lines changed

Some content is hidden

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

216 files changed

+73719
-79040
lines changed

.clang-format

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# Indentation for all files
3+
ColumnLimit: 120
4+
5+
# C++ Options
6+
Language: Cpp
7+
BasedOnStyle: Google
8+
9+
# Useful for sorting the project inclusions and standard library inclusions separately
10+
IncludeBlocks: Preserve
11+
12+
# Constructor initializers better formatted in presence of preprocessor conditions (see image.cpp)
13+
BreakConstructorInitializers: AfterColon
14+
15+
# Do not allow SingleLine statements (to improve coverage statistics)
16+
AllowShortFunctionsOnASingleLine: None
17+
AllowShortIfStatementsOnASingleLine: false
18+
AllowShortLoopsOnASingleLine: false
19+
20+
...

.clang-format.optional

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Clang Format Checker
2+
on: [push]
3+
jobs:
4+
clang-format-checking:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- uses: DoozyX/[email protected]
9+
with:
10+
source: '.'
11+
exclude: './xmpsdk ./contrib'
12+
extensions: 'c,h,cpp,hpp'
13+
clangFormatVersion: 12
14+
style: file

CONTRIBUTING.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ We welcome any help, for example contributing lens data (images), code contribut
1717

1818
Code contributions can be performed via *pull requests* (PR) on GitHub (if you cannot or do not want to use GitHub, see [3. Contributing code via email](#3-contributing-code-via-email)).
1919
For this to work you first need to [create a user account on GitHub](https://help.github.com/articles/signing-up-for-a-new-github-account/) if you don't already have one.
20-
A pull request should preferable contain only one new feature or bug fix etc. Since it is not uncommon to work on several PRs at the same time
20+
A pull request should preferable contain only one new feature, bug fix, etc. Since it is not uncommon to work on several PRs at the same time
2121
it is recommended to create a new _branch_ for each PR. In this way PRs can easily be separated and the review and merge process becomes cleaner.
2222
As a rule-of-thumb:
2323

@@ -71,22 +71,27 @@ Once you have a GitHub login:
7171
$ rm -rf build
7272
$ mkdir build && cd build
7373
$ cmake -DCMAKE_BUILD_TYPE=Release ..
74-
$ make
74+
$ cmake --build . --parallel
7575

7676
6. Now, make your change(s), add tests for your changes, and commit each change:
7777

7878
...
79-
79+
8080
$ git commit -m "Commit message 1"
81-
81+
8282
...
83-
83+
8484
$ git commit -m "Commit message 2"
8585

86+
Please keep in mind that the project has a Continuous Integration job to check that your new code is satisfying the
87+
format defined in the file `.clang-format`. Use your preferred text editor, IDE or method to make sure your code is
88+
properly formatted before creating the PR.
89+
90+
Note: You can use the script `contrib/scripts/clangFormatWholeProject.sh` to format the whole project.
91+
8692
7. Make sure the tests pass:
8793

88-
$ make tests # Integration tests
89-
$./bin/unit_tests # Unit tests
94+
$ ctest
9095

9196
Exiv2's (new) test system is described in more detail in the [doc.md](tests/doc.md) and [writing_tests.md](tests/writing_tests.md) files, and a description of the old
9297
test system can be found in the Redmine wiki: [How do I run the test suite for Exiv2](http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_run_the_test_suite_for_Exiv2)

0 commit comments

Comments
 (0)