pub enum ViolationCode {
Show 15 variants
RustPublicMissingDocs,
RustPublicThinDocs,
RustPublicMissingExample,
RustExampleNotExecutable,
RustExamplePlaceholder,
RustExampleDoesNotNameSubject,
RustModuleMissingDocs,
RustModuleMissingExample,
RustModuleMissingBehaviouralTest,
OperationCliUnclassified,
OperationClassificationStale,
OperationClassificationConflict,
OperationMissingOpenapi,
OperationProjectionMissing,
OperationProjectionOrphan,
}Expand description
What is wrong, as a stable machine-readable code.
The codes are the contract between the validator and everything downstream: CI annotations, Cockpit filters, documentation anchors and an agent deciding what to fix. A code is never renamed once it has shipped; a rule that stops existing takes its code with it.
Variants§
RustPublicMissingDocs
An exported item carries no documentation at all.
RustPublicThinDocs
An exported item’s documentation says nothing its signature had not already said.
RustPublicMissingExample
An exported item that carries behaviour has no executable example.
RustExampleNotExecutable
Every example an item has is ignored or is prose in a fenced box.
RustExamplePlaceholder
An example asserts nothing, or asserts something that is true of any program.
RustExampleDoesNotNameSubject
An example never names the item it is documenting.
RustModuleMissingDocs
An exported module carries no module-level documentation.
RustModuleMissingExample
An exported module has no module-level executable example.
RustModuleMissingBehaviouralTest
No test names an exported module, and it declares none of its own.
OperationCliUnclassified
A command of the command line is neither a canonical capability nor classified as belonging to the command line alone.
OperationClassificationStale
A command is classified as belonging to the command line alone, and the command line no longer has it.
OperationClassificationConflict
A command is classified as local and bound to a capability: two answers to one question.
OperationMissingOpenapi
A capability declares an HTTP route and the OpenAPI document does not describe it.
OperationProjectionMissing
A capability declares a projection that the projection itself does not carry.
OperationProjectionOrphan
A projection carries an entry the registry does not hold.
Implementations§
Source§impl ViolationCode
impl ViolationCode
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The code as it is written everywhere: RUST_PUBLIC_MISSING_EXAMPLE.
use majordomus_cli::quality::ViolationCode;
assert_eq!(ViolationCode::RustPublicMissingExample.as_str(), "RUST_PUBLIC_MISSING_EXAMPLE");Sourcepub fn rule(self) -> &'static str
pub fn rule(self) -> &'static str
The rule of the repository’s layer that requires this, by canonical id.
A finding that could not name a rule would be an opinion. Every code names one, and the suite proves the rule exists.
use majordomus_cli::quality::ViolationCode;
assert_eq!(
ViolationCode::RustModuleMissingExample.rule(),
"project.rust-public-api-quality@1"
);
assert_eq!(
ViolationCode::OperationCliUnclassified.rule(),
"project.operation-transport-parity@1"
);Sourcepub fn why(self) -> &'static str
pub fn why(self) -> &'static str
Why it matters, in one sentence: what goes wrong in the world if this stands.
use majordomus_cli::quality::ViolationCode;
assert!(ViolationCode::RustExamplePlaceholder.why().contains("nothing"));Sourcepub fn remediation(self) -> &'static str
pub fn remediation(self) -> &'static str
What to do about it, in the imperative. Read by a person and by an agent.
use majordomus_cli::quality::ViolationCode;
assert!(ViolationCode::OperationCliUnclassified.remediation().contains("CliExposure"));Sourcepub fn severity(self) -> Severity
pub fn severity(self) -> Severity
How bad it is. Every code this subsystem ships is an error: a warning-forever mode is how a rule becomes decoration.
Sourcepub fn all() -> Vec<ViolationCode>
pub fn all() -> Vec<ViolationCode>
Every code, for the projections that list them and the test that proves each one is distinct.
use majordomus_cli::quality::ViolationCode;
let all = ViolationCode::all();
let mut codes: Vec<&str> = all.iter().map(|c| c.as_str()).collect();
codes.sort();
codes.dedup();
assert_eq!(codes.len(), all.len(), "every code is distinct");Trait Implementations§
Source§impl Clone for ViolationCode
impl Clone for ViolationCode
Source§fn clone(&self) -> ViolationCode
fn clone(&self) -> ViolationCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ViolationCode
Source§impl Debug for ViolationCode
impl Debug for ViolationCode
Source§impl<'de> Deserialize<'de> for ViolationCode
impl<'de> Deserialize<'de> for ViolationCode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ViolationCode
Source§impl JsonSchema for ViolationCode
impl JsonSchema for ViolationCode
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for ViolationCode
impl Ord for ViolationCode
Source§fn cmp(&self, other: &ViolationCode) -> Ordering
fn cmp(&self, other: &ViolationCode) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ViolationCode
impl PartialEq for ViolationCode
Source§fn eq(&self, other: &ViolationCode) -> bool
fn eq(&self, other: &ViolationCode) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ViolationCode
impl PartialOrd for ViolationCode
Source§impl Serialize for ViolationCode
impl Serialize for ViolationCode
impl StructuralPartialEq for ViolationCode
Auto Trait Implementations§
impl Freeze for ViolationCode
impl RefUnwindSafe for ViolationCode
impl Send for ViolationCode
impl Sync for ViolationCode
impl Unpin for ViolationCode
impl UnsafeUnpin for ViolationCode
impl UnwindSafe for ViolationCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.