linthis 0.0.3__tar.gz → 0.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- linthis-0.0.7/.github/workflows/release.yml +251 -0
- {linthis-0.0.3 → linthis-0.0.7}/.gitignore +4 -0
- {linthis-0.0.3 → linthis-0.0.7}/Cargo.lock +1 -1
- {linthis-0.0.3 → linthis-0.0.7}/Cargo.toml +1 -1
- {linthis-0.0.3 → linthis-0.0.7}/PKG-INFO +62 -11
- {linthis-0.0.3 → linthis-0.0.7}/README.md +59 -8
- {linthis-0.0.3 → linthis-0.0.7}/defaults/config.toml +19 -0
- linthis-0.0.7/docs/AUTO_SYNC.md +261 -0
- linthis-0.0.7/docs/GLOBAL_HOOKS.md +373 -0
- linthis-0.0.7/docs/SELF_UPDATE.md +283 -0
- {linthis-0.0.3 → linthis-0.0.7}/pyproject.toml +1 -1
- linthis-0.0.7/scripts/release.sh +177 -0
- linthis-0.0.7/src/checkers/cpp.rs +984 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/checkers/go.rs +28 -2
- {linthis-0.0.3 → linthis-0.0.7}/src/checkers/java.rs +42 -1
- {linthis-0.0.3 → linthis-0.0.7}/src/checkers/python.rs +41 -2
- {linthis-0.0.3 → linthis-0.0.7}/src/checkers/rust.rs +6 -1
- {linthis-0.0.3 → linthis-0.0.7}/src/checkers/typescript.rs +45 -2
- {linthis-0.0.3 → linthis-0.0.7}/src/config/cli.rs +37 -28
- {linthis-0.0.3 → linthis-0.0.7}/src/config/mod.rs +391 -35
- linthis-0.0.7/src/fixers/cpplint.rs +1309 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/fixers/mod.rs +2 -0
- linthis-0.0.7/src/fixers/source.rs +712 -0
- linthis-0.0.7/src/formatters/cpp.rs +762 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/formatters/java.rs +61 -12
- {linthis-0.0.3 → linthis-0.0.7}/src/lib.rs +178 -11
- {linthis-0.0.3 → linthis-0.0.7}/src/main.rs +1823 -283
- linthis-0.0.7/src/plugin/auto_sync.rs +373 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/plugin/cache.rs +4 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/plugin/config_manager.rs +21 -13
- {linthis-0.0.3 → linthis-0.0.7}/src/plugin/fetcher.rs +90 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/plugin/manifest.rs +69 -4
- linthis-0.0.7/src/plugin/mod.rs +300 -0
- linthis-0.0.7/src/self_update.rs +366 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/utils/mod.rs +27 -1
- {linthis-0.0.3 → linthis-0.0.7}/src/utils/output.rs +79 -12
- linthis-0.0.7/src/utils/types.rs +555 -0
- linthis-0.0.7/src/utils/unicode.rs +245 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/utils/walker.rs +1 -1
- linthis-0.0.3/.github/workflows/release.yml +0 -130
- linthis-0.0.3/src/checkers/cpp.rs +0 -417
- linthis-0.0.3/src/fixers/cpplint.rs +0 -579
- linthis-0.0.3/src/formatters/cpp.rs +0 -316
- linthis-0.0.3/src/plugin/mod.rs +0 -138
- linthis-0.0.3/src/utils/types.rs +0 -209
- {linthis-0.0.3 → linthis-0.0.7}/CHANGELOG.md +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/defaults/.clang-tidy +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/dev.sh +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/docs/config-cli-design.md +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/docs/init-hooks-design.md +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/docs/plan-ruff-integration.md +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/docs/tasks.md +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/benchmark.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/checkers/mod.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/checkers/traits.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/formatters/go.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/formatters/mod.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/formatters/python.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/formatters/rust.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/formatters/traits.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/formatters/typescript.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/plugin/loader.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/plugin/registry.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/presets/mod.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/src/utils/language.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/test-plugin-check/README.md +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/test-plugin-check/linthis-plugin.toml +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/tests/fixtures/test-plugin/linthis-plugin.toml +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/tests/fixtures/test-plugin/python/ruff.toml +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/tests/fixtures/test-plugin/rust/clippy.toml +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/tests/fixtures/test-plugin/rust/rustfmt.toml +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/tests/fixtures/us1/good.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/tests/fixtures/us1/unformatted.rs +0 -0
- {linthis-0.0.3 → linthis-0.0.7}/tests/integration/mod.rs +0 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
PACKAGE_NAME: linthis
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
# Build wheels for Linux
|
|
18
|
+
linux:
|
|
19
|
+
name: Build Linux ${{ matrix.target }}
|
|
20
|
+
runs-on: ${{ matrix.runner }}
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
include:
|
|
25
|
+
- runner: ubuntu-latest
|
|
26
|
+
target: x86_64
|
|
27
|
+
- runner: ubuntu-24.04-arm
|
|
28
|
+
target: aarch64
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
- uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: '3.11'
|
|
34
|
+
- name: Build wheels
|
|
35
|
+
uses: PyO3/maturin-action@v1
|
|
36
|
+
with:
|
|
37
|
+
target: ${{ matrix.target }}
|
|
38
|
+
args: --release --locked --out dist
|
|
39
|
+
manylinux: '2_28'
|
|
40
|
+
- name: Upload wheels
|
|
41
|
+
uses: actions/upload-artifact@v4
|
|
42
|
+
with:
|
|
43
|
+
name: wheels-linux-${{ matrix.target }}
|
|
44
|
+
path: dist
|
|
45
|
+
- name: Archive binary
|
|
46
|
+
run: |
|
|
47
|
+
ARCH=${{ matrix.target }}
|
|
48
|
+
if [ "$ARCH" = "x86_64" ]; then
|
|
49
|
+
TARGET=x86_64-unknown-linux-gnu
|
|
50
|
+
else
|
|
51
|
+
TARGET=aarch64-unknown-linux-gnu
|
|
52
|
+
fi
|
|
53
|
+
ARCHIVE_NAME=${{ env.PACKAGE_NAME }}-$TARGET
|
|
54
|
+
ARCHIVE_FILE=$ARCHIVE_NAME.tar.gz
|
|
55
|
+
|
|
56
|
+
mkdir -p $ARCHIVE_NAME
|
|
57
|
+
cp target/$TARGET/release/${{ env.PACKAGE_NAME }} $ARCHIVE_NAME/
|
|
58
|
+
tar czvf $ARCHIVE_FILE $ARCHIVE_NAME
|
|
59
|
+
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256
|
|
60
|
+
- name: Upload binary
|
|
61
|
+
uses: actions/upload-artifact@v4
|
|
62
|
+
with:
|
|
63
|
+
name: binaries-linux-${{ matrix.target }}
|
|
64
|
+
path: |
|
|
65
|
+
*.tar.gz
|
|
66
|
+
*.sha256
|
|
67
|
+
|
|
68
|
+
# Build wheels for Windows
|
|
69
|
+
windows:
|
|
70
|
+
name: Build Windows x86_64
|
|
71
|
+
runs-on: windows-latest
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/checkout@v4
|
|
74
|
+
- uses: actions/setup-python@v5
|
|
75
|
+
with:
|
|
76
|
+
python-version: '3.11'
|
|
77
|
+
- name: Build wheels
|
|
78
|
+
uses: PyO3/maturin-action@v1
|
|
79
|
+
with:
|
|
80
|
+
target: x86_64
|
|
81
|
+
args: --release --locked --out dist
|
|
82
|
+
- name: Upload wheels
|
|
83
|
+
uses: actions/upload-artifact@v4
|
|
84
|
+
with:
|
|
85
|
+
name: wheels-windows-x86_64
|
|
86
|
+
path: dist
|
|
87
|
+
- name: Archive binary
|
|
88
|
+
shell: bash
|
|
89
|
+
run: |
|
|
90
|
+
TARGET=x86_64-pc-windows-msvc
|
|
91
|
+
ARCHIVE_NAME=${{ env.PACKAGE_NAME }}-$TARGET
|
|
92
|
+
ARCHIVE_FILE=$ARCHIVE_NAME.zip
|
|
93
|
+
|
|
94
|
+
mkdir -p $ARCHIVE_NAME
|
|
95
|
+
cp target/$TARGET/release/${{ env.PACKAGE_NAME }}.exe $ARCHIVE_NAME/
|
|
96
|
+
7z a $ARCHIVE_FILE $ARCHIVE_NAME
|
|
97
|
+
sha256sum $ARCHIVE_FILE > $ARCHIVE_FILE.sha256
|
|
98
|
+
- name: Upload binary
|
|
99
|
+
uses: actions/upload-artifact@v4
|
|
100
|
+
with:
|
|
101
|
+
name: binaries-windows-x86_64
|
|
102
|
+
path: |
|
|
103
|
+
*.zip
|
|
104
|
+
*.sha256
|
|
105
|
+
|
|
106
|
+
# Build wheels for macOS
|
|
107
|
+
macos:
|
|
108
|
+
name: Build macOS ${{ matrix.target }}
|
|
109
|
+
runs-on: ${{ matrix.runner }}
|
|
110
|
+
strategy:
|
|
111
|
+
fail-fast: false
|
|
112
|
+
matrix:
|
|
113
|
+
include:
|
|
114
|
+
- runner: macos-15-intel
|
|
115
|
+
target: x86_64
|
|
116
|
+
- runner: macos-14
|
|
117
|
+
target: aarch64
|
|
118
|
+
steps:
|
|
119
|
+
- uses: actions/checkout@v4
|
|
120
|
+
- uses: actions/setup-python@v5
|
|
121
|
+
with:
|
|
122
|
+
python-version: '3.11'
|
|
123
|
+
- name: Build wheels
|
|
124
|
+
uses: PyO3/maturin-action@v1
|
|
125
|
+
with:
|
|
126
|
+
target: ${{ matrix.target }}
|
|
127
|
+
args: --release --locked --out dist
|
|
128
|
+
- name: Upload wheels
|
|
129
|
+
uses: actions/upload-artifact@v4
|
|
130
|
+
with:
|
|
131
|
+
name: wheels-macos-${{ matrix.target }}
|
|
132
|
+
path: dist
|
|
133
|
+
- name: Archive binary
|
|
134
|
+
run: |
|
|
135
|
+
ARCH=${{ matrix.target }}
|
|
136
|
+
if [ "$ARCH" = "x86_64" ]; then
|
|
137
|
+
TARGET=x86_64-apple-darwin
|
|
138
|
+
else
|
|
139
|
+
TARGET=aarch64-apple-darwin
|
|
140
|
+
fi
|
|
141
|
+
ARCHIVE_NAME=${{ env.PACKAGE_NAME }}-$TARGET
|
|
142
|
+
ARCHIVE_FILE=$ARCHIVE_NAME.tar.gz
|
|
143
|
+
|
|
144
|
+
mkdir -p $ARCHIVE_NAME
|
|
145
|
+
cp target/$TARGET/release/${{ env.PACKAGE_NAME }} $ARCHIVE_NAME/
|
|
146
|
+
tar czvf $ARCHIVE_FILE $ARCHIVE_NAME
|
|
147
|
+
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256
|
|
148
|
+
- name: Upload binary
|
|
149
|
+
uses: actions/upload-artifact@v4
|
|
150
|
+
with:
|
|
151
|
+
name: binaries-macos-${{ matrix.target }}
|
|
152
|
+
path: |
|
|
153
|
+
*.tar.gz
|
|
154
|
+
*.sha256
|
|
155
|
+
|
|
156
|
+
# Build source distribution
|
|
157
|
+
sdist:
|
|
158
|
+
name: Build sdist
|
|
159
|
+
runs-on: ubuntu-latest
|
|
160
|
+
steps:
|
|
161
|
+
- uses: actions/checkout@v4
|
|
162
|
+
- name: Build sdist
|
|
163
|
+
uses: PyO3/maturin-action@v1
|
|
164
|
+
with:
|
|
165
|
+
command: sdist
|
|
166
|
+
args: --out dist
|
|
167
|
+
- name: Upload sdist
|
|
168
|
+
uses: actions/upload-artifact@v4
|
|
169
|
+
with:
|
|
170
|
+
name: wheels-sdist
|
|
171
|
+
path: dist
|
|
172
|
+
|
|
173
|
+
# Create GitHub Release
|
|
174
|
+
github-release:
|
|
175
|
+
name: Create GitHub Release
|
|
176
|
+
runs-on: ubuntu-latest
|
|
177
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
178
|
+
needs: [linux, windows, macos, sdist]
|
|
179
|
+
steps:
|
|
180
|
+
- uses: actions/checkout@v4
|
|
181
|
+
- name: Download all binaries
|
|
182
|
+
uses: actions/download-artifact@v4
|
|
183
|
+
with:
|
|
184
|
+
pattern: binaries-*
|
|
185
|
+
path: binaries
|
|
186
|
+
merge-multiple: true
|
|
187
|
+
- name: Prepare release body
|
|
188
|
+
id: release_body
|
|
189
|
+
run: |
|
|
190
|
+
VERSION=${GITHUB_REF_NAME#v}
|
|
191
|
+
cat << EOF > release_body.md
|
|
192
|
+
## Installation
|
|
193
|
+
|
|
194
|
+
\`\`\`bash
|
|
195
|
+
pip install linthis==$VERSION
|
|
196
|
+
# or
|
|
197
|
+
pip install --upgrade linthis
|
|
198
|
+
\`\`\`
|
|
199
|
+
|
|
200
|
+
## Quick Start
|
|
201
|
+
|
|
202
|
+
\`\`\`bash
|
|
203
|
+
# Run linthis
|
|
204
|
+
linthis [-i <path>]
|
|
205
|
+
\`\`\`
|
|
206
|
+
|
|
207
|
+
See [CHANGELOG.md](CHANGELOG.md) for details.
|
|
208
|
+
EOF
|
|
209
|
+
- name: Create Release
|
|
210
|
+
uses: softprops/action-gh-release@v2
|
|
211
|
+
with:
|
|
212
|
+
files: binaries/*
|
|
213
|
+
generate_release_notes: true
|
|
214
|
+
body_path: release_body.md
|
|
215
|
+
draft: false
|
|
216
|
+
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
|
|
217
|
+
env:
|
|
218
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
219
|
+
|
|
220
|
+
# Publish to PyPI
|
|
221
|
+
publish-pypi:
|
|
222
|
+
name: Publish to PyPI
|
|
223
|
+
runs-on: ubuntu-latest
|
|
224
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
225
|
+
needs: [linux, windows, macos, sdist]
|
|
226
|
+
permissions:
|
|
227
|
+
id-token: write
|
|
228
|
+
steps:
|
|
229
|
+
- uses: actions/download-artifact@v4
|
|
230
|
+
with:
|
|
231
|
+
pattern: wheels-*
|
|
232
|
+
merge-multiple: true
|
|
233
|
+
path: dist
|
|
234
|
+
- name: Publish to PyPI
|
|
235
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
236
|
+
|
|
237
|
+
# Publish to crates.io
|
|
238
|
+
publish-crates:
|
|
239
|
+
name: Publish to crates.io
|
|
240
|
+
runs-on: ubuntu-latest
|
|
241
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
242
|
+
needs: [linux, windows, macos, sdist]
|
|
243
|
+
steps:
|
|
244
|
+
- uses: actions/checkout@v4
|
|
245
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
246
|
+
- name: Run tests
|
|
247
|
+
run: cargo test --locked
|
|
248
|
+
- name: Publish to crates.io
|
|
249
|
+
env:
|
|
250
|
+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
251
|
+
run: cargo publish --locked
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: linthis
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Environment :: Console
|
|
6
6
|
Classifier: Intended Audience :: Developers
|
|
@@ -16,9 +16,9 @@ Author: zhlinh
|
|
|
16
16
|
License: MIT
|
|
17
17
|
Requires-Python: >=3.8
|
|
18
18
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
19
|
-
Project-URL: Repository, https://github.com/zhlinh/linthis
|
|
20
|
-
Project-URL: Homepage, https://github.com/zhlinh/linthis
|
|
21
19
|
Project-URL: Documentation, https://docs.rs/linthis
|
|
20
|
+
Project-URL: Homepage, https://github.com/zhlinh/linthis
|
|
21
|
+
Project-URL: Repository, https://github.com/zhlinh/linthis
|
|
22
22
|
|
|
23
23
|
# linthis
|
|
24
24
|
|
|
@@ -76,14 +76,17 @@ linthis init
|
|
|
76
76
|
# Create global configuration file
|
|
77
77
|
linthis init -g
|
|
78
78
|
|
|
79
|
-
#
|
|
80
|
-
linthis init --hook
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
# Create global git hook template (for all new repos)
|
|
80
|
+
linthis init -g --hook-type git
|
|
81
|
+
|
|
82
|
+
# Initialize with pre-commit hooks (project-level)
|
|
83
|
+
linthis init --hook-type prek
|
|
84
|
+
linthis init --hook-type pre-commit
|
|
85
|
+
linthis init --hook-type git
|
|
83
86
|
|
|
84
87
|
# Force overwrite existing files
|
|
85
88
|
linthis init --force
|
|
86
|
-
linthis init --hook prek -f
|
|
89
|
+
linthis init --hook-type prek -f
|
|
87
90
|
```
|
|
88
91
|
|
|
89
92
|
### Basic Usage
|
|
@@ -506,7 +509,45 @@ All modifications preserve TOML file format and comments.
|
|
|
506
509
|
|
|
507
510
|
### Pre-commit Hook
|
|
508
511
|
|
|
509
|
-
#### Method 1:
|
|
512
|
+
#### Method 1: Global Hook Template (One-time Setup)
|
|
513
|
+
|
|
514
|
+
Set up a global Git hook template that applies to all new repositories:
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
# Create global hook template
|
|
518
|
+
linthis init -g --hook-type git
|
|
519
|
+
|
|
520
|
+
# All new repos will automatically include the hook
|
|
521
|
+
git init new-project
|
|
522
|
+
cd new-project
|
|
523
|
+
# .git/hooks/pre-commit is already set up!
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
For existing repositories:
|
|
527
|
+
```bash
|
|
528
|
+
cd existing-project
|
|
529
|
+
git init # Re-apply template
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
**Features:**
|
|
533
|
+
- 🎯 **Smart Detection**: Only runs if project has linthis config
|
|
534
|
+
- 🔗 **Hook Chaining**: Supports `.git/hooks/pre-commit.local` for project-specific hooks
|
|
535
|
+
- 🚫 **Zero Interference**: Projects without linthis config are not affected
|
|
536
|
+
- ⚡ **One-time Setup**: Works for all your new repositories
|
|
537
|
+
|
|
538
|
+
**Pros:**
|
|
539
|
+
- One-time setup for all your projects
|
|
540
|
+
- No need to configure hooks per project
|
|
541
|
+
- Perfect for personal development
|
|
542
|
+
- Won't interfere with other projects or hook tools
|
|
543
|
+
|
|
544
|
+
**Cons:**
|
|
545
|
+
- Not shared with team members
|
|
546
|
+
- Requires manual setup on each machine
|
|
547
|
+
|
|
548
|
+
See [Global Hooks Guide](docs/GLOBAL_HOOKS.md) for details.
|
|
549
|
+
|
|
550
|
+
#### Method 2: Using prek (Recommended for Teams)
|
|
510
551
|
|
|
511
552
|
[prek](https://prek.j178.dev) is a high-performance Git hooks manager written in Rust, fully compatible with pre-commit config format but much faster.
|
|
512
553
|
|
|
@@ -540,7 +581,7 @@ Install hook:
|
|
|
540
581
|
prek install
|
|
541
582
|
```
|
|
542
583
|
|
|
543
|
-
#### Method
|
|
584
|
+
#### Method 3: Traditional Git Hook (Project-level)
|
|
544
585
|
|
|
545
586
|
Add to `.git/hooks/pre-commit`:
|
|
546
587
|
|
|
@@ -549,7 +590,12 @@ Add to `.git/hooks/pre-commit`:
|
|
|
549
590
|
linthis --staged --check-only
|
|
550
591
|
```
|
|
551
592
|
|
|
552
|
-
|
|
593
|
+
Or use linthis to create it automatically:
|
|
594
|
+
```bash
|
|
595
|
+
linthis init --hook-type git
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
#### Method 4: Using pre-commit Framework
|
|
553
599
|
|
|
554
600
|
Using the [pre-commit](https://pre-commit.com/) framework:
|
|
555
601
|
|
|
@@ -688,6 +734,11 @@ The ref can specify:
|
|
|
688
734
|
|
|
689
735
|
This allows you to lock plugin versions or use development versions.
|
|
690
736
|
|
|
737
|
+
## Documentation
|
|
738
|
+
|
|
739
|
+
- [Plugin Auto-Sync](docs/AUTO_SYNC.md) - Automatic plugin synchronization (inspired by oh-my-zsh)
|
|
740
|
+
- [Self Auto-Update](docs/SELF_UPDATE.md) - Automatic self-update functionality
|
|
741
|
+
|
|
691
742
|
## Development
|
|
692
743
|
|
|
693
744
|
### Build
|
|
@@ -54,14 +54,17 @@ linthis init
|
|
|
54
54
|
# Create global configuration file
|
|
55
55
|
linthis init -g
|
|
56
56
|
|
|
57
|
-
#
|
|
58
|
-
linthis init --hook
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
# Create global git hook template (for all new repos)
|
|
58
|
+
linthis init -g --hook-type git
|
|
59
|
+
|
|
60
|
+
# Initialize with pre-commit hooks (project-level)
|
|
61
|
+
linthis init --hook-type prek
|
|
62
|
+
linthis init --hook-type pre-commit
|
|
63
|
+
linthis init --hook-type git
|
|
61
64
|
|
|
62
65
|
# Force overwrite existing files
|
|
63
66
|
linthis init --force
|
|
64
|
-
linthis init --hook prek -f
|
|
67
|
+
linthis init --hook-type prek -f
|
|
65
68
|
```
|
|
66
69
|
|
|
67
70
|
### Basic Usage
|
|
@@ -484,7 +487,45 @@ All modifications preserve TOML file format and comments.
|
|
|
484
487
|
|
|
485
488
|
### Pre-commit Hook
|
|
486
489
|
|
|
487
|
-
#### Method 1:
|
|
490
|
+
#### Method 1: Global Hook Template (One-time Setup)
|
|
491
|
+
|
|
492
|
+
Set up a global Git hook template that applies to all new repositories:
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
# Create global hook template
|
|
496
|
+
linthis init -g --hook-type git
|
|
497
|
+
|
|
498
|
+
# All new repos will automatically include the hook
|
|
499
|
+
git init new-project
|
|
500
|
+
cd new-project
|
|
501
|
+
# .git/hooks/pre-commit is already set up!
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
For existing repositories:
|
|
505
|
+
```bash
|
|
506
|
+
cd existing-project
|
|
507
|
+
git init # Re-apply template
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
**Features:**
|
|
511
|
+
- 🎯 **Smart Detection**: Only runs if project has linthis config
|
|
512
|
+
- 🔗 **Hook Chaining**: Supports `.git/hooks/pre-commit.local` for project-specific hooks
|
|
513
|
+
- 🚫 **Zero Interference**: Projects without linthis config are not affected
|
|
514
|
+
- ⚡ **One-time Setup**: Works for all your new repositories
|
|
515
|
+
|
|
516
|
+
**Pros:**
|
|
517
|
+
- One-time setup for all your projects
|
|
518
|
+
- No need to configure hooks per project
|
|
519
|
+
- Perfect for personal development
|
|
520
|
+
- Won't interfere with other projects or hook tools
|
|
521
|
+
|
|
522
|
+
**Cons:**
|
|
523
|
+
- Not shared with team members
|
|
524
|
+
- Requires manual setup on each machine
|
|
525
|
+
|
|
526
|
+
See [Global Hooks Guide](docs/GLOBAL_HOOKS.md) for details.
|
|
527
|
+
|
|
528
|
+
#### Method 2: Using prek (Recommended for Teams)
|
|
488
529
|
|
|
489
530
|
[prek](https://prek.j178.dev) is a high-performance Git hooks manager written in Rust, fully compatible with pre-commit config format but much faster.
|
|
490
531
|
|
|
@@ -518,7 +559,7 @@ Install hook:
|
|
|
518
559
|
prek install
|
|
519
560
|
```
|
|
520
561
|
|
|
521
|
-
#### Method
|
|
562
|
+
#### Method 3: Traditional Git Hook (Project-level)
|
|
522
563
|
|
|
523
564
|
Add to `.git/hooks/pre-commit`:
|
|
524
565
|
|
|
@@ -527,7 +568,12 @@ Add to `.git/hooks/pre-commit`:
|
|
|
527
568
|
linthis --staged --check-only
|
|
528
569
|
```
|
|
529
570
|
|
|
530
|
-
|
|
571
|
+
Or use linthis to create it automatically:
|
|
572
|
+
```bash
|
|
573
|
+
linthis init --hook-type git
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
#### Method 4: Using pre-commit Framework
|
|
531
577
|
|
|
532
578
|
Using the [pre-commit](https://pre-commit.com/) framework:
|
|
533
579
|
|
|
@@ -666,6 +712,11 @@ The ref can specify:
|
|
|
666
712
|
|
|
667
713
|
This allows you to lock plugin versions or use development versions.
|
|
668
714
|
|
|
715
|
+
## Documentation
|
|
716
|
+
|
|
717
|
+
- [Plugin Auto-Sync](docs/AUTO_SYNC.md) - Automatic plugin synchronization (inspired by oh-my-zsh)
|
|
718
|
+
- [Self Auto-Update](docs/SELF_UPDATE.md) - Automatic self-update functionality
|
|
719
|
+
|
|
669
720
|
## Development
|
|
670
721
|
|
|
671
722
|
### Build
|
|
@@ -75,6 +75,10 @@ cpplint_fix = true
|
|
|
75
75
|
# Auto-detection searches up to 6 levels: cmake*/, build*/, out*/, *_build/, *-build/
|
|
76
76
|
# and platform dirs: android/, ios/, arm*/, x86*/, debug/, release/, static/, shared/
|
|
77
77
|
# compile_commands_dir = "cmake_build/debug/Android/static/arm64-v8a"
|
|
78
|
+
# Cpplint line length (default: 80, common values: 100, 120)
|
|
79
|
+
linelength = 120
|
|
80
|
+
# Cpplint filter rules (comma-separated, -category to disable, +category to enable)
|
|
81
|
+
# cpplint_filter = "-build/c++11,-build/c++14"
|
|
78
82
|
|
|
79
83
|
# Cpplint fixer settings
|
|
80
84
|
[cpp.cpplint_fix]
|
|
@@ -86,3 +90,18 @@ header_guard_mode = "fix_name"
|
|
|
86
90
|
# copyright_template = "// Copyright {year} Your Company. All rights reserved."
|
|
87
91
|
# Header guard prefix (optional)
|
|
88
92
|
# header_guard_prefix = "MYPROJECT_"
|
|
93
|
+
|
|
94
|
+
# Objective-C settings (different from C++)
|
|
95
|
+
[oc]
|
|
96
|
+
# Cpplint line length for OC
|
|
97
|
+
linelength = 120
|
|
98
|
+
# Cpplint filter rules - disable checks not applicable to Objective-C
|
|
99
|
+
cpplint_filter = "-build/c++11,-build/c++14,-build/header_guard,-build/include,-legal/copyright,-readability/casting,-runtime/references,-runtime/int,-whitespace/braces,-whitespace/blank_line,-readability/braces,-whitespace/empty_if_body"
|
|
100
|
+
|
|
101
|
+
# Plugin settings
|
|
102
|
+
[plugin]
|
|
103
|
+
# Auto-sync settings (inspired by oh-my-zsh auto-update)
|
|
104
|
+
[plugin.auto_sync]
|
|
105
|
+
enabled = true # Enable automatic plugin synchronization
|
|
106
|
+
mode = "prompt" # Sync mode: "auto" (automatic), "prompt" (ask before sync), "disabled"
|
|
107
|
+
interval_days = 7 # Check for updates every N days
|