Class: Ukiryu::Definition::DefinitionLinter::Rules

Inherits:
Object
  • Object
show all
Defined in:
lib/ukiryu/definition/definition_linter.rb

Overview

Linting rules configuration

Constant Summary collapse

NAMING_RULES =

Naming convention rules

{
  tool_name_format: {
    rule_id: 'naming_tool_name_format',
    pattern: /^[a-z][a-z0-9_-]*$/,
    message: 'Tool name should start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores',
    suggestion: 'Use lowercase with hyphens for multi-word names (e.g., "my-tool")'
  },
  command_name_format: {
    rule_id: 'naming_command_name_format',
    pattern: /^[a-z][a-z0-9_]*$/,
    message: 'Command names should be lowercase with underscores',
    suggestion: 'Use snake_case for command names (e.g., "build_command")'
  }
}.freeze
COMPLETENESS_RULES =

Completeness rules

{
  missing_description: {
    rule_id: 'complete_missing_description',
    message: 'Tool is missing a description',
    suggestion: 'Add a "description" field to help users understand what this tool does'
  },
  missing_homepage: {
    rule_id: 'complete_missing_homepage',
    message: 'Tool is missing a homepage URL',
    suggestion: 'Add a "homepage" field linking to the tool\'s website'
  },
  missing_version_detection: {
    rule_id: 'complete_missing_version_detection',
    message: 'Tool is missing version detection',
    suggestion: 'Add "version_detection" to auto-detect installed versions'
  }
}.freeze
SECURITY_RULES =

Security rules

{
  suspicious_subcommand: {
    rule_id: 'security_suspicious_subcommand',
    pattern: /(^|\s|;)\s*(rm\s+-rf|del|format|mkfs)/,
    message: 'Subcommand contains potentially dangerous shell commands',
    suggestion: 'Avoid using destructive commands in subcommands'
  },
  unvalidated_user_input: {
    rule_id: 'security_unvalidated_input',
    message: 'Arguments should specify type validation',
    suggestion: 'Add "type" field to all arguments for validation'
  }
}.freeze
DEPRECATED_RULES =

Deprecated patterns

{
  old_schema_version: {
    rule_id: 'deprecated_old_schema',
    threshold: '1.0',
    message: 'Schema version should be 1.0',
    suggestion: 'Use ukiryu_schema: 1.0 (we are in 1.0 development)'
  }
}.freeze