MatteoRagni/cas-rb

View on GitHub
lib/functions/fnc-box-conditions.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method has too many lines. [13/10]
Open

    def initialize(x, lower, upper)
      if lower.is_a? Numeric
        lower = CAS::const lower
      end
      if upper.is_a? Numeric
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [12/10]
Open

    def box(x, a, b, type=:closed)
      case type
      when :closed
        return CAS::BoxConditionClosed.new(x, a, b)
      when :open
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Surrounding space missing in default value assignment.
Open

    def box(x, a, b, type=:closed)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

Example:

# bad
def some_method(arg1=:default, arg2=nil, arg3=[])
  # do something...
end

# good
def some_method(arg1 = :default, arg2 = nil, arg3 = [])
  # do something...
end

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

      raise CAS::CASError, "This is a virtual method"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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

      @upper_cond = "<="
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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"

Line is too long. [102/80]
Open

  # | _ \/ _ \ \ / (__/ _ \ ' \/ _` | |  _| / _ \ ' \| |__/ _ \ V  V / -_) '_| (__| / _ (_-</ -_) _` |
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Use && instead of and.
Open

      return ((@lower.call(fd) < x_call) and (x_call < @upper))
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Use && instead of and.
Open

      return ((@lower.call(fd) < x_call) and (x_call <= @upper))
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Missing top-level module documentation comment.
Open

module CAS
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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 (@x == cond.x and @lower == cond.lower and @upper == cond.upper)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

Line is too long. [115/80]
Open

      "((#{@lower.to_code} #{@lower_cond} (#{@x.to_code})) and ((#{@x.to_code}) #{@upper_cond} #{@upper.to_code}))"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Line is too long. [102/80]
Open

  # | _ ) _____ __/ __|___ _ _  __| (_) |_(_)___ _ _ | |   _____ __ _____ _ _ / __| |___ ___ ___ __| |
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Line is too long. [102/80]
Open

  # | _ \/ _ \ \ / (__/ _ \ ' \/ _` | |  _| / _ \ ' \ |_| | '_ \ '_ \/ -_) '_| (__| / _ (_-</ -_) _` |
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Do not use :: for method calls.
Open

      return CAS::box(self, a, b, type)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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)

Line is too long. [83/80]
Open

    # Returns true if one the central function depends upon the expression included
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Do not place comments on the same line as the end keyword.
Open

  end # BoxConditionOpen
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for comments put on the same line as some keywords. These keywords are: begin, class, def, end, module.

Note that some comments (such as :nodoc: and rubocop:disable) are allowed.

Example:

# bad
if condition
  statement
end # end if

# bad
class X # comment
  statement
end

# bad
def x; end # comment

# good
if condition
  statement
end

# good
class X # :nodoc:
  y
end

Do not place comments on the same line as the end keyword.
Open

  end # BoxConditionLowerClosed
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for comments put on the same line as some keywords. These keywords are: begin, class, def, end, module.

Note that some comments (such as :nodoc: and rubocop:disable) are allowed.

Example:

# bad
if condition
  statement
end # end if

# bad
class X # comment
  statement
end

# bad
def x; end # comment

# good
if condition
  statement
end

# good
class X # :nodoc:
  y
end

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

      if lower.is_a? Numeric
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Do not place comments on the same line as the end keyword.
Open

  end # Op
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for comments put on the same line as some keywords. These keywords are: begin, class, def, end, module.

Note that some comments (such as :nodoc: and rubocop:disable) are allowed.

Example:

# bad
if condition
  statement
end # end if

# bad
class X # comment
  statement
end

# bad
def x; end # comment

# good
if condition
  statement
end

# good
class X # :nodoc:
  y
end

Redundant return detected.
Open

        return CAS::BoxConditionLowerClosed.new(x, a, b)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

      if upper.is_a? Numeric
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

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

      @lower_str   = "≤"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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 only ascii symbols in comments.
Open

  # a ≤ f(x) ≤ b
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Redundant return detected.
Open

      return ((@lower.call(fd) < x_call) and (x_call < @upper))
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

Redundant return detected.
Open

      return CAS::box(self, a, b, type)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

Script file fnc-box-conditions.rb doesn't have execute permission.
Open

#!//usr/bin/env ruby
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Line is too long. [89/80]
Open

      "(#{@lower.inspect} #{@lower_cond} #{@x.inspect} #{@upper_cond} #{@upper.inspect})"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Line is too long. [102/80]
Open

  # | _ ) _____ __/ __|___ _ _  __| (_) |_(_)___ _ _| | | |_ __ _ __  ___ _ _ / __| |___ ___ ___ __| |
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Use && instead of and.
Open

      return (@x == cond.x and @lower == cond.lower and @upper == cond.upper)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

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

      @lower_cond  = @upper_cond = "<"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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"

Unnecessary spacing detected.
Open

      @upper_cond  =  @upper_str = "<"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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"

Line is too long. [101/80]
Open

  #  ___           ___             _ _ _   _         _   _                     ___ _                _
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Use only ascii symbols in comments.
Open

  # a ≤ f(x) < b
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Redundant return detected.
Open

        return CAS::BoxConditionClosed.new(x, a, b)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

Redundant return detected.
Open

        return CAS::BoxConditionUpperClosed.new(x, a, b)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

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

      @lower_str   = @upper_str  = "<"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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

      @lower_cond = @upper_cond = @lower_str = @upper_str = "<"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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"

Operator = should be surrounded by a single space.
Open

      @upper_cond  =  @upper_str = "<"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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

