class
Ameba::Rule::Lint::Typos
- Ameba::Rule::Lint::Typos
- Ameba::Rule::Base
- Reference
- Object
Overview
A rule that reports typos found in source files.
NOTE Needs typos CLI tool.
NOTE See the chapter on false positives.
YAML configuration example:
Lint/Typos:
Enabled: true
BinPath: ~
FailOnMissingBin: false
FailOnError: true
Included Modules
- YAML::Serializable
Defined in:
ameba/rule/lint/typos.crConstant Summary
-
BIN_PATH =
begin Process.find_executable("typos") rescue nil end -
MSG =
"Typo found: `%s` -> %s"
Constructors
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
-
.new(config = nil)
A rule that reports typos found in source files.
- .new(*, __context_for_yaml_serializable ctx : YAML::ParseContext, __node_for_yaml_serializable node : YAML::Nodes::Node)
Class Method Summary
-
.deprecated?
Returns
trueif this rule is deprecated,falseotherwise. -
.deprecation_reason : String | Nil
Returns the deprecation reason for this rule, if there is any.
-
.documentation_url : String
Returns the documentation URL for this rule.
-
.parsed_doc : String | Nil
Returns the documentation for this rule, if there is any.
- .to_json_schema(builder : JSON::Builder) : Nil
Instance Method Summary
- #bin_path : String | Nil
- #bin_path=(bin_path : Union(String, Nil))
- #description : String
- #description=(description : String)
- #enabled=(enabled : Bool)
- #enabled? : Bool
- #excluded : Set(String) | Nil
- #excluded=(excluded : Set(String) | Nil)
- #fail_on_error=(fail_on_error : Bool)
- #fail_on_error? : Bool
- #fail_on_missing_bin=(fail_on_missing_bin : Bool)
- #fail_on_missing_bin? : Bool
- #severity : Ameba::Severity
- #severity=(severity : Ameba::Severity)
- #since_version : SemanticVersion | Nil
- #since_version=(since_version : String)
-
#test(source : Source)
This method is designed to test the source passed in.
Instance methods inherited from class Ameba::Rule::Base
==(other : self)
==,
catch(source : Source)
catch,
excluded?(source, root = Dir.current)
excluded?,
group
group,
hash(hasher)
hash,
name
name,
special?
special?,
test(source : Source, node : Crystal::ASTNode, *opts)test(source : Source) test
Class methods inherited from class Ameba::Rule::Base
default_severity : Ameba::Severity
default_severity,
group_name
group_name,
rule_name
rule_name
Macros inherited from class Ameba::Rule::Base
issue_for(*args, **kwargs, &block)
issue_for
Macros inherited from module Ameba::Config::RuleConfig
properties(&block)
properties
Constructor Detail
A rule that reports typos found in source files.
NOTE Needs typos CLI tool.
NOTE See the chapter on false positives.
YAML configuration example:
Lint/Typos:
Enabled: true
BinPath: ~
FailOnMissingBin: false
FailOnError: true
Class Method Detail
Returns the deprecation reason for this rule, if there is any.
Returns the documentation URL for this rule.
Ameba::Rule::Lint::Syntax.documentation_url
# => "https://crystal-ameba.org/api/master/Ameba/Rule/Lint/Syntax.html"
Returns the documentation for this rule, if there is any.
module Ameba
# This is a test rule.
# Does nothing.
class Rule::MyRule < Rule::Base
def test(source)
end
end
end
Ameba::Rule::MyRule.parsed_doc # => "This is a test rule.\nDoes nothing."
Instance Method Detail
This method is designed to test the source passed in. If source has issues that are tested by this rule, it should add an issue.
By default it uses a node visitor to traverse all the nodes in the source.
NOTE Must be overridden for other type of rules.