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
* initial attempt (#25)
* change test action to my branch
* adjust workflow triggers
* try log grouping with logger.critical()
* change logger's format
* don't upgrade pip; test some new features
* test fake submodule; show me args.ignore on boot
* considering alternate fmt for ignore option
* remove fake submodule (it worked);
* action inputs can't take a sequence; delimit by \n
* specifying `--ignore` better
* fix exit early when no files found
* list_source_files() is malfunctioning???
* Revert "list_source_files() is malfunctioning???"
This reverts commit 59522e0.
* is ignore option causing malfunction?
* show me what paths are being skipped
* show me which paths are crawled
* show me which files are considered as src files
* show me comparison of ignored paths
* change done debug statements
* fix debugging statement in is_file_ignored()
* skip comparing empty strings in ignored paths
* maybe a bug about ignoring root dir
* try getting python latest from src
* python src build needs deps. revert to apt build
* try using tojson()
* bad yml fmt
* try a different json approach
* make yml array an explicit str
* try forcing it as a py list
* abandon json idea
* try new log_cmder and !ignore prefix
* need to separate a single str into multi args
* use pipe char as delimiters
* slightly different approach to passing ignore val
* might need to switch to 1 line of input
* how to handle spaces in a path among multiple
* no need to escape quotes
* fix debug prompts; and workflow-triggered paths
* fix cpp-linter-test action's triggered paths
* check action stil works without using new features
* try log cmds to annotate
* try abbotations again
* use a long unlikely string as default ignore
* try annotating with line and columns
* try \n with minimal parameters
* does file need changes to show annotation?
* use html <br> and line's columns
* trigger annotations
* adjust annotation's output
* try CRLF
* simply can't use mult-line annotation msg
* almost ready for PR
* use proper casing in chosen style name
* adjust last commit for GNU style as well
* remove artifact
* we don't need the `re` module anymore
* new thread-comments option; update docs & README
* avoid duplicate clang-tidy comments
* [no ci] proofread README
* Fix indent in root README for mkdocs
* Use sub-headings instead of list points in README
* reviewed errors in docs
* switch test workflow to upstream action
[](https://gitpod.io/#https://github.com/shenxianpeng/cpp-linter-action)
13
13
14
-
15
-
Github Actions for linting C/C++ code. Integrated clang-tidy, clang-format check.
14
+
A Github Action for linting C/C++ code integrating clang-tidy and clang-format to collect feedback provided in the form of thread comments and/or annotations.
16
15
17
16
## Usage
18
17
19
18
Create a new GitHub Actions workflow in your project, e.g. at `.github/workflows/cpp-linter.yml`
20
19
21
-
The conetent of the file should be in the following format.
20
+
The content of the file should be in the following format.
22
21
23
22
```yaml
24
23
name: cpp-linter
@@ -31,7 +30,7 @@ on:
31
30
push:
32
31
pull_request:
33
32
types: [opened]
34
-
33
+
35
34
jobs:
36
35
cpp-linter:
37
36
name: cpp-linter
@@ -46,38 +45,99 @@ jobs:
46
45
env:
47
46
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48
47
with:
49
-
style: 'file'
48
+
style: "file"
50
49
```
51
50
52
-
`GITHUB_TOKEN` - Provided by Github (see [Authenticating with the GITHUB_TOKEN](https://docs.github.com/en/actions/reference/authentication-in-a-workflow))
53
-
54
51
### Optional Inputs
55
52
56
-
| Name | Default | Description |
57
-
|------------|---------------|-------------|
58
-
| `style` | 'llvm' | The style rules to use. Set this to 'file' to have clang-format use the closest relative .clang-format file. |
59
-
| `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. |
60
-
| `tidy-checks` | 'boost-\*,bugprone-\*,performance-\*,readability-\*,portability-\*,modernize-\*,clang-analyzer-\*,cppcoreguidelines-\*' | A string of regex-like patterns specifying what checks clang-tidy will use.|
61
-
| `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. |
62
-
| `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. |
63
-
| `diff-only` | 'false' | Set this option to 'true' to only analyse changes in the event's diff. |
64
-
| `verbosity` | '10' | This controls the action's verbosity in the workflow's logs. Supported options are defined by the python logging library's log levels. |
53
+
#### `style`
54
+
55
+
- **Description**: The style rules to use. Set this to 'file' to have clang-format use the closest relative .clang-format file.
56
+
- Default: 'llvm'
57
+
58
+
#### `extensions`
59
+
60
+
- **Description**: The file extensions to run the action against. This is a comma-separated string.
- **Description**: Comma-separated list of globs with optional '-' prefix. Globs are processed in order of appearance in the list. Globs without '-' prefix add checks with matching names to the set, globs with the '-' prefix remove checks with matching names from the set of enabled checks. This option's value is appended to the value of the 'Checks' option in a .clang-tidy file (if any).
- **Description**: The relative path to the repository root directory. This path is relative to the path designated as the runner's GITHUB_WORKSPACE environment variable.
71
+
- Default: '.'
72
+
73
+
#### `version`
74
+
75
+
- **Description**: The desired version of the clang tools to use. Accepted options are strings which can be 6.0, 7, 8, 9, 10, 11, or 12.
76
+
- Default: '10'
77
+
78
+
#### `verbosity`
79
+
80
+
- **Description**: This controls the action's verbosity in the workflow's logs. Supported options are defined by the python logging library's log levels. This option does not affect the verbosity of resulting comments or annotations.
81
+
- Default: '10'
82
+
83
+
#### `lines-changed-only`
84
+
85
+
- **Description**: Set this option to true to only analyse changes in the event's diff.
86
+
- Default: false
87
+
88
+
#### `files-changed-only`
89
+
90
+
- **Description**: Set this option to false to analyse any source files in the repo.
91
+
- Default: true
92
+
93
+
#### `ignore`
94
+
95
+
- **Description**: Set this option with string of path(s) to ignore.
96
+
- In the case of multiple paths, you can use a pipe character ('|')
97
+
to separate the multiple paths. Multiple lines are forbidden as an input to this option; it must be a single string.
98
+
- This can also have files, but the file's relative path has to be specified
99
+
as well.
100
+
- There is no need to use './' for each entry; a blank string ('') represents
101
+
the repo-root path (specified by the `repo-root` input option).
102
+
- Submodules are automatically ignored. Hidden directories (beginning with a '.') are also ignored automatically.
103
+
- Prefix a path with a bang ('!') to make it explicitly _not_ ignored - order of
104
+
multiple paths does _not_ take precedence. The '!' prefix can be applied to
105
+
a submodule's path (if desired) but not hidden directories.
106
+
- Glob patterns are not supported here. All asterick characters ('\*') are literal.
107
+
- Default: '.github'
108
+
109
+
#### `thread-comments`
110
+
111
+
- **Description**: Set this option to false to disable the use of thread comments as feedback.
112
+
- To use thread comments, the `GITHUB_TOKEN` (provided by Github to each repository) must be declared as an environment
113
+
variable. See [Authenticating with the GITHUB_TOKEN](https://docs.github.com/en/actions/reference/authentication-in-a-workflow)
114
+
- Default: true
65
115
66
116
### Outputs
67
117
68
118
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.
To provide feedback (requesting a feature or reporting a bug) please post to [issues](https://github.com/shenxianpeng/cpp-linter-action/issues).
91
151
92
-
93
152
## License
94
153
95
154
The scripts and documentation in this project are released under the [MIT License](https://github.com/shenxianpeng/cpp-linter-action/blob/master/LICENSE)
Copy file name to clipboardExpand all lines: action.yml
+41-11Lines changed: 41 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,19 @@ name: C/C++ Lint Action
2
2
description: Automatically checks push & pull request changes with clang-format & clang-tidy, then posts a comment with faulty results.
3
3
author: shenxianpeng
4
4
branding:
5
-
icon: 'check-circle'
6
-
color: 'green'
5
+
icon: "check-circle"
6
+
color: "green"
7
7
inputs:
8
+
thread-comments:
9
+
description: Set this option to false to disable the use of thread comments as feedback. Defaults to true.
10
+
required: false
11
+
default: true
8
12
style:
9
13
description: >
10
14
The style rules to use (defaults to 'llvm').
11
15
Set this to 'file' to have clang-format use the closest relative .clang-format file.
12
16
required: false
13
-
default: 'llvm'
17
+
default: "llvm"
14
18
extensions:
15
19
description: >
16
20
The file extensions to run the action against.
@@ -22,35 +26,61 @@ inputs:
22
26
A string of regex-like patterns specifying what checks clang-tidy will use.
23
27
This defaults to 'boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*'. See also clang-tidy docs for more info.
0 commit comments