-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
.config/ast-grep/rule-tests/__snapshots__/no-context-snapshot.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
id: no-context | ||
valid: | ||
- "let chunking_context = ChunkingContext::new();" | ||
- "struct Foo { chunking_context: Context };" | ||
- "foo(|chunking_context| context)" | ||
- "fn foo(chunking_context: ChunkingContext) -> u32 { 5 };" | ||
invalid: | ||
- "let context = ChunkingContext::new();" | ||
- "struct Foo { context: Context };" | ||
- "foo(|context| context)" | ||
- "fn foo(context: ChunkingContext) -> u32 { 5 };" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
id: no-context | ||
message: Don't name variables `context`. | ||
note: Use a more specific name, such as chunking_context, asset_context, etc. | ||
severity: warning | ||
language: Rust | ||
rule: | ||
regex: \bcontext\b | ||
any: | ||
- all: | ||
- inside: | ||
any: | ||
- kind: closure_parameters | ||
- kind: parameter | ||
- kind: function_type | ||
- kind: let_declaration | ||
- kind: identifier | ||
- all: | ||
- kind: field_identifier | ||
- inside: | ||
kind: field_declaration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.config/ast-grep/rule-tests/__snapshots__/** linguist-generated=true | ||
crates/turbopack-tests/tests/snapshot/**/output/** linguist-generated=true | ||
crates/turborepo-lockfiles/fixtures/*.lock text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ruleDirs: | ||
- .config/ast-grep/rules | ||
testConfigs: | ||
- testDir: .config/ast-grep/rule-tests | ||
utilDirs: | ||
- .config/ast-grep/rule-utils |