Add lint fixer mode
This commit is contained in:
parent
a3621b6d90
commit
de143f9033
2 changed files with 29 additions and 5 deletions
14
README.md
14
README.md
|
|
@ -34,15 +34,25 @@ flatpak run md.obsidian.Obsidian
|
||||||
Start the server:
|
Start the server:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd sync-server && cargo run config-e2e.yml
|
cargo install sqlx-cli cargo-machete
|
||||||
|
cd sync-server
|
||||||
|
cargo run config-e2e.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd frontend && npm install && npm run dev
|
cd frontend
|
||||||
|
npm install
|
||||||
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
### Scripts
|
### Scripts
|
||||||
|
|
||||||
|
#### Before pushing
|
||||||
|
|
||||||
|
```sh
|
||||||
|
scripts/check.sh --fix
|
||||||
|
```
|
||||||
|
|
||||||
#### Update HTTP API TS bindings
|
#### Update HTTP API TS bindings
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,25 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Parse arguments
|
||||||
|
FIX_MODE=false
|
||||||
|
if [[ "$1" == "--fix" ]]; then
|
||||||
|
FIX_MODE=true
|
||||||
|
echo "Running in fix mode - will automatically fix linting and formatting issues"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Running checks in sync-server"
|
echo "Running checks in sync-server"
|
||||||
cd sync-server
|
cd sync-server
|
||||||
cargo test --verbose
|
cargo test --verbose
|
||||||
cargo clippy --all-targets --all-features
|
|
||||||
cargo fmt --all -- --check
|
if [[ "$FIX_MODE" == true ]]; then
|
||||||
|
cargo clippy --all-targets --all-features --fix --allow-dirty --allow-staged
|
||||||
|
cargo fmt --all
|
||||||
|
else
|
||||||
|
cargo clippy --all-targets --all-features
|
||||||
|
cargo fmt --all -- --check
|
||||||
|
fi
|
||||||
|
|
||||||
cargo machete
|
cargo machete
|
||||||
|
|
||||||
echo "Running checks in frontend"
|
echo "Running checks in frontend"
|
||||||
|
|
@ -16,7 +30,7 @@ npm run build
|
||||||
npm run test
|
npm run test
|
||||||
npm run lint
|
npm run lint
|
||||||
|
|
||||||
if [[ $(git status --porcelain) ]]; then
|
if [[ "$FIX_MODE" == false ]] && [[ $(git status --porcelain) ]]; then
|
||||||
git status --porcelain
|
git status --porcelain
|
||||||
echo "Failing CI because the working directory is not clean after linting"
|
echo "Failing CI because the working directory is not clean after linting"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue