Skip to content

Commit a884312

Browse files
authored
Release trial follow up (#41)
* adapt node-binding into a CLI package * better docs * enforce LF on JS files at checkout * create eslint config & add CI job to run it * bump min node engine per codacy advise
1 parent c0f1ea5 commit a884312

24 files changed

+756
-64
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
*.css text eol=lf
99
*.md text eol=lf
1010
*.rs text eol=lf
11+
*.js text eol=lf
12+
*.ts text eol=lf
1113
*.yaml text eol=lf
1214
*.toml text eol=lf
1315
*.lock text eol=lf

.github/workflows/pre-commit-hooks.yml

+12
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,15 @@ jobs:
2929
run: cargo clippy
3030
- name: cargo fmt
3131
run: cargo fmt --check
32+
33+
eslint:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-node@v4
38+
with:
39+
node-version: 20
40+
cache: yarn
41+
- run: yarn install
42+
- run: yarn run eslint
43+
working-directory: node-binding

README.md

+139-24
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
<!-- markdownlint-disable MD041 -->
2+
3+
[file-annotations]: https://cpp-linter.github.io/cpp_linter_rs/cli#-a---file-annotations
4+
[thread-comments]: https://cpp-linter.github.io/cpp_linter_rs/cli#-g---thread-comments
5+
[step-summary]: https://cpp-linter.github.io/cpp_linter_rs/cli#-w---step-summary
6+
[tidy-review]: https://cpp-linter.github.io/cpp_linter_rs/cli#-d---tidy-review
7+
[format-review]: https://cpp-linter.github.io/cpp_linter_rs/cli#-m---format-review
8+
9+
[format-annotations-preview]: docs/src/images/annotations-clang-format.png
10+
[tidy-annotations-preview]: docs/src/images/annotations-clang-tidy.png
11+
[step-summary-preview]: docs/src/images/step-summary.png
12+
[thread-comment-preview]: docs/src/images/comment.png
13+
[tidy-review-preview]: docs/src/images/tidy-review.png
14+
[format-review-preview]: docs/src/images/format-review.png
15+
[format-suggestion-preview]: docs/src/images/format-suggestion.png
16+
217
[![Python packaging][py-build-badge]][py-build-ci]
318
[![Binary executable builds][bin-build-badge]][bin-build-ci]
419
[![node-js builds][node-ci-badge]][node-ci]
520
[![Test CI][test-ci-badge]][test-ci]
621
[![Docs][docs-ci-badge]][docs-site]
722
[![Pre-commit-ci][pre-commit-badge]][pre-commit-ci]
8-
923
[![codecov-status][codecov-badge]][codecov-project]
10-
[![docs.rs][docs-rs-badge]][docs-rs]
11-
[![PyPI - Version][pypi-badge]][pypi-pkg]
12-
[![Crates.io Version][crates-io-badge]][crates-io-pkg]
13-
[![NPM Version][npm-badge]][npm-pkg]
1424

1525
[py-build-ci]: https://github.com/cpp-linter/cpp_linter_rs/actions/workflows/python-packaging.yml
1626
[py-build-badge]: https://github.com/cpp-linter/cpp_linter_rs/actions/workflows/python-packaging.yml/badge.svg
@@ -30,20 +40,78 @@
3040
[docs-rs]: https://docs.rs/cpp-linter
3141
[pypi-badge]: https://img.shields.io/pypi/v/cpp-linter
3242
[pypi-pkg]: https://pypi.org/project/cpp-linter/
43+
[test-pypi-badge]: https://img.shields.io/pypi/v/cpp-linter?pypiBaseUrl=https%3A%2F%2Ftest.pypi.org&label=test-pypi
44+
[test-pypi-pkg]: https://test.pypi.org/project/cpp-linter/
3345
[crates-io-badge]: https://img.shields.io/crates/v/cpp-linter
3446
[crates-io-pkg]: https://crates.io/crates/cpp-linter
3547
[npm-badge]: https://img.shields.io/npm/v/%40cpp-linter%2Fcpp-linter
3648
[npm-pkg]: https://www.npmjs.com/package/@cpp-linter/cpp-linter
3749

3850
# C/C++ Linting Package
3951

40-
A Python and Rust package for linting C/C++ code with clang-tidy and/or clang-format to collect feedback provided in the form of thread comments, step summary, or file annotations.
52+
A package for linting C/C++ code with clang-tidy and/or clang-format to collect feedback provided in the form of
53+
54+
- [x] [thread-comments](#thread-comment)
55+
- [x] [step-summary](#step-summary)
56+
- [x] [file-annotations](#annotations)
57+
- [x] [Pull Request Review](#pull-request-review) suggestions
4158

4259
> [!CAUTION]
4360
> This project is still experimental and subject to drastic changes.
44-
> Please use the pure python [cpp-linter](https://github.com/cpp-linter/cpp-linter)
61+
> Please use the [pure python cpp-linter](https://github.com/cpp-linter/cpp-linter)
4562
> package until this project is ready for deployment.
4663
64+
## Install
65+
66+
This package is available in several programming languages (through their respective package managers).
67+
68+
### Rust
69+
70+
[![Crates.io Version][crates-io-badge]][crates-io-pkg]
71+
[![docs.rs][docs-rs-badge]][docs-rs]
72+
73+
Install from source code hosted at crates.io:
74+
75+
```text
76+
cargo install cpp-linter
77+
```
78+
79+
Install a pre-compiled binary from GitHub releases:
80+
81+
First [install `cargo-binstall`](https://github.com/cargo-bins/cargo-binstall?tab=readme-ov-file#installation).
82+
83+
```text
84+
cargo binstall cpp-linter
85+
```
86+
87+
### Python
88+
89+
[![PyPI - Version][pypi-badge]][pypi-pkg]
90+
91+
Install the python package:
92+
93+
```text
94+
pip install cpp-linter
95+
```
96+
97+
[![testPyPI - Version][test-pypi-badge]][test-pypi-pkg]
98+
99+
Pre-releases are uploaded to test-pypi:
100+
101+
```text
102+
pip install -i https://test.pypi.org/simple/ cpp-linter
103+
```
104+
105+
### Node.js
106+
107+
[![NPM Version][npm-badge]][npm-pkg]
108+
109+
Install the Node.js binding:
110+
111+
```text
112+
npm -g install @cpp-linter/cpp-linter
113+
```
114+
47115
## Usage
48116

49117
For usage in a CI workflow, see
@@ -52,56 +120,103 @@ For usage in a CI workflow, see
52120
For the description of supported Command Line Interface options, see
53121
[the CLI documentation](https://cpp-linter.github.io/cpp_linter_rs/cli.html).
54122

123+
## Example
124+
125+
### Annotations
126+
127+
Using [`--file-annotations`][file-annotations]:
128+
129+
#### clang-format annotations
130+
131+
![clang-format annotations][format-annotations-preview]
132+
133+
#### clang-tidy annotations
134+
135+
![clang-tidy annotations][tidy-annotations-preview]
136+
137+
### Thread Comment
138+
139+
Using [`--thread-comments`][thread-comments]:
140+
141+
![sample thread-comment][thread-comment-preview]
142+
143+
### Step Summary
144+
145+
Using [`--step-summary`][step-summary]:
146+
147+
![step summary][step-summary-preview]
148+
149+
### Pull Request Review
150+
151+
#### Only clang-tidy
152+
153+
Using [`--tidy-review`][tidy-review]:
154+
155+
![sample tidy-review][tidy-review-preview]
156+
157+
#### Only clang-format
158+
159+
Using [`--format-review`][format-review]:
160+
161+
![sample format-review][format-review-preview]
162+
163+
![sample format-suggestion][format-suggestion-preview]
164+
55165
## Have question or feedback?
56166

57167
To provide feedback (requesting a feature or reporting a bug) please post to
58168
[issues](https://github.com/cpp-linter/cpp_linter_rs/issues).
59169

60170
## License
61171

62-
The scripts and documentation in this project are released under the [MIT][MIT].
172+
The scripts and documentation in this project are released under the [MIT].
63173

64174
Dependencies (that are redistributed by us in binary form) have the following
65175
license agreements:
66176

67177
- [clap](https://crates.io/crates/clap):
68-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
178+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
69179
- [git2](https://crates.io/crates/git2):
70-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
180+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
71181

72182
The following are conditionally included in binaries (using the `openssl-vendored` feature on a
73183
case-by-case basis) because it is a dependency of git2:
74184

75185
- [openssl](https://crates.io/crates/openssl): Licensed under [Apache 2.0][Apache2]
76186
- [openssl-probe](https://crates.io/crates/openssl-probe):
77-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
187+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
78188

79189
- [lenient_semver](https://crates.io/crates/lenient_semver):
80-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
190+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
81191
- [log](https://crates.io/crates/log):
82-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
192+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
83193
- [regex](https://crates.io/crates/regex):
84-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
194+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
85195
- [reqwest](https://crates.io/crates/reqwest):
86-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
196+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
87197
- [semver](https://crates.io/crates/semver):
88-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
198+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
89199
- [serde](https://crates.io/crates/serde):
90-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
91-
- [serde-xml-rs](https://crates.io/crates/serde-xml-rs): Licensed under [MIT][MIT].
200+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
201+
- [serde-xml-rs](https://crates.io/crates/serde-xml-rs): Licensed under [MIT].
92202
- [serde_json](https://crates.io/crates/serde_json):
93-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
94-
- [which](https://crates.io/crates/which): Licensed under [MIT][MIT].
95-
- [tokio](https://crates.io/crates/tokio): Licensed under [MIT][MIT].
203+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
204+
- [which](https://crates.io/crates/which): Licensed under [MIT].
205+
- [tokio](https://crates.io/crates/tokio): Licensed under [MIT].
96206
- [futures](https://crates.io/crates/futures):
97-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
207+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
98208
- [chrono](https://crates.io/crates/chrono):
99-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
209+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
100210

101211
The python binding uses
102212

103213
- [pyo3](https://crates.io/crates/pyo3):
104-
Dual-licensed under [Apache 2.0][Apache2] or [MIT][MIT].
214+
Dual-licensed under [Apache 2.0][Apache2] or [MIT].
215+
216+
The node binding uses
217+
218+
- [napi](https://crates.io/crates/napi): Licensed under [MIT]
219+
- [napi-derive](https://crates.io/crates/napi-derive): Licensed under [MIT]
105220

106221
[MIT]: https://choosealicense.com/licenses/mit
107222
[Apache2]: https://choosealicense.com/licenses/apache-2.0/

cspell.config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
version: "0.2"
22
language: en
33
words:
4+
- binstall
45
- Boolish
56
- bugprone
67
- chrono
@@ -15,6 +16,7 @@ words:
1516
- iomanip
1617
- libgit
1718
- markdownlint
19+
- maturin
1820
- mdbook
1921
- msvc
2022
- napi
@@ -25,6 +27,8 @@ words:
2527
- pybind
2628
- pyfunction
2729
- pymodule
30+
- pypi
31+
- pyproject
2832
- ratelimit
2933
- reqwest
3034
- revparse

docs/src/SUMMARY.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
- [Command Line Interface](./cli.md)
77
- [Token Permissions](./permissions.md)
88
- [Pull Request Review Caveats](./pr-review-caveats.md)
9+
- [Python Binding](./python.md)
10+
- [Node.js Binding](./node.md)
19.9 KB
Loading
23.9 KB
Loading

docs/src/images/comment.png

22.3 KB
Loading

docs/src/images/format-review.png

26.5 KB
Loading

docs/src/images/format-suggestion.png

32.7 KB
Loading

docs/src/images/step-summary.png

51.1 KB
Loading

docs/src/images/tidy-review.png

59.4 KB
Loading

docs/src/index.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1+
<!-- markdownlint-disable MD041 MD053 -->
12

2-
<!-- markdownlint-disable MD041 -->
3+
[file-annotations]: cli.md#-a---file-annotations
4+
[thread-comments]: cli.md#-g---thread-comments
5+
[step-summary]: cli.md#-w---step-summary
6+
[tidy-review]: cli.md#-d---tidy-review
7+
[format-review]: cli.md#-m---format-review
38

4-
{{#include ../../README.md}}
9+
[format-annotations-preview]: images/annotations-clang-format.png
10+
[tidy-annotations-preview]: images/annotations-clang-tidy.png
11+
[step-summary-preview]: images/step-summary.png
12+
[thread-comment-preview]: images/comment.png
13+
[tidy-review-preview]: images/tidy-review.png
14+
[format-review-preview]: images/format-review.png
15+
[format-suggestion-preview]: images/format-suggestion.png
16+
17+
{{#include ../../README.md:16:}}

docs/src/node.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Node.js Binding
2+
3+
{{#include ../../node-binding/README.md:2:}}

docs/src/python.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python Binding
2+
3+
{{#include ../../py-binding/README.md:2:}}

0 commit comments

Comments
 (0)