Use only ascii symbols in comments.
Open

  #  * lower closed: `a ≤ f(x) < b`
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Do not use :: for method calls.
Open

        upper = CAS::const upper
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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

        lower = CAS::const lower
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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 place comments on the same line as the end keyword.
Open

  end # BoxCondition
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for comments put on the same line as some keywords. These keywords are: begin, class, def, end, module.

Note that some comments (such as :nodoc: and rubocop:disable) are allowed.

Example:

# bad
if condition
  statement
end # end if

# bad
class X # comment
  statement
end

# bad
def x; end # comment

# good
if condition
  statement
end

# good
class X # :nodoc:
  y
end

Missing top-level class documentation comment.
Open

  class Op
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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

Favor unless over if for negative conditions.
Open

      return false if not self.class != cond.class
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Checks for uses of if with a negated condition. Only ifs without else are considered. There are three different styles:

- both
- prefix
- postfix

Example: EnforcedStyle: both (default)

# enforces `unless` for `prefix` and `postfix` conditionals

# bad

if !foo
  bar
end

# good

unless foo
  bar
end

# bad

bar if !foo

# good

bar unless foo

Example: EnforcedStyle: prefix

# enforces `unless` for just `prefix` conditionals

# bad

if !foo
  bar
end

# good

unless foo
  bar
end

# good

bar if !foo

Example: EnforcedStyle: postfix

# enforces `unless` for just `postfix` conditionals

# bad

bar if !foo

# good

bar unless foo

# good

if !foo
  bar
end

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

      @lower_cond  = "<="
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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 && instead of and.
Open

      return (@x == cond.x and @lower == cond.lower and @upper == cond.upper)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Use only ascii symbols in comments.
Open

  #  * upper closed: `a < f(x) ≤ b`
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

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

        raise CAS::CASError, "Unknown box condition type"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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"

Line is too long. [101/80]
Open

  #  ___           ___             _ _ _   _          _                        ___ _                _
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Line is too long. [102/80]
Open

  # |___/\___/_\_\\___\___/_||_\__,_|_|\__|_\___/_||_\___/| .__/ .__/\___|_|  \___|_\___/__/\___\__,_|
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

When defining the == operator, name its argument other.
Open

    def ==(cond)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop makes sure that certain binary operator methods have their sole parameter named other.

Example:

# bad
def +(amount); end

# good
def +(other); end

Use alias in box instead of alias :in :box.
Open

    alias :in :box
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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

Use && instead of and.
Open

      return ((@lower.call(fd) <= x_call) and (x_call <= @upper))
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Do not place comments on the same line as the end keyword.
Open

  end # BoxConditionUpperClosed
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for comments put on the same line as some keywords. These keywords are: begin, class, def, end, module.

Note that some comments (such as :nodoc: and rubocop:disable) are allowed.

Example:

# bad
if condition
  statement
end # end if

# bad
class X # comment
  statement
end

# bad
def x; end # comment

# good
if condition
  statement
end

# good
class X # :nodoc:
  y
end

Use ! instead of not.
Open

      return false if not self.class != cond.class
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for uses of the keyword not instead of !.

Example:

# bad - parentheses are required because of op precedence
x = (not something)

# good
x = !something

Redundant return detected.
Open

      return ((@lower.call(fd) < x_call) and (x_call <= @upper))
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

Redundant return detected.
Open

      return ((@lower.call(fd) <= x_call) and (x_call <= @upper))
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

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

      @lower_cond = @lower_str = "<"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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"

Surrounding space missing in default value assignment.
Open

    def limit(a, b, type=:closed)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

Example:

# bad
def some_method(arg1=:default, arg2=nil, arg3=[])
  # do something...
end

# good
def some_method(arg1 = :default, arg2 = nil, arg3 = [])
  # do something...
end

Line is too long. [102/80]
Open

  # |___/\___/_\_\\___\___/_||_\__,_|_|\__|_\___/_||_|____\___/\_/\_/\___|_|  \___|_\___/__/\___\__,_|
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

Use && instead of and.
Open

      return ((@lower.call(fd) <= x_call) and (x_call < @upper))
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Use only ascii symbols in comments.
Open

  #  * closed: `a ≤ f(x) ≤ b`
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Do not use :: for method calls.
Open

      CAS::equal(@x.diff(v).simplify, CAS::Zero)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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 when you don't need string interpolation or special symbols.
Open

      @upper_str  = "≤"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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

      @lower_cond  = @upper_cond  = "<="
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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"

Redundant return detected.
Open

      return self
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

Redundant return detected.
Open

      return ((@lower.call(fd) <= x_call) and (x_call < @upper))
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

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

      @upper_cond  =  @upper_str = "<"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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"

Redundant return detected.
Open

        return CAS::BoxConditionOpen.new(x, a, b)
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

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

      @lower_str   = @upper_str   = "≤"
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb 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 only ascii symbols in comments.
Open

  # a < f(x) ≤ b
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Do not place comments on the same line as the end keyword.
Open

  end # BoxConditionUpperClosed
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

This cop checks for comments put on the same line as some keywords. These keywords are: begin, class, def, end, module.

Note that some comments (such as :nodoc: and rubocop:disable) are allowed.

Example:

# bad
if condition
  statement
end # end if

# bad
class X # comment
  statement
end

# bad
def x; end # comment

# good
if condition
  statement
end

# good
class X # :nodoc:
  y
end

Redundant return detected.
Open

      return self
Severity: Minor
Found in lib/functions/fnc-box-conditions.rb by rubocop

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.

There are no issues that match your filters.

Category
Status