Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ffeb33f

Browse files
feat: linter suppressions (#440)
1 parent 21b05d2 commit ffeb33f

File tree

15 files changed

+1294
-2
lines changed

15 files changed

+1294
-2
lines changed

‎Cargo.lock‎

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ pgt_query_ext = { path = "./crates/pgt_query_ext", version = "0.0.0
7878
pgt_query_proto_parser = { path = "./crates/pgt_query_proto_parser", version = "0.0.0" }
7979
pgt_schema_cache = { path = "./crates/pgt_schema_cache", version = "0.0.0" }
8080
pgt_statement_splitter = { path = "./crates/pgt_statement_splitter", version = "0.0.0" }
81+
pgt_suppressions = { path = "./crates/pgt_suppressions", version = "0.0.0" }
8182
pgt_text_edit = { path = "./crates/pgt_text_edit", version = "0.0.0" }
8283
pgt_text_size = { path = "./crates/pgt_text_size", version = "0.0.0" }
8384
pgt_tokenizer = { path = "./crates/pgt_tokenizer", version = "0.0.0" }

‎crates/pgt_analyse/src/categories.rs‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@ pub enum RuleCategory {
1616
Transformation,
1717
}
1818

19+
impl TryFrom<String> for RuleCategory {
20+
type Error = String;
21+
22+
fn try_from(value: String) -> Result<Self, Self::Error> {
23+
value.as_str().try_into()
24+
}
25+
}
26+
27+
impl TryFrom<&str> for RuleCategory {
28+
type Error = String;
29+
30+
fn try_from(value: &str) -> Result<Self, Self::Error> {
31+
match value {
32+
"lint" => Ok(Self::Lint),
33+
"action" => Ok(Self::Action),
34+
"transformation" => Ok(Self::Transformation),
35+
_ => Err(format!("Invalid Rule Category: {}", value)),
36+
}
37+
}
38+
}
39+
1940
/// Actions that suppress rules should start with this string
2041
pub const SUPPRESSION_ACTION_CATEGORY: &str = "quickfix.suppressRule";
2142

‎crates/pgt_diagnostics/src/location.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ impl Eq for Location<'_> {}
4141
#[derive(Debug, Clone, Copy, Eq, PartialEq, Serialize, Deserialize)]
4242
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
4343
#[serde(rename_all = "camelCase")]
44-
pub enum Resource<P> {
44+
pub enum Resource<Path> {
4545
/// The diagnostic is related to the content of the command line arguments.
4646
Argv,
4747
/// The diagnostic is related to the content of a memory buffer.
4848
Memory,
4949
/// The diagnostic is related to a file on the filesystem.
50-
File(P),
50+
File(Path),
5151
}
5252

5353
impl<P> Resource<P> {

‎crates/pgt_suppressions/Cargo.toml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
[package]
3+
authors.workspace = true
4+
categories.workspace = true
5+
description = "Provides an API that parses suppressions from SQL files, and provides a way to check if a diagnostic is suppressed."
6+
edition.workspace = true
7+
homepage.workspace = true
8+
keywords.workspace = true
9+
license.workspace = true
10+
name = "pgt_suppressions"
11+
repository.workspace = true
12+
version = "0.0.0"
13+
14+
[dependencies]
15+
pgt_analyse = { workspace = true }
16+
pgt_diagnostics = { workspace = true }
17+
pgt_text_size = { workspace = true }
18+
tracing = { workspace = true }

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /