Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Feb 7, 2024
1 parent d301303 commit 97fdd9a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/sg-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on: [push]

jobs:
sg-lint:
runs-on: ubuntu-latest
name: Run ast-grep lint
steps:
- name: Checkout
uses: actions/checkout@v4

- name: ast-grep lint step
uses: ast-grep/action@latest
6 changes: 0 additions & 6 deletions .github/workflows/test-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ jobs:
with:
submodules: recursive

- name: Service shouldn't depends on juniper::ID
run: bash -c '! grep "juniper::ID" -r ./ee/tabby-webserver/src/service --exclude-./ee/tabby-webserver/src/service/dao.rs'

- name: Only service can depend on tabby_db
run: bash -c '! grep "tabby_db::" -R ./ee/tabby-webserver/src --exclude-dir ./ee/tabby-webserver/src/service'

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
Expand Down
10 changes: 10 additions & 0 deletions rules/only-service-can-depend-tabby-db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
id: only-service-can-depend-tabby-db
message: Only service can depend on tabby-db
severity: error
language: rust
files:
- ./ee/tabby-webserver/src/**
ignores:
- ./ee/tabby-webserver/src/service/**
rule:
pattern: tabby_db
10 changes: 10 additions & 0 deletions rules/service-shoudnt-depend-on-juniper-id.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
id: service-shoudnt-depend-on-juniper-id
message: Don't use juniper::ID in services.
severity: error
language: rust
files:
- ./ee/tabby-webserver/src/service/**
ignores:
- ./ee/tabby-webserver/src/service/dao.rs
rule:
pattern: juniper::ID
2 changes: 2 additions & 0 deletions sgconfig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ruleDirs:
- rules

0 comments on commit 97fdd9a

Please sign in to comment.