Skip to content

Commit

Permalink
Add note level for issues (#1352)
Browse files Browse the repository at this point in the history
Just the protobuf change in this one
  • Loading branch information
brynary authored and noahd1 committed Dec 22, 2024
1 parent 1f3e71c commit 1fb5b9c
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 84 deletions.
3 changes: 1 addition & 2 deletions qlty-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Expand Down
148 changes: 71 additions & 77 deletions qlty-types/src/protos/qlty.analysis.v1.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -131,7 +128,6 @@ pub struct Stats {
#[prost(uint32, optional, tag="110")]
pub lcom4: ::core::option::Option<u32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Invocation {
#[prost(string, tag="31")]
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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")]
Expand All @@ -293,24 +287,21 @@ pub struct Suggestion {
#[prost(message, repeated, tag="6")]
pub replacements: ::prost::alloc::vec::Vec<Replacement>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Replacement {
#[prost(string, tag="1")]
pub data: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub location: ::core::option::Option<Location>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Location {
#[prost(string, tag="1")]
pub path: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub range: ::core::option::Option<Range>,
}
#[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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -463,6 +454,7 @@ impl MessageLevel {
#[repr(i32)]
pub enum Level {
Unspecified = 0,
Note = 5,
Fmt = 1,
Low = 2,
Medium = 3,
Expand All @@ -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<Self> {
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),
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions qlty-types/src/protos/qlty.analysis.v1.serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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",
Expand All @@ -1901,6 +1903,7 @@ impl<'de> serde::Deserialize<'de> for Level {
{
const FIELDS: &[&str] = &[
"LEVEL_UNSPECIFIED",
"LEVEL_NOTE",
"LEVEL_FMT",
"LEVEL_LOW",
"LEVEL_MEDIUM",
Expand Down Expand Up @@ -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),
Expand Down
6 changes: 1 addition & 5 deletions qlty-types/src/protos/qlty.tests.v1.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 1fb5b9c

Please sign in to comment.