class ViewSubclassUnderViewsDirRule

Overview

Asserts that concrete UI::View subclasses live under an approved directory tree.

Defined in:

lsp_rules/family_1_naming/view_subclass_under_views_dir_rule.cr

Constant Summary

DEFAULT_APPROVED_ROOTS = ["src/ui/views/", "samples/"]

Default approved roots. Overridable via .lint_conventions.yml view_subclass.approved_roots. The runner threads the config through #configure.

PATTERN = /^\s*class\s+([A-Za-z_][A-Za-z0-9_]*)(?:\([^)]*\))?\s*<\s*(?:::)?(?:UI::)?View\b/

< View (inside the UI module) OR < UI::View (from user code).

Instance Method Summary

Instance methods inherited from class ConventionRule

check(file_path : String, content : String) : Array(Diagnostic) check, configure(config : ConventionConfig) : Nil configure, find_line(content : String, pattern : Regex) : Int32 | Nil find_line, rule_name : String rule_name, snake_case(identifier : String) : String snake_case

Class methods inherited from class ConventionRule

registered_rules : Array(ConventionRule.class) registered_rules

Instance Method Detail

def check(file_path : String, content : String) : Array(Diagnostic) #

[View source]
def configure(config : ConventionConfig) : Nil #
Description copied from class ConventionRule

Subclasses MAY override to receive the runner-loaded config at construction time. Default no-op so existing rules without config dependence keep working unchanged.


[View source]
def rule_name : String #

[View source]