You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 34abb5c
Browse filesBrowse the repository at this point in the historyBrowse files
- Labeler: Assigns [labels](https://github.com/AliceO2Group/O2Physics/labels) to the PR based on which parts of the code base were modified.
103
+
- Labeler: Assigns [labels](https://github.com/AliceO2Group/O2Physics/labels) to the PR based on which parts of the repository were modified.
101
104
- Title prefix checker: Verifies that the title of the PR has a valid prefix with tags corresponding to the labels. If a valid prefix is not found, it is created.
102
105
103
-
-__Policy when dealing with linter / code-checker__
104
-
- It is agreed that the issues brought up by linter and code-checker tools should be fixed on a best-effort basis.
105
-
- However, for the purposes of merging, the linter checks are not mandatory.
106
-
- The final decision on merging PRs is taken by the code owners.
106
+
__Policy when dealing with code analysis checks__
107
+
108
+
- It is agreed that the issues brought up by code analysis tools (linters) should be fixed on a best-effort basis.
109
+
- However, for the purposes of merging, the linter checks are not mandatory.
110
+
- The final decision on merging PRs is taken by the code owners.
107
111
108
112
Checks flagged as "Required" must succeed before a PR can be merged.
109
113
@@ -112,7 +116,7 @@ PRs from first-time contributors (who have not authored any commit in the reposi
112
116
113
117
If a check fails, you can click on the name of the check to see more information about the errors in the log of the test.
114
118
115
-
If the clang-format check (or a formatting linter in MegaLinter) fails, an automatic PR with the formatting fixes is opened in your fork and a notification email is sent to you.
119
+
If the clang-format check (or a formatter in MegaLinter) fails, an automatic PR with the formatting fixes is opened in your fork and a notification email is sent to you.
116
120
You have to merge this formatting PR to update your branch (and your opened PR).
Copy file name to clipboardExpand all lines: docs/gettingstarted/installing.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -336,6 +336,10 @@ This requires that you have successfully built Git branch `[branch]` (e.g. `mast
336
336
You also need to have `direnv` installed and hooked (see [instructions](https://direnv.net/docs/installation.html)) to load the correct build environment automatically when you enter the build directory (and to unload it when you exit).
337
337
```
338
338
339
+
```tip
340
+
This works also if you are developing in a different Git branch and you just want to compile changes on top of the full build of the `master` branch.
341
+
```
342
+
339
343
```warning
340
344
This only builds O2Physics. If you have updated O2 or alidist, you first need to do a full build with aliBuild.
Copy file name to clipboardExpand all lines: docs/tools/README.md
+23-14Lines changed: 23 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,20 +33,21 @@ See the dedicated [O2 linter](o2linter.md) page.
33
33
Pre-commit hooks run when you execute `git commit` and are used to validate the staged changes that are about to be committed.
34
34
If any hook fails, the commit is not made.
35
35
36
-
In the O2Physics repository, pre-commit hooks are [configured](https://github.com/AliceO2Group/O2Physics/blob/master/.pre-commit-config.yaml) to format C++ code with [clang-format](https://clang.llvm.org/docs/ClangFormat.html) and lint it (check for issues) with [cpplint](https://github.com/cpplint/cpplint).
37
-
This way you can make sure that your changes will pass the C++ formatting check and the cpplint check in [MegaLinter](https://megalinter.io/) when you make your pull request.
36
+
In the O2Physics repository, pre-commit hooks are [configured](https://github.com/AliceO2Group/O2Physics/blob/master/.pre-commit-config.yaml) to detect invalid files and to format and check code using some of the tools included in the [automatic CI checks](../gettingstarted/contributingtocode.md#automatic-checks).
37
+
This way you can make sure that your changes will pass the same checks on GitHub when you make your pull request.
1.[Install pre-commit](https://pre-commit.com/#installation) (typically `pip install pre-commit` or `pipx install pre-commit`).
42
42
1. Enter the `O2Physics` directory.
43
43
1.[Install the Git hook scripts](https://pre-commit.com/#3-install-the-git-hook-scripts): `pre-commit install`.
44
44
45
45
Next time you execute `git commit`, the hooks will run automatically.
46
46
47
-
- If the clang-format hook fails, it means your staged files have been formatted.
48
-
- If the cpplint hook fails, the linter has found issues that need to be fixed.
49
-
- Updated files need to be staged with `git add` before attempting `git commit` again.
47
+
- If a formatting hook fails, it means your staged files have been formatted.
48
+
- If a linter hook fails, the linter has found issues that should be fixed.
49
+
- Updated files need to be staged with `git add` in order to include the changes in the next attempt to commit them.
50
+
- If needed, the pre-commit hooks can be skipped entirely with `git commit -n` or selectively (see the [documentation](https://pre-commit.com/#temporarily-disabling-hooks)).
@@ -67,6 +68,10 @@ Without further options, you can run Clang-Tidy with
67
68
clang-tidy file1 file2 ...
68
69
```
69
70
71
+
```tip
72
+
This is the best option when you are developing in a different Git branch and you just [compile changes](../gettingstarted/installing.md#building-partially-for-development-using-ninja) on top of the full build of the `master` branch.
73
+
```
74
+
70
75
### Running with O2Physics-code-check
71
76
72
77
Clang-Tidy runs on O2Physics PRs as the O2Physics-code-check tool under the `build/O2Physics/code-check` CI check, using the repository configuration.
@@ -76,16 +81,20 @@ You can run the check locally to test C++ files modified since `<base-commit>` u
where `<base-commit>` is typically `master` and `<head-commit>` is `HEAD` by default if `ALIBUILD_HEAD_HASH` is omitted.
84
+
where `<base-commit>` is typically `upstream/master` and `<head-commit>` is `HEAD` by default if `ALIBUILD_HEAD_HASH` is omitted.
80
85
If `ALIBUILD_BASE_HASH` is omitted, all tracked C++ files are analysed.
81
86
82
-
Enabled checks can be modified with the `O2PHYSICS_CHECKER_CHECKS=...` option.
87
+
Enabled checks can be modified with the `-e O2PHYSICS_CHECKER_CHECKS=...` option.
83
88
84
-
Fixes can be enabled with the `O2PHYSICS_CHECKER_FIX=1` option.
89
+
Fixes can be enabled with the `-e O2PHYSICS_CHECKER_FIX=1` option.
90
+
91
+
```warning
92
+
Running O2Physics-code-check involves building O2Physics which might mean a full build of the current branch in case you have not done it yet.
93
+
```
85
94
86
95
### Checking naming conventions
87
96
88
-
The [`readability-identifier-naming`](https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-naming.html) check can fix deviations from the [naming conventions](https://rawgit.com/AliceO2Group/CodingGuidelines/master/naming_formatting.html).
97
+
The [`readability-identifier-naming`](https://clang.llvm.org/extra/clang-tidy/checks/readability/identifier-naming.html) check can fix deviations from the [naming conventions](https://aliceo2group.github.io/CodingGuidelines/naming_formatting.html).
89
98
90
99
```tip
91
100
Learn how to form a [correct camelCase name](https://google.github.io/styleguide/javaguide.html#s5.3-camel-case).
@@ -125,16 +134,16 @@ Headers from the same project should be included using quotation marks (`#includ
125
134
Failing to do so points the preprocessor to a [wrong location](https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html) and can result in picking a wrong header.
126
135
See also the [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf12-prefer-the-quoted-form-of-include-for-files-relative-to-the-including-file-and-the-angle-bracket-form-everywhere-else).
127
136
128
-
The [`format_includes.awk`](https://github.com/AliceO2Group/O2Physics/blob/master/Scripts/format_includes.awk) script allows to fix the include format in a provided O2Physics file.
137
+
The [`format_includes.py`](https://github.com/AliceO2Group/O2Physics/blob/master/Scripts/format_includes.py) script allows to fix the include format in provided O2Physics files.
129
138
130
-
To fix the include format in all `.h`, `.cxx`files in O2Physics, execute:
139
+
To fix the include format in files in O2Physics, execute:
The include format is corrected automatically in O2Physics PRs as part of the automatic formatting PR created by the [clang-format CI check](../gettingstarted/contributingtocode.md#automatic-checks).
146
+
The include format is corrected automatically in O2Physics PRs as part of the automatic formatting PR created by the [clang-format CI check](../gettingstarted/contributingtocode.md#automatic-checks). You can also run the script automatically as a [pre-commit hook](#pre-commit-hooks).
Copy file name to clipboardExpand all lines: docs/tools/o2linter.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,10 +28,14 @@ The [`o2_linter.py`](https://github.com/AliceO2Group/O2Physics/blob/master/Scrip
28
28
You can execute the script locally from the O2Physics directory with:
29
29
30
30
```bash
31
-
python3 Scripts/o2_linter.py <files>
31
+
Scripts/o2_linter.py file1 file2 ...
32
32
```
33
33
34
-
Example: `python3 Scripts/o2_linter.py $(find . -path ./.git -prune -o -type f)` to lint all O2Physics files.
34
+
Example: `Scripts/o2_linter.py $(find . -path ./.git -prune -o -type f)` to lint all O2Physics files.
35
+
36
+
### As a pre-commit hook
37
+
38
+
If you enable pre-commit hooks in your local repository, O2 linter will check your staged files before each commit. See [the instructions](README.md#pre-commit-hooks).
0 commit comments