Operator =
should be surrounded by a single space. Open
CAS::NumericToConst[(-1.0/0.0)] = (CAS::NegInfinity)
- Read upRead up
- Exclude checks
Checks that operators have space around them, except for ** which should not have surrounding space.
Example:
# bad
total = 3*4
"apple"+"juice"
my_number = 38/4
a ** b
# good
total = 3 * 4
"apple" + "juice"
my_number = 38 / 4
a**b
Extra empty line detected at module body beginning. Open
# Support functions are in this separate Helper class
- Read upRead up
- Exclude checks
This cops checks if empty lines around the bodies of modules match the configuration.
Example: EnforcedStyle: empty_lines
# good
module Foo
def bar
# ...
end
end
Example: EnforcedStyle: emptylinesexcept_namespace
# good
module Foo
module Bar
# ...
end
end
Example: EnforcedStyle: emptylinesspecial
# good
module Foo
def bar; end
end
Example: EnforcedStyle: noemptylines (default)
# good
module Foo
def bar
# ...
end
end
Unnecessary spacing detected. Open
CAS::NumericToConst[(-1.0/0.0)] = (CAS::NegInfinity)
- Read upRead up
- Exclude checks
This cop checks for extra/unnecessary whitespace.
Example:
# good if AllowForAlignment is true
name = "RuboCop"
# Some comment and an empty line
website += "/bbatsov/rubocop" unless cond
puts "rubocop" if debug
# bad for any configuration
set_app("RuboCop")
website = "https://github.com/bbatsov/rubocop"
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
raise ArgumentError, "Input name must be a String/Symbol" unless [Symbol, String].include? obj.class
- Read upRead up
- Exclude checks
Checks if uses of quotes match the configured preference.
Example: EnforcedStyle: single_quotes (default)
# bad
"No special symbols"
"No string interpolation"
"Just text"
# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"
Example: EnforcedStyle: double_quotes
# bad
'Just some text'
'No special chars or interpolation'
# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"
Line is too long. [94/80] Open
# Check if input object is feasible to be a name of a `CAS::Variable` or a `CAS::Function`
- Exclude checks
Line is too long. [89/80] Open
functions/fnc-conditions.rb functions/fnc-box-conditions.rb functions/fnc-piecewise.rb
- Exclude checks
Missing top-level module documentation comment. Open
module CAS
- Read upRead up
- Exclude checks
This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.
The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.
Example:
# bad
class Person
# ...
end
# good
# Description/Explanation of Person class
class Person
# ...
end
Redundant return
detected. Open
return true
- Read upRead up
- Exclude checks
This cop checks for redundant return
expressions.
Example:
def test
return something
end
def test
one
two
three
return something
end
It should be extended to handle methods whose body is if/else or a case expression with a default branch.
Don't use parentheses around a constant. Open
CAS::NumericToConst[(-1.0/0.0)] = (CAS::NegInfinity)
- Read upRead up
- Exclude checks
This cop checks for redundant parentheses.
Example:
# bad
(x) if ((y.z).nil?)
# good
x if y.z.nil?
Don't use parentheses around an unary operation. Open
CAS::NumericToConst[-Math::PI] = (-CAS::Pi)
- Read upRead up
- Exclude checks
This cop checks for redundant parentheses.
Example:
# bad
(x) if ((y.z).nil?)
# good
x if y.z.nil?
Script file Mr.CAS.rb doesn't have execute permission. Open
#!/usr/bin/env ruby
- Exclude checks
Line is too long. [106/80] Open
raise ArgumentError, "Input name must be a String/Symbol" unless [Symbol, String].include? obj.class
- Exclude checks
Line is too long. [95/80] Open
# raise an `ArgumentError` if the check fails. To be feasible the object must be a `String`
- Exclude checks
Surrounding space missing for operator /
. Open
CAS::NumericToConst[(-1.0/0.0)] = (CAS::NegInfinity)
- Read upRead up
- Exclude checks
Checks that operators have space around them, except for ** which should not have surrounding space.
Example:
# bad
total = 3*4
"apple"+"juice"
my_number = 38/4
a ** b
# good
total = 3 * 4
"apple" + "juice"
my_number = 38 / 4
a**b
Line is too long. [90/80] Open
raise ArgumentError, "required #{type}, received #{obj.class}" unless obj.is_a? type
- Exclude checks
Redundant return
detected. Open
return true
- Read upRead up
- Exclude checks
This cop checks for redundant return
expressions.
Example:
def test
return something
end
def test
one
two
three
return something
end
It should be extended to handle methods whose body is if/else or a case expression with a default branch.
Don't use parentheses around an unary operation. Open
CAS::NumericToConst[-Math::E] = (-CAS::E)
- Read upRead up
- Exclude checks
This cop checks for redundant parentheses.
Example:
# bad
(x) if ((y.z).nil?)
# good
x if y.z.nil?
%w
-literals should be delimited by [
and ]
. Open
%w|operators/op.rb operators/bary-op.rb operators/nary-op.rb
numbers/constants.rb numbers/variables.rb numbers/functions.rb
functions/fnc-sum.rb functions/fnc-prod.rb
functions/fnc-base.rb functions/fnc-trig.rb functions/fnc-trsc.rb
functions/fnc-conditions.rb functions/fnc-box-conditions.rb functions/fnc-piecewise.rb
- Read upRead up
- Exclude checks
This cop enforces the consistent usage of %
-literal delimiters.
Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.
Example:
# Style/PercentLiteralDelimiters:
# PreferredDelimiters:
# default: '[]'
# '%i': '()'
# good
%w[alpha beta] + %i(gamma delta)
# bad
%W(alpha #{beta})
# bad
%I(alpha beta)