use super::{RuleConfigurability, RuleDefaultSeverity, RuleDefinition, RuleLanguage, RuleStatus};
pub(crate) const RULE_DEFINITIONS: &[RuleDefinition] = &[
RuleDefinition {
id: "defer_in_loop_resource_growth",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "defer statements inside loops that can accumulate resources until function exit.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "double_close_local_channel",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "The same locally created channel appears to be closed more than once in one function body.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "file_handle_without_close",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "File handles opened via os.Open, os.Create, or os.OpenFile without an observed Close() path.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "http_client_without_timeout",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Local http.Client{} literals constructed without an explicit timeout.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "http_response_body_not_closed",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "HTTP responses acquired locally without an observed resp.Body.Close() call.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "http_server_without_timeouts",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Explicit http.Server{} values that omit common timeout fields.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "http_status_ignored_before_decode",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Response decoding or body consumption that happens without an observed StatusCode check.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "http_writeheader_after_write",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Handlers that write the response body before calling WriteHeader(...).",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "init_side_effect",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "init() functions that perform network, file-system, or subprocess side effects.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "mutable_package_global",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Package-level variables that are mutated from function bodies instead of kept immutable.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "passthrough_wrapper_interface",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Wrapper structs that mostly forward one-to-one through an interface field with little added policy.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "public_bool_parameter_api",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Exported functions or methods that expose raw boolean mode switches in their signatures.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "range_over_local_channel_without_close",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Functions that range over a locally owned channel without an observed close path.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "rows_without_close",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Query result handles that appear locally owned but have no observed rows.Close() call.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "send_after_local_close_risk",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "A locally owned channel is closed and later used in a send expression.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "single_impl_interface",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Repository-local interfaces with one obvious implementation and a very small consumer surface.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "stmt_without_close",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Prepared statements or similar DB handles without an observed Close() call.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "ticker_without_stop",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "time.NewTicker(...) is created without an observed Stop() call.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "time_after_in_loop",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "time.After(...) is allocated inside loops instead of reusing a timer or deadline.",
binding_location: super::bindings::GO_IDIOMS,
},
RuleDefinition {
id: "tx_without_rollback_guard",
language: RuleLanguage::Go,
family: "idioms",
default_severity: RuleDefaultSeverity::Info,
status: RuleStatus::Stable,
configurability: &[
RuleConfigurability::Disable,
RuleConfigurability::Ignore,
RuleConfigurability::SeverityOverride,
],
description: "Transactions begun and later committed with no observed rollback guard.",
binding_location: super::bindings::GO_IDIOMS,
},
];