Skip to main content

Rule

Trait Rule 

Source
pub trait Rule: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn name(&self) -> &str;
    fn dimension(&self) -> Dimension;
    fn severity(&self) -> Severity;
    fn check(&self, ctx: &ProjectContext) -> RuleResult;

    // Provided methods
    fn applies_to(&self, _project_type: &ProjectType) -> bool { ... }
    fn pass(&self) -> RuleResult { ... }
    fn fail(&self, reason: &str, suggestion: Suggestion) -> RuleResult { ... }
    fn warn(&self, reason: &str, suggestion: Suggestion) -> RuleResult { ... }
    fn skip(&self) -> RuleResult { ... }
}
Expand description

The rule trait — each check implements this

Required Methods§

Source

fn id(&self) -> &str

Source

fn name(&self) -> &str

Source

fn dimension(&self) -> Dimension

Source

fn severity(&self) -> Severity

Source

fn check(&self, ctx: &ProjectContext) -> RuleResult

Execute the check.

Provided Methods§

Source

fn applies_to(&self, _project_type: &ProjectType) -> bool

Whether this rule applies to the detected project type.

Source

fn pass(&self) -> RuleResult

Helper to produce a pass result.

Source

fn fail(&self, reason: &str, suggestion: Suggestion) -> RuleResult

Helper to produce a fail result with suggestion.

Source

fn warn(&self, reason: &str, suggestion: Suggestion) -> RuleResult

Helper to produce a warn result with suggestion.

Source

fn skip(&self) -> RuleResult

Helper to produce a skip result.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Rule for AgentsMdExists

Source§

impl Rule for AllRuntimesIgnored

Source§

impl Rule for ApiSpecExists

Source§

impl Rule for ArchDecisionRecords

Source§

impl Rule for AutoFormatHook

Source§

impl Rule for AutoRegenHook

Source§

impl Rule for BinaryAssetsExcluded

Source§

impl Rule for BinaryAssetsIgnored

Source§

impl Rule for BuildCacheIgnored

Source§

impl Rule for BuildCommandMatchesManifest

Source§

impl Rule for BuildOutputIgnored

Source§

impl Rule for CiCdExists

Source§

impl Rule for CircularDependencyCheck

Source§

impl Rule for ClaudeDirExists

Source§

impl Rule for ClaudeMdActionable

Source§

impl Rule for ClaudeMdConcise

Source§

impl Rule for ClaudeMdExists

Source§

impl Rule for ClaudeMdHasCommands

Source§

impl Rule for ClaudeMdReadmeDuplication

Source§

impl Rule for ClaudeignoreExists

Source§

impl Rule for ClearDirectoryStructure

Source§

impl Rule for ClearModuleBoundaries

Source§

impl Rule for CommentsExplainWhy

Source§

impl Rule for ComprehensiveTests

Source§

impl Rule for ConsistentNaming

Source§

impl Rule for ConsistentPatterns

Source§

impl Rule for CorrectPatternsIdentified

Source§

impl Rule for CustomSkills

Source§

impl Rule for DangerousOpProtection

Source§

impl Rule for DataAccessDocumented

Source§

impl Rule for DatabaseFilesIgnored

Source§

impl Rule for DatasetFilesIgnored

Source§

impl Rule for DeadCodeFlagged

Source§

impl Rule for DependenciesDocumented

Source§

impl Rule for DeployArtifactsIgnored

Source§

impl Rule for DescriptiveNames

Source§

impl Rule for DescriptiveTestNames

Source§

impl Rule for DocumentsTheMess

Source§

impl Rule for EditSpecsNotGenerated

Source§

impl Rule for EditorMetadataIgnored

Source§

impl Rule for EnvExampleExists

Source§

impl Rule for ExamplesExist

Source§

impl Rule for ExperimentWorkflowDocumented

Source§

impl Rule for FolderClaudeMds

Source§

impl Rule for FunctionsFocused

Source§

impl Rule for GameLogicTests

Source§

impl Rule for GeneratedCodeIgnored

Source§

impl Rule for GeneratedDirsIgnored

Source§

impl Rule for GeneratedFilesIgnored

Source§

impl Rule for IndependentBuildTest

Source§

impl Rule for LanguageAwareIndexFiles

Source§

impl Rule for LightweightVerification

Source§

impl Rule for LockFilesIgnored

Source§

impl Rule for LogFilesIgnored

Source§

impl Rule for ManifestComplete

Source§

impl Rule for MarkdownSourceFocus

Source§

impl Rule for McpServersConfigured

Source§

impl Rule for MegaFilesDocumented

Source§

impl Rule for MemoryDirectoryExists

Source§

impl Rule for MigrationHistoryManageable

Source§

impl Rule for MixedGeneratedCode

Source§

impl Rule for ModelFilesIgnored

Source§

impl Rule for ModuleConventions

Source§

impl Rule for NarrowRuleScopes

Source§

impl Rule for NavigationDocumented

Source§

impl Rule for NoCloudCreds

Source§

impl Rule for NoDeadCode

Source§

impl Rule for NoDeepNesting

Source§

impl Rule for NoMegaFiles

Source§

impl Rule for NoMegaFunctions

Source§

impl Rule for NoSecretsInRepo

Source§

impl Rule for NotebooksNotPrimary

Source§

impl Rule for ObviousEntryPoints

Source§

impl Rule for PathScopedRules

Source§

impl Rule for PathScopedRulesPerPackage

Source§

impl Rule for PerLanguageClaudeMd

Source§

impl Rule for PerPackageClaudeMd

Source§

impl Rule for PerPackageTestCommands

Source§

impl Rule for PermissionAllowList

Source§

impl Rule for PlanOutputFiltered

Source§

impl Rule for PlatformBuildDirsIgnored

Source§

impl Rule for PlatformCommands

Source§

impl Rule for PredictableTestLocations

Source§

impl Rule for ProviderCacheIgnored

Source§

impl Rule for PublicApiAtTop

Source§

impl Rule for ReadmeExistsAndConcise

Source§

impl Rule for ReadmeIsPrimary

Source§

impl Rule for ReferencedFilesExist

Source§

impl Rule for RegenCommandDocumented

Source§

impl Rule for RequirementsPinned

Source§

impl Rule for RootClaudeMdAgnostic

Source§

impl Rule for RootClaudeMdThin

Source§

impl Rule for ScatteredCodeCrossRefs

Source§

impl Rule for ScriptsArePrimary

Source§

impl Rule for SecretsExternal

Source§

impl Rule for SettingsJsonExists

Source§

impl Rule for SharedToolingConfig

Source§

impl Rule for SourceMapsIgnored

Source§

impl Rule for StateFilesBlocked

Source§

impl Rule for SubagentConfig

Source§

impl Rule for SubdirClaudeMd

Source§

impl Rule for TargetedTestCommand

Source§

impl Rule for TestEventsExist

Source§

impl Rule for TestOutputFilteringHook

Source§

impl Rule for TestsExist

Source§

impl Rule for TestsForModifiedCode

Source§

impl Rule for TypeAnnotationsExist

Source§

impl Rule for TypeCheckBeforeBuild

Source§

impl Rule for VirtualEnvsIgnored

Source§

impl Rule for WorkspaceDepsNavigable

Source§

impl Rule for WorkspaceOutputsIgnored