From 1fb5b9c01e1aa7458313b95e2b7ed8e97f6251dc Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp <19+brynary@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:22:11 -0500 Subject: [PATCH] Add `note` level for issues (#1352) Just the protobuf change in this one --- qlty-types/src/lib.rs | 3 +- qlty-types/src/protos/qlty.analysis.v1.rs | 148 +++++++++--------- .../src/protos/qlty.analysis.v1.serde.rs | 4 + qlty-types/src/protos/qlty.tests.v1.rs | 6 +- qlty-types/src/protos/qlty.tests.v1.serde.rs | 5 + 5 files changed, 82 insertions(+), 84 deletions(-) diff --git a/qlty-types/src/lib.rs b/qlty-types/src/lib.rs index 47c86a6ef..4f7b092d5 100644 --- a/qlty-types/src/lib.rs +++ b/qlty-types/src/lib.rs @@ -274,6 +274,7 @@ impl analysis::v1::Level { pub fn as_lower_str_name(&self) -> &'static str { match self { analysis::v1::Level::Unspecified => "unspecified", + analysis::v1::Level::Note => "note", analysis::v1::Level::Fmt => "fmt", analysis::v1::Level::Low => "low", analysis::v1::Level::Medium => "medium", @@ -375,8 +376,6 @@ impl Add for tests::v1::CoverageSummary { } } -impl Copy for tests::v1::CoverageSummary {} - impl AddAssign for tests::v1::CoverageSummary { fn add_assign(&mut self, other: Self) { *self = *self + other; diff --git a/qlty-types/src/protos/qlty.analysis.v1.rs b/qlty-types/src/protos/qlty.analysis.v1.rs index 0a852ef4b..02124fc5f 100644 --- a/qlty-types/src/protos/qlty.analysis.v1.rs +++ b/qlty-types/src/protos/qlty.analysis.v1.rs @@ -1,6 +1,5 @@ // @generated // This file is @generated by prost-build. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Metadata { #[prost(string, tag="15")] @@ -48,7 +47,6 @@ pub struct Metadata { #[prost(message, optional, tag="22")] pub authored_at: ::core::option::Option<::pbjson_types::Timestamp>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Message { #[prost(string, tag="14")] @@ -79,7 +77,6 @@ pub struct Message { #[prost(map="string, string", tag="7")] pub tags: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Stats { #[prost(string, tag="15")] @@ -131,7 +128,6 @@ pub struct Stats { #[prost(uint32, optional, tag="110")] pub lcom4: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Invocation { #[prost(string, tag="31")] @@ -201,7 +197,6 @@ pub struct Invocation { #[prost(uint32, tag="25")] pub rewrites_count: u32, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Issue { #[prost(string, tag="39")] @@ -277,7 +272,6 @@ pub struct Issue { #[prost(bool, tag="41")] pub on_added_line: bool, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Suggestion { #[prost(string, tag="1")] @@ -293,7 +287,6 @@ pub struct Suggestion { #[prost(message, repeated, tag="6")] pub replacements: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Replacement { #[prost(string, tag="1")] @@ -301,7 +294,6 @@ pub struct Replacement { #[prost(message, optional, tag="2")] pub location: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Location { #[prost(string, tag="1")] @@ -309,8 +301,7 @@ pub struct Location { #[prost(message, optional, tag="2")] pub range: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Range { #[prost(uint32, tag="1")] pub start_line: u32, @@ -340,10 +331,10 @@ impl ExecutionVerb { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - ExecutionVerb::Unspecified => "EXECUTION_VERB_UNSPECIFIED", - ExecutionVerb::Check => "EXECUTION_VERB_CHECK", - ExecutionVerb::Fmt => "EXECUTION_VERB_FMT", - ExecutionVerb::Validate => "EXECUTION_VERB_VALIDATE", + Self::Unspecified => "EXECUTION_VERB_UNSPECIFIED", + Self::Check => "EXECUTION_VERB_CHECK", + Self::Fmt => "EXECUTION_VERB_FMT", + Self::Validate => "EXECUTION_VERB_VALIDATE", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -373,11 +364,11 @@ impl Mode { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Mode::Unspecified => "MODE_UNSPECIFIED", - Mode::Block => "MODE_BLOCK", - Mode::Comment => "MODE_COMMENT", - Mode::Monitor => "MODE_MONITOR", - Mode::Disabled => "MODE_DISABLED", + Self::Unspecified => "MODE_UNSPECIFIED", + Self::Block => "MODE_BLOCK", + Self::Comment => "MODE_COMMENT", + Self::Monitor => "MODE_MONITOR", + Self::Disabled => "MODE_DISABLED", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -406,9 +397,9 @@ impl SuggestionSource { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - SuggestionSource::Unspecified => "SUGGESTION_SOURCE_UNSPECIFIED", - SuggestionSource::Tool => "SUGGESTION_SOURCE_TOOL", - SuggestionSource::Llm => "SUGGESTION_SOURCE_LLM", + Self::Unspecified => "SUGGESTION_SOURCE_UNSPECIFIED", + Self::Tool => "SUGGESTION_SOURCE_TOOL", + Self::Llm => "SUGGESTION_SOURCE_LLM", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -438,12 +429,12 @@ impl MessageLevel { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - MessageLevel::Unspecified => "MESSAGE_LEVEL_UNSPECIFIED", - MessageLevel::Debug => "MESSAGE_LEVEL_DEBUG", - MessageLevel::Info => "MESSAGE_LEVEL_INFO", - MessageLevel::Warning => "MESSAGE_LEVEL_WARNING", - MessageLevel::Error => "MESSAGE_LEVEL_ERROR", - MessageLevel::Fatal => "MESSAGE_LEVEL_FATAL", + Self::Unspecified => "MESSAGE_LEVEL_UNSPECIFIED", + Self::Debug => "MESSAGE_LEVEL_DEBUG", + Self::Info => "MESSAGE_LEVEL_INFO", + Self::Warning => "MESSAGE_LEVEL_WARNING", + Self::Error => "MESSAGE_LEVEL_ERROR", + Self::Fatal => "MESSAGE_LEVEL_FATAL", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -463,6 +454,7 @@ impl MessageLevel { #[repr(i32)] pub enum Level { Unspecified = 0, + Note = 5, Fmt = 1, Low = 2, Medium = 3, @@ -475,17 +467,19 @@ impl Level { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Level::Unspecified => "LEVEL_UNSPECIFIED", - Level::Fmt => "LEVEL_FMT", - Level::Low => "LEVEL_LOW", - Level::Medium => "LEVEL_MEDIUM", - Level::High => "LEVEL_HIGH", + Self::Unspecified => "LEVEL_UNSPECIFIED", + Self::Note => "LEVEL_NOTE", + Self::Fmt => "LEVEL_FMT", + Self::Low => "LEVEL_LOW", + Self::Medium => "LEVEL_MEDIUM", + Self::High => "LEVEL_HIGH", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "LEVEL_UNSPECIFIED" => Some(Self::Unspecified), + "LEVEL_NOTE" => Some(Self::Note), "LEVEL_FMT" => Some(Self::Fmt), "LEVEL_LOW" => Some(Self::Low), "LEVEL_MEDIUM" => Some(Self::Medium), @@ -521,22 +515,22 @@ impl Category { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Category::Unspecified => "CATEGORY_UNSPECIFIED", - Category::Bug => "CATEGORY_BUG", - Category::Vulnerability => "CATEGORY_VULNERABILITY", - Category::Structure => "CATEGORY_STRUCTURE", - Category::Duplication => "CATEGORY_DUPLICATION", - Category::SecurityHotspot => "CATEGORY_SECURITY_HOTSPOT", - Category::Performance => "CATEGORY_PERFORMANCE", - Category::Documentation => "CATEGORY_DOCUMENTATION", - Category::TypeCheck => "CATEGORY_TYPE_CHECK", - Category::Style => "CATEGORY_STYLE", - Category::AntiPattern => "CATEGORY_ANTI_PATTERN", - Category::Accessibility => "CATEGORY_ACCESSIBILITY", - Category::DeadCode => "CATEGORY_DEAD_CODE", - Category::Lint => "CATEGORY_LINT", - Category::Secret => "CATEGORY_SECRET", - Category::DependencyAlert => "CATEGORY_DEPENDENCY_ALERT", + Self::Unspecified => "CATEGORY_UNSPECIFIED", + Self::Bug => "CATEGORY_BUG", + Self::Vulnerability => "CATEGORY_VULNERABILITY", + Self::Structure => "CATEGORY_STRUCTURE", + Self::Duplication => "CATEGORY_DUPLICATION", + Self::SecurityHotspot => "CATEGORY_SECURITY_HOTSPOT", + Self::Performance => "CATEGORY_PERFORMANCE", + Self::Documentation => "CATEGORY_DOCUMENTATION", + Self::TypeCheck => "CATEGORY_TYPE_CHECK", + Self::Style => "CATEGORY_STYLE", + Self::AntiPattern => "CATEGORY_ANTI_PATTERN", + Self::Accessibility => "CATEGORY_ACCESSIBILITY", + Self::DeadCode => "CATEGORY_DEAD_CODE", + Self::Lint => "CATEGORY_LINT", + Self::Secret => "CATEGORY_SECRET", + Self::DependencyAlert => "CATEGORY_DEPENDENCY_ALERT", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -576,9 +570,9 @@ impl AnalysisResult { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - AnalysisResult::Unspecified => "ANALYSIS_RESULT_UNSPECIFIED", - AnalysisResult::Success => "ANALYSIS_RESULT_SUCCESS", - AnalysisResult::Error => "ANALYSIS_RESULT_ERROR", + Self::Unspecified => "ANALYSIS_RESULT_UNSPECIFIED", + Self::Success => "ANALYSIS_RESULT_SUCCESS", + Self::Error => "ANALYSIS_RESULT_ERROR", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -607,11 +601,11 @@ impl ExitResult { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - ExitResult::Unspecified => "EXIT_RESULT_UNSPECIFIED", - ExitResult::Success => "EXIT_RESULT_SUCCESS", - ExitResult::KnownError => "EXIT_RESULT_KNOWN_ERROR", - ExitResult::UnknownError => "EXIT_RESULT_UNKNOWN_ERROR", - ExitResult::NoIssues => "EXIT_RESULT_NO_ISSUES", + Self::Unspecified => "EXIT_RESULT_UNSPECIFIED", + Self::Success => "EXIT_RESULT_SUCCESS", + Self::KnownError => "EXIT_RESULT_KNOWN_ERROR", + Self::UnknownError => "EXIT_RESULT_UNKNOWN_ERROR", + Self::NoIssues => "EXIT_RESULT_NO_ISSUES", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -644,13 +638,13 @@ impl ComponentType { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - ComponentType::Unspecified => "COMPONENT_TYPE_UNSPECIFIED", - ComponentType::File => "COMPONENT_TYPE_FILE", - ComponentType::Directory => "COMPONENT_TYPE_DIRECTORY", - ComponentType::Project => "COMPONENT_TYPE_PROJECT", - ComponentType::Module => "COMPONENT_TYPE_MODULE", - ComponentType::Class => "COMPONENT_TYPE_CLASS", - ComponentType::Function => "COMPONENT_TYPE_FUNCTION", + Self::Unspecified => "COMPONENT_TYPE_UNSPECIFIED", + Self::File => "COMPONENT_TYPE_FILE", + Self::Directory => "COMPONENT_TYPE_DIRECTORY", + Self::Project => "COMPONENT_TYPE_PROJECT", + Self::Module => "COMPONENT_TYPE_MODULE", + Self::Class => "COMPONENT_TYPE_CLASS", + Self::Function => "COMPONENT_TYPE_FUNCTION", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -691,19 +685,19 @@ impl Language { /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { - Language::Unspecified => "LANGUAGE_UNSPECIFIED", - Language::Unknown => "LANGUAGE_UNKNOWN", - Language::Java => "LANGUAGE_JAVA", - Language::Javascript => "LANGUAGE_JAVASCRIPT", - Language::Typescript => "LANGUAGE_TYPESCRIPT", - Language::Python => "LANGUAGE_PYTHON", - Language::Ruby => "LANGUAGE_RUBY", - Language::Jsx => "LANGUAGE_JSX", - Language::Tsx => "LANGUAGE_TSX", - Language::Go => "LANGUAGE_GO", - Language::Rust => "LANGUAGE_RUST", - Language::Kotlin => "LANGUAGE_KOTLIN", - Language::Php => "LANGUAGE_PHP", + Self::Unspecified => "LANGUAGE_UNSPECIFIED", + Self::Unknown => "LANGUAGE_UNKNOWN", + Self::Java => "LANGUAGE_JAVA", + Self::Javascript => "LANGUAGE_JAVASCRIPT", + Self::Typescript => "LANGUAGE_TYPESCRIPT", + Self::Python => "LANGUAGE_PYTHON", + Self::Ruby => "LANGUAGE_RUBY", + Self::Jsx => "LANGUAGE_JSX", + Self::Tsx => "LANGUAGE_TSX", + Self::Go => "LANGUAGE_GO", + Self::Rust => "LANGUAGE_RUST", + Self::Kotlin => "LANGUAGE_KOTLIN", + Self::Php => "LANGUAGE_PHP", } } /// Creates an enum from field names used in the ProtoBuf definition. diff --git a/qlty-types/src/protos/qlty.analysis.v1.serde.rs b/qlty-types/src/protos/qlty.analysis.v1.serde.rs index 2a5c59782..03977a2a2 100644 --- a/qlty-types/src/protos/qlty.analysis.v1.serde.rs +++ b/qlty-types/src/protos/qlty.analysis.v1.serde.rs @@ -595,6 +595,7 @@ impl serde::Serialize for Invocation { } if let Some(v) = self.exit_code.as_ref() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("exitCode", ToString::to_string(&v).as_str())?; } if !self.stdout.is_empty() { @@ -1885,6 +1886,7 @@ impl serde::Serialize for Level { { let variant = match self { Self::Unspecified => "LEVEL_UNSPECIFIED", + Self::Note => "LEVEL_NOTE", Self::Fmt => "LEVEL_FMT", Self::Low => "LEVEL_LOW", Self::Medium => "LEVEL_MEDIUM", @@ -1901,6 +1903,7 @@ impl<'de> serde::Deserialize<'de> for Level { { const FIELDS: &[&str] = &[ "LEVEL_UNSPECIFIED", + "LEVEL_NOTE", "LEVEL_FMT", "LEVEL_LOW", "LEVEL_MEDIUM", @@ -1946,6 +1949,7 @@ impl<'de> serde::Deserialize<'de> for Level { { match value { "LEVEL_UNSPECIFIED" => Ok(Level::Unspecified), + "LEVEL_NOTE" => Ok(Level::Note), "LEVEL_FMT" => Ok(Level::Fmt), "LEVEL_LOW" => Ok(Level::Low), "LEVEL_MEDIUM" => Ok(Level::Medium), diff --git a/qlty-types/src/protos/qlty.tests.v1.rs b/qlty-types/src/protos/qlty.tests.v1.rs index a976d8025..ea09c4127 100644 --- a/qlty-types/src/protos/qlty.tests.v1.rs +++ b/qlty-types/src/protos/qlty.tests.v1.rs @@ -1,6 +1,5 @@ // @generated // This file is @generated by prost-build. -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CoverageMetadata { #[prost(string, tag="1")] @@ -64,7 +63,6 @@ pub struct CoverageMetadata { #[prost(message, optional, tag="30")] pub uploaded_at: ::core::option::Option<::pbjson_types::Timestamp>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReportFile { #[prost(string, tag="1")] @@ -92,7 +90,6 @@ pub struct ReportFile { #[prost(message, optional, tag="11")] pub uploaded_at: ::core::option::Option<::pbjson_types::Timestamp>, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FileCoverage { #[prost(string, tag="15")] @@ -124,8 +121,7 @@ pub struct FileCoverage { #[prost(string, optional, tag="14")] pub pull_request_number: ::core::option::Option<::prost::alloc::string::String>, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct CoverageSummary { #[prost(int64, tag="1")] pub covered: i64, diff --git a/qlty-types/src/protos/qlty.tests.v1.serde.rs b/qlty-types/src/protos/qlty.tests.v1.serde.rs index 2e9f6a7f9..d0270aaad 100644 --- a/qlty-types/src/protos/qlty.tests.v1.serde.rs +++ b/qlty-types/src/protos/qlty.tests.v1.serde.rs @@ -629,18 +629,22 @@ impl serde::Serialize for CoverageSummary { let mut struct_ser = serializer.serialize_struct("qlty.tests.v1.CoverageSummary", len)?; if self.covered != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("covered", ToString::to_string(&self.covered).as_str())?; } if self.missed != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("missed", ToString::to_string(&self.missed).as_str())?; } if self.omit != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("omit", ToString::to_string(&self.omit).as_str())?; } if self.total != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("total", ToString::to_string(&self.total).as_str())?; } struct_ser.end() @@ -1152,6 +1156,7 @@ impl serde::Serialize for ReportFile { } if self.size != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("size", ToString::to_string(&self.size).as_str())?; } if let Some(v) = self.project_id.as_ref() {