MatteoRagni/cas-rb

View on GitHub
bin/cas-console

Summary

Maintainability
Test Coverage

Block has too many lines. [28/25]
Open

Pry.hooks.add_hook(:before_session, "print_banner") do |output, _, pry|
  BANNER = <<-BANNER

    #{"Mr.CAS = A very simple Computer Algebra System".green}

Severity: Minor
Found in bin/cas-console by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Avoid single-line method definitions.
Open

def exp(op); CAS::exp(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

Avoid single-line method definitions.
Open

def log(op); CAS::log(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

  proc { |obj, nest_level, _| " > ".yellow },
Severity: Minor
Found in bin/cas-console by rubocop

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"

Prefer single-quoted strings inside interpolations.
Open

     * #{ "`show-doc CAS::Op#diff`".yellow } shows the documentation for a method
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks that quotes inside the string interpolation match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
result = "Tests #{success ? "PASS" : "FAIL"}"

# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"

Example: EnforcedStyle: double_quotes

# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"

# good
result = "Tests #{success ? "PASS" : "FAIL"}"

Space inside string interpolation detected.
Open

     * #{ "`$x`, `$y`, `$z`".yellow } three `CAS::Variable`
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for whitespace within string interpolations.

Example: EnforcedStyle: no_space (default)

# bad
   var = "This is the #{ space } example"

# good
   var = "This is the #{no_space} example"

Example: EnforcedStyle: space

# bad
   var = "This is the #{no_space} example"

# good
   var = "This is the #{ space } example"

Remove debugger entry point binding.pry.
Open

binding.pry
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for calls to debugger or pry.

Example:

# bad (ok during development)

# using pry
def some_method
  binding.pry
  do_something
end

Example:

# bad (ok during development)

# using byebug
def some_method
  byebug
  do_something
end

Example:

# good

def some_method
  do_something
end

Do not use :: for method calls.
Open

def acos(op); CAS::acos(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Missing space after #.
Open

  #pry.config.exception_handler = proc { |out, exception, _|
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

Example:

# bad
#Some comment

# good
# Some comment

Space inside string interpolation detected.
Open

     * #{ "`stat CAS::Op#diff`".yellow } shows some statistics about methods
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for whitespace within string interpolations.

Example: EnforcedStyle: no_space (default)

# bad
   var = "This is the #{ space } example"

# good
   var = "This is the #{no_space} example"

Example: EnforcedStyle: space

# bad
   var = "This is the #{no_space} example"

# good
   var = "This is the #{ space } example"

Do not use :: for method calls.
Open

def sqrt(op); CAS::sqrt(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Prefer single-quoted strings inside interpolations.
Open

     * #{ "`$x`, `$y`, `$z`".yellow } three `CAS::Variable`
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks that quotes inside the string interpolation match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
result = "Tests #{success ? "PASS" : "FAIL"}"

# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"

Example: EnforcedStyle: double_quotes

# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"

# good
result = "Tests #{success ? "PASS" : "FAIL"}"

Prefer to_s over string interpolation.
Open

        out.puts "#{value}".green
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for strings that are just an interpolated expression.

Example:

# bad
"#{@var}"

# good
@var.to_s

# good if @var is already a String
@var

Space inside string interpolation detected.
Open

     * #{ "`hist`".yellow } prints the command history
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for whitespace within string interpolations.

Example: EnforcedStyle: no_space (default)

# bad
   var = "This is the #{ space } example"

# good
   var = "This is the #{no_space} example"

Example: EnforcedStyle: space

# bad
   var = "This is the #{no_space} example"

# good
   var = "This is the #{ space } example"

%w-literals should be delimited by [ and ].
Open

%w|pry colorize|.each do |g|
Severity: Minor
Found in bin/cas-console by rubocop

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)

Avoid single-line method definitions.
Open

def abs(op); CAS::abs(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

Use empty lines between method definitions.
Open

def tan(op); CAS::tan(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Do not use :: for method calls.
Open

def abs(op); CAS::abs(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Do not introduce global variables.
Open

$x, $y, $z = CAS::vars :x, :y, :z
Severity: Minor
Found in bin/cas-console by rubocop

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

include is used at the top level. Use inside class or module.
Open

include CAS
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks that include, extend and prepend exists at the top level. Using these at the top level affects the behavior of Object. There will not be using include, extend and prepend at the top level. Let's use it inside class or module.

Example:

# bad
include M

class C
end

# bad
extend M

class C
end

# bad
prepend M

class C
end

# good
class C
  include M
end

# good
class C
  extend M
end

# good
class C
  prepend M
end

Avoid single-line method definitions.
Open

def tan(op); CAS::tan(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

  proc { |obj, nest_level, _| " + ".yellow }
Severity: Minor
Found in bin/cas-console by rubocop

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"

Use empty lines between method definitions.
Open

def atan(op); CAS::atan(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Use empty lines between method definitions.
Open

def log(op); CAS::log(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Line is too long. [88/80]
Open

  #    out.puts "SyntaxError: #{exception.message.sub(/.*syntax error, */m, '')}".orange
Severity: Minor
Found in bin/cas-console by rubocop

Avoid single-line method definitions.
Open

def acos(op); CAS::acos(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

$0 = "Mr.CAS"
Severity: Minor
Found in bin/cas-console by rubocop

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"

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

  pry.config.prompt_name = "CAS"
Severity: Minor
Found in bin/cas-console by rubocop

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"

Prefer to_s over string interpolation.
Open

      out.puts "#{value.inspect}".cyan
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for strings that are just an interpolated expression.

Example:

# bad
"#{@var}"

# good
@var.to_s

# good if @var is already a String
@var

Use empty lines between method definitions.
Open

def sin(op); CAS::sin(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Use empty lines between method definitions.
Open

def cos(op); CAS::cos(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Unused block argument - obj. You can omit all the arguments if you don't care about them.
Open

  proc { |obj, nest_level, _| " + ".yellow }
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Do not use :: for method calls.
Open

def asin(op); CAS::asin(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Do not use :: for method calls.
Open

def atan(op); CAS::atan(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Do not use :: for method calls.
Open

def log(op); CAS::log(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Prefer single-quoted strings inside interpolations.
Open

     * #{ "`hist`".yellow } prints the command history
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks that quotes inside the string interpolation match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
result = "Tests #{success ? "PASS" : "FAIL"}"

# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"

Example: EnforcedStyle: double_quotes

# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"

# good
result = "Tests #{success ? "PASS" : "FAIL"}"

Use empty lines between method definitions.
Open

def acos(op); CAS::acos(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Missing space after #.
Open

  #}
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

Example:

# bad
#Some comment

# good
# Some comment

Space inside string interpolation detected.
Open

     * #{ "`show-doc CAS::Op#diff`".yellow } shows the documentation for a method
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for whitespace within string interpolations.

Example: EnforcedStyle: no_space (default)

# bad
   var = "This is the #{ space } example"

# good
   var = "This is the #{no_space} example"

Example: EnforcedStyle: space

# bad
   var = "This is the #{no_space} example"

# good
   var = "This is the #{ space } example"

Do not use :: for method calls.
Open

def sin(op); CAS::sin(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Do not use :: for method calls.
Open

def exp(op); CAS::exp(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Avoid single-line method definitions.
Open

def sqrt(op); CAS::sqrt(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

Avoid single-line method definitions.
Open

def sin(op); CAS::sin(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

Prefer single-quoted strings inside interpolations.
Open

    Version: #{CAS::VERSION.join(".")} - Author: Matteo Ragni © 2016
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks that quotes inside the string interpolation match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
result = "Tests #{success ? "PASS" : "FAIL"}"

# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"

Example: EnforcedStyle: double_quotes

# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"

# good
result = "Tests #{success ? "PASS" : "FAIL"}"

Space inside string interpolation detected.
Open

     * #{ "`_`".yellow } returns last evaluated command
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for whitespace within string interpolations.

Example: EnforcedStyle: no_space (default)

# bad
   var = "This is the #{ space } example"

# good
   var = "This is the #{no_space} example"

Example: EnforcedStyle: space

# bad
   var = "This is the #{no_space} example"

# good
   var = "This is the #{ space } example"

Use alias arcsin asin instead of alias :arcsin :asin.
Open

alias :arcsin :asin
Severity: Minor
Found in bin/cas-console by rubocop

This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

Example: EnforcedStyle: prefer_alias (default)

# bad
alias_method :bar, :foo
alias :bar :foo

# good
alias bar foo

Example: EnforcedStyle: preferaliasmethod

# bad
alias :bar :foo
alias bar foo

# good
alias_method :bar, :foo

Do not use :: for method calls.
Open

def cos(op); CAS::cos(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Move out.puts "#{value}".green out of the conditional.
Open

        out.puts "#{value}".green
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for identical lines at the beginning or end of each branch of a conditional statement.

Example:

# bad
if condition
  do_x
  do_z
else
  do_y
  do_z
end

# good
if condition
  do_x
else
  do_y
end
do_z

# bad
if condition
  do_z
  do_x
else
  do_z
  do_y
end

# good
do_z
if condition
  do_x
else
  do_y
end

# bad
case foo
when 1
  do_x
when 2
  do_x
else
  do_x
end

# good
case foo
when 1
  do_x
  do_y
when 2
  # nothing
else
  do_x
  do_z
end

Favor a normal unless-statement over a modifier clause in a multiline statement.
Open

  begin
    puts "Please install #{g} gem"
    exit 1
  end unless require g
Severity: Minor
Found in bin/cas-console by rubocop

Checks for uses of if/unless modifiers with multiple-lines bodies.

Example:

# bad
{
  result: 'this should not happen'
} unless cond

# good
{ result: 'ok' } if cond

Prefer single-quoted strings inside interpolations.
Open

    #{"Mr.CAS = A very simple Computer Algebra System".green}
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks that quotes inside the string interpolation match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
result = "Tests #{success ? "PASS" : "FAIL"}"

# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"

Example: EnforcedStyle: double_quotes

# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"

# good
result = "Tests #{success ? "PASS" : "FAIL"}"

Unused block argument - nest_level. You can omit all the arguments if you don't care about them.
Open

  proc { |obj, nest_level, _| " > ".yellow },
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Use alias arccos acos instead of alias :arccos :acos.
Open

alias :arccos :acos
Severity: Minor
Found in bin/cas-console by rubocop

This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

Example: EnforcedStyle: prefer_alias (default)

# bad
alias_method :bar, :foo
alias :bar :foo

# good
alias bar foo

Example: EnforcedStyle: preferaliasmethod

# bad
alias :bar :foo
alias bar foo

# good
alias_method :bar, :foo

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

Pry.hooks.add_hook(:before_session, "print_banner") do |output, _, pry|
Severity: Minor
Found in bin/cas-console by rubocop

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"

Prefer to_s over string interpolation.
Open

        out.puts "#{value}".green # TODO: solve this problem with sum
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for strings that are just an interpolated expression.

Example:

# bad
"#{@var}"

# good
@var.to_s

# good if @var is already a String
@var

Use empty lines between method definitions.
Open

def asin(op); CAS::asin(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Use empty lines between method definitions.
Open

def exp(op); CAS::exp(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Unused block argument - obj. You can omit all the arguments if you don't care about them.
Open

  proc { |obj, nest_level, _| " > ".yellow },
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Do not introduce global variables.
Open

$x, $y, $z = CAS::vars :x, :y, :z
Severity: Minor
Found in bin/cas-console by rubocop

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Avoid single-line method definitions.
Open

def cos(op); CAS::cos(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

Avoid single-line method definitions.
Open

def atan(op); CAS::atan(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

Unused block argument - nest_level. You can omit all the arguments if you don't care about them.
Open

  proc { |obj, nest_level, _| " + ".yellow }
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

Use alias arctan atan instead of alias :arctan :atan.
Open

alias :arctan :atan
Severity: Minor
Found in bin/cas-console by rubocop

This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

Example: EnforcedStyle: prefer_alias (default)

# bad
alias_method :bar, :foo
alias :bar :foo

# good
alias bar foo

Example: EnforcedStyle: preferaliasmethod

# bad
alias :bar :foo
alias bar foo

# good
alias_method :bar, :foo

Do not use :: for method calls.
Open

def tan(op); CAS::tan(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Move out.puts "#{value}".green out of the conditional.
Open

        out.puts "#{value}".green # TODO: solve this problem with sum
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for identical lines at the beginning or end of each branch of a conditional statement.

Example:

# bad
if condition
  do_x
  do_z
else
  do_y
  do_z
end

# good
if condition
  do_x
else
  do_y
end
do_z

# bad
if condition
  do_z
  do_x
else
  do_z
  do_y
end

# good
do_z
if condition
  do_x
else
  do_y
end

# bad
case foo
when 1
  do_x
when 2
  do_x
else
  do_x
end

# good
case foo
when 1
  do_x
  do_y
when 2
  # nothing
else
  do_x
  do_z
end

Freeze mutable objects assigned to constants.
Open

  BANNER = <<-BANNER
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Prefer single-quoted strings inside interpolations.
Open

     * #{ "`_`".yellow } returns last evaluated command
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks that quotes inside the string interpolation match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
result = "Tests #{success ? "PASS" : "FAIL"}"

# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"

Example: EnforcedStyle: double_quotes

# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"

# good
result = "Tests #{success ? "PASS" : "FAIL"}"

Prefer single-quoted strings inside interpolations.
Open

     * #{ "`stat CAS::Op#diff`".yellow } shows some statistics about methods
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks that quotes inside the string interpolation match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
result = "Tests #{success ? "PASS" : "FAIL"}"

# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"

Example: EnforcedStyle: double_quotes

# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"

# good
result = "Tests #{success ? "PASS" : "FAIL"}"

Do not introduce global variables.
Open

$x, $y, $z = CAS::vars :x, :y, :z
Severity: Minor
Found in bin/cas-console by rubocop

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Use empty lines between method definitions.
Open

def sqrt(op); CAS::sqrt(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Extra empty line detected at block body end.
Open


end
Severity: Minor
Found in bin/cas-console by rubocop

This cops checks if empty lines around the bodies of blocks match the configuration.

Example: EnforcedStyle: empty_lines

# good

foo do |bar|

  # ...

end

Example: EnforcedStyle: noemptylines (default)

# good

foo do |bar|
  # ...
end

Use alias ln log instead of alias :ln :log.
Open

alias :ln :log
Severity: Minor
Found in bin/cas-console by rubocop

This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

Example: EnforcedStyle: prefer_alias (default)

# bad
alias_method :bar, :foo
alias :bar :foo

# good
alias bar foo

Example: EnforcedStyle: preferaliasmethod

# bad
alias :bar :foo
alias bar foo

# good
alias_method :bar, :foo

Do not use :: for method calls.
Open

$x, $y, $z = CAS::vars :x, :y, :z
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Avoid single-line method definitions.
Open

def asin(op); CAS::asin(op); end
Severity: Minor
Found in bin/cas-console by rubocop

This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

Example:

# bad
def some_method; body end
def link_to(url); {:name => url}; end
def @table.columns; super; end

# good
def no_op; end
def self.resource_class=(klass); end
def @table.columns; end

There are no issues that match your filters.

Category
Status