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
Just create a `yml` file under your GitHub repository. For example `.github/workflows/cpp-linter.yml`
11
+
Github Actions for linting C/C++ code. Integrated clang-tidy, clang-format check.
8
12
9
-
!!! Requires `secrets.GITHUB_TOKEN` set to an environment variable named `GITHUB_TOKEN`.
13
+
## Usage
10
14
11
-
```yml
15
+
Create a new GitHub Actions workflow in your project, e.g. at `.github/workflows/cpp-linter.yml`
16
+
17
+
The conetent of the file should be in the following format.
18
+
19
+
```yaml
12
20
name: cpp-linter
13
21
14
22
# Triggers the workflow on push or pull request events
@@ -28,30 +36,34 @@ jobs:
28
36
with:
29
37
style: 'file'
30
38
```
31
-
## Optional Inputs
32
39
33
-
| Input name | default value | Description |
40
+
`GITHUB_TOKEN` - Provided by Github (see [Authenticating with the GITHUB_TOKEN](https://docs.github.com/en/actions/reference/authentication-in-a-workflow))
41
+
42
+
### Optional Inputs
43
+
44
+
| Name | Default | Description |
34
45
|------------|---------------|-------------|
35
-
| style | 'llvm' | The style rules to use. Set this to 'file' to have clang-format use the closest relative .clang-format file. |
36
-
| extensions | 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx' | The file extensions to run the action against. This is a comma-separated string. |
37
-
| tidy-checks | 'boost-\*,bugprone-\*,performance-\*,<br>readability-\*,portability-\*,<br>modernize-\*,clang-analyzer-\*,<br>cppcoreguidelines-\*' | A string of regex-like patterns specifying what checks clang-tidy will use.|
38
-
| repo-root | '.' | The relative path to the repository root directory. This path is relative to path designated by the runner's GITHUB_WORKSPACE environment variable. |
39
-
| version | '10' | The desired version of the clang tools to use. Accepted options are strings which can be 6.0, 7, 8, 9, 10, 11, 12. |
46
+
| `style` | 'llvm' | The style rules to use. Set this to 'file' to have clang-format use the closest relative .clang-format file. |
47
+
| `extensions` | 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx' | The file extensions to run the action against. This is a comma-separated string. |
48
+
| `tidy-checks` | 'boost-\*,bugprone-\*,performance-\*,<br>readability-\*,portability-\*,<br>modernize-\*,clang-analyzer-\*,<br>cppcoreguidelines-\*' | A string of regex-like patterns specifying what checks clang-tidy will use.|
49
+
| `repo-root` | '.' | The relative path to the repository root directory. This path is relative to path designated by the runner's GITHUB_WORKSPACE environment variable. |
50
+
| `version` | '10' | The desired version of the clang tools to use. Accepted options are strings which can be 6.0, 7, 8, 9, 10, 11, 12. |
40
51
41
52
### Outputs
42
53
43
54
This action creates 1 output variable named `checks-failed`. Even if the linting checks fail for source files this action will still pass, but users' CI workflows can use this action's output to exit the workflow early if that is desired.
44
55
45
-
## Results of GitHub Actions
56
+
## Example
57
+
58
+

46
59
47
-

60
+
Example comment is [here](https://github.com/shenxianpeng/cpp-linter-action/pull/5#commitcomment-55252014).
48
61
49
-
Behind the scenes, this is because this repository has added `test.yml` under `.github/workflows/`. When an unformatted C/C++ source file was committed and create a Pull Request will automatically recognize and add warning comments.
62
+
## Have question or feedback?
50
63
51
-
Please feel free to commit code to the `test` branch of this repository or create a Pull Request to see how the process works.
64
+
To provide feedback (requesting a feature or reporting a bug) please post to [issues](https://github.com/shenxianpeng/cpp-linter-action/issues).
52
65
53
-
For example, this test PR [#6](https://github.com/shenxianpeng/cpp-linter-action/pull/5) and github-actions bot comments [link](https://github.com/shenxianpeng/cpp-linter-action/pull/5#commitcomment-55252014).
54
66
55
-
## Contribution
67
+
## License
56
68
57
-
If you have any suggestions or contributions, welcome to PR [here](https://github.com/shenxianpeng/cpp-linter-action).
69
+
The scripts and documentation in this project are released under the [MIT License](LICENSE)
0 commit comments