lib/cc/cli/validate_config.rb
Method CC::CLI::ValidateConfig#validator
is defined at both lib/cc/cli/validate_config.rb:24 and lib/cc/cli/validate_config.rb:64. Open
Open
def validator
- Read upRead up
- Exclude checks
Checks for duplicated instance (or singleton) method definitions.
Example:
# bad
def foo
1
end
def foo
2
end
Example:
# bad
def foo
1
end
alias foo bar
Example:
# good
def foo
1
end
def bar
2
end
Example:
# good
def foo
1
end
alias bar foo
case
condition requires an else
-clause. Open
Open
case arg
when "--registry" then @registry_path = @args.shift
when "--registry-prefix" then @registry_prefix = @args.shift
end
- Read upRead up
- Exclude checks
Checks for if
expressions that do not have an else
branch.
NOTE: Pattern matching is allowed to have no else
branch because unlike if
and case
,
it raises NoMatchingPatternError
if the pattern doesn't match and without having else
.
Supported styles are: if, case, both.
Example: EnforcedStyle: if
# warn when an `if` expression is missing an `else` branch.
# bad
if condition
statement
end
# good
if condition
statement
else
# the content of `else` branch will be determined by Style/EmptyElse
end
# good
case var
when condition
statement
end
# good
case var
when condition
statement
else
# the content of `else` branch will be determined by Style/EmptyElse
end
Example: EnforcedStyle: case
# warn when a `case` expression is missing an `else` branch.
# bad
case var
when condition
statement
end
# good
case var
when condition
statement
else
# the content of `else` branch will be determined by Style/EmptyElse
end
# good
if condition
statement
end
# good
if condition
statement
else
# the content of `else` branch will be determined by Style/EmptyElse
end
Example: EnforcedStyle: both (default)
# warn when an `if` or `case` expression is missing an `else` branch.
# bad
if condition
statement
end
# bad
case var
when condition
statement
end
# good
if condition
statement
else
# the content of `else` branch will be determined by Style/EmptyElse
end
# good
case var
when condition
statement
else
# the content of `else` branch will be determined by Style/EmptyElse
end