Ameba::Rule::Lint::SpecFocus
Inherits Ameba::AST::Util < YAML::Serializable < Ameba::Rule::Base < Ameba::Config::RuleConfig < Reference < Object
Checks if specs are focused.
In specs focus: true is mainly used to focus on a spec
item locally during development. However, if such change
is committed, it silently runs only focused spec on all
other environment, which is undesired.
This is considered bad:
describe MyClass, focus: true do
end
describe ".new", focus: true do
end
context "my context", focus: true do
end
it "works", focus: true do
end
And it should be written as the following:
describe MyClass do
end
describe ".new" do
end
context "my context" do
end
it "works" do
end
YAML configuration example:
Lint/SpecFocus:
Enabled: true
Constants
Constructors
Checks if specs are focused.
In specs focus: true is mainly used to focus on a spec
item locally during development. However, if such change
is committed, it silently runs only focused spec on all
other environment, which is undesired.
This is considered bad:
describe MyClass, focus: true do
end
describe ".new", focus: true do
end
context "my context", focus: true do
end
it "works", focus: true do
end
And it should be written as the following:
describe MyClass do
end
describe ".new" do
end
context "my context" do
end
it "works" do
end
YAML configuration example:
Lint/SpecFocus:
Enabled: true
Class methods
Returns true if this rule is deprecated, false otherwise.
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."