9troisquarts/ntq-excelsior

View on GitHub

Showing 211 of 211 total issues

Extra empty line detected at class body beginning.
Open


    attr_accessor :exporters

Checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: beginning_only

# good

class Foo

  def bar
    # ...
  end
end

Example: EnforcedStyle: ending_only

# good

class Foo
  def bar
    # ...
  end

end

Final newline missing.
Open

end

Looks for trailing blank lines and a final newline in the source code.

Example: EnforcedStyle: final_newline (default)

# `final_newline` looks for one newline at the end of files.

# bad
class Foo; end

# EOF

# bad
class Foo; end # EOF

# good
class Foo; end
# EOF

Example: EnforcedStyle: finalblankline

# `final_blank_line` looks for one blank line followed by a new line
# at the end of files.

# bad
class Foo; end
# EOF

# bad
class Foo; end # EOF

# good
class Foo; end

# EOF

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

require 'ntq_excelsior/multi_workbook_exporter'
Severity: Minor
Found in lib/ntq_excelsior.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"

Indent the right brace the same as the first position after the preceding left parenthesis.
Open

          })
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

Checks the indentation of the first key in a hash literal where the opening brace and the first key are on separate lines. The other keys' indentations are handled by the HashAlignment cop.

By default, Hash literals that are arguments in a method call with parentheses, and where the opening curly brace of the hash is on the same line as the opening parenthesis of the method call, shall have their first key indented one step (two spaces) more than the position inside the opening parenthesis.

Other hash literals shall have their first key indented one step more than the start of the line where the opening curly brace is.

This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_braces'. Here are examples:

Example: EnforcedStyle: specialinsideparentheses (default)

# The `special_inside_parentheses` style enforces that the first key
# in a hash literal where the opening brace and the first key are on
# separate lines is indented one step (two spaces) more than the
# position inside the opening parentheses.

# bad
hash = {
  key: :value
}
and_in_a_method_call({
  no: :difference
                     })
takes_multi_pairs_hash(x: {
  a: 1,
  b: 2
},
                       y: {
                         c: 1,
                         d: 2
                       })

# good
special_inside_parentheses
hash = {
  key: :value
}
but_in_a_method_call({
                       its_like: :this
                     })
takes_multi_pairs_hash(x: {
                         a: 1,
                         b: 2
                       },
                       y: {
                         c: 1,
                         d: 2
                       })

Example: EnforcedStyle: consistent

# The `consistent` style enforces that the first key in a hash
# literal where the opening brace and the first key are on
# separate lines is indented the same as a hash literal which is not
# defined inside a method call.

# bad
hash = {
  key: :value
}
but_in_a_method_call({
                       its_like: :this
                      })

# good
hash = {
  key: :value
}
and_in_a_method_call({
  no: :difference
})

Example: EnforcedStyle: align_braces

# The `align_brackets` style enforces that the opening and closing
# braces are indented to the same position.

# bad
and_now_for_something = {
                          completely: :different
}
takes_multi_pairs_hash(x: {
  a: 1,
  b: 2
},
                        y: {
                             c: 1,
                             d: 2
                           })

# good
and_now_for_something = {
                          completely: :different
                        }
takes_multi_pairs_hash(x: {
                            a: 1,
                            b: 2
                          },
                       y: {
                            c: 1,
                            d: 2
                          })

Tab detected in indentation.
Open

    end
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

Checks that the indentation method is consistent. Either tabs only or spaces only are used for indentation.

Example: EnforcedStyle: spaces (default)

# bad
# This example uses a tab to indent bar.
def foo
  bar
end

# good
# This example uses spaces to indent bar.
def foo
  bar
end

Example: EnforcedStyle: tabs

# bad
# This example uses spaces to indent bar.
def foo
  bar
end

# good
# This example uses a tab to indent bar.
def foo
  bar
end

Use accessors.length.positive? instead of accessors.length > 0.
Open

      return  v unless accessors && accessors.length > 0
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

Checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. This cop can also be configured to do the reverse.

This cop can be customized allowed methods with AllowedMethods. By default, there are no methods to allowed.

This cop disregards #nonzero? as its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

This cop allows comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Integer polymorphic.

Safety:

This cop is unsafe because it cannot be guaranteed that the receiver defines the predicates or can be compared to a number, which may lead to a false positive for non-standard classes.

Example: EnforcedStyle: predicate (default)

# bad
foo == 0
0 > foo
bar.baz > 0

# good
foo.zero?
foo.negative?
bar.baz.positive?

Example: EnforcedStyle: comparison

# bad
foo.zero?
foo.negative?
bar.baz.positive?

# good
foo == 0
0 > foo
bar.baz > 0

Example: AllowedMethods: [] (default) with EnforcedStyle: predicate

# bad
foo == 0
0 > foo
bar.baz > 0

Example: AllowedMethods: [==] with EnforcedStyle: predicate

# good
foo == 0

# bad
0 > foo
bar.baz > 0

Example: AllowedPatterns: [] (default) with EnforcedStyle: comparison

# bad
foo.zero?
foo.negative?
bar.baz.positive?

Example: AllowedPatterns: ['zero'] with EnforcedStyle: predicate

# good
# bad
foo.zero?

# bad
foo.negative?
bar.baz.positive?

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

    COLUMN_NAMES = Array('A'..'Z').freeze
Severity: Minor
Found in lib/ntq_excelsior/exporter.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 double-quoted strings inside interpolations.
Open

          formula1: "\"#{list_config.join(', ')}\""
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

Checks that quotes inside string, symbol, and regexp interpolations match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
string = "Tests #{success ? "PASS" : "FAIL"}"
symbol = :"Tests #{success ? "PASS" : "FAIL"}"
heredoc = <<~TEXT
  Tests #{success ? "PASS" : "FAIL"}
TEXT
regexp = /Tests #{success ? "PASS" : "FAIL"}/

# good
string = "Tests #{success ? 'PASS' : 'FAIL'}"
symbol = :"Tests #{success ? 'PASS' : 'FAIL'}"
heredoc = <<~TEXT
  Tests #{success ? 'PASS' : 'FAIL'}
TEXT
regexp = /Tests #{success ? 'PASS' : 'FAIL'}/

Example: EnforcedStyle: double_quotes

# bad
string = "Tests #{success ? 'PASS' : 'FAIL'}"
symbol = :"Tests #{success ? 'PASS' : 'FAIL'}"
heredoc = <<~TEXT
  Tests #{success ? 'PASS' : 'FAIL'}
TEXT
regexp = /Tests #{success ? 'PASS' : 'FAIL'}/

# good
string = "Tests #{success ? "PASS" : "FAIL"}"
symbol = :"Tests #{success ? "PASS" : "FAIL"}"
heredoc = <<~TEXT
  Tests #{success ? "PASS" : "FAIL"}
TEXT
regexp = /Tests #{success ? "PASS" : "FAIL"}/

Prefer double-quoted strings inside interpolations.
Open

        formula1: "\"#{list_config[:options].join(', ')}\"",
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

Checks that quotes inside string, symbol, and regexp interpolations match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
string = "Tests #{success ? "PASS" : "FAIL"}"
symbol = :"Tests #{success ? "PASS" : "FAIL"}"
heredoc = <<~TEXT
  Tests #{success ? "PASS" : "FAIL"}
TEXT
regexp = /Tests #{success ? "PASS" : "FAIL"}/

# good
string = "Tests #{success ? 'PASS' : 'FAIL'}"
symbol = :"Tests #{success ? 'PASS' : 'FAIL'}"
heredoc = <<~TEXT
  Tests #{success ? 'PASS' : 'FAIL'}
TEXT
regexp = /Tests #{success ? 'PASS' : 'FAIL'}/

Example: EnforcedStyle: double_quotes

# bad
string = "Tests #{success ? 'PASS' : 'FAIL'}"
symbol = :"Tests #{success ? 'PASS' : 'FAIL'}"
heredoc = <<~TEXT
  Tests #{success ? 'PASS' : 'FAIL'}
TEXT
regexp = /Tests #{success ? 'PASS' : 'FAIL'}/

# good
string = "Tests #{success ? "PASS" : "FAIL"}"
symbol = :"Tests #{success ? "PASS" : "FAIL"}"
heredoc = <<~TEXT
  Tests #{success ? "PASS" : "FAIL"}
TEXT
regexp = /Tests #{success ? "PASS" : "FAIL"}/

Trailing whitespace detected.
Open

          errors_lines.push(error_line) 
Severity: Minor
Found in lib/ntq_excelsior/importer.rb by rubocop

Looks for trailing whitespace in the source code.

Example:

# The line in this example contains spaces after the 0.
# bad
x = 0

# The line in this example ends directly after the 0.
# good
x = 0

Example: AllowInHeredoc: false (default)

# The line in this example contains spaces after the 0.
# bad
code = <<~RUBY
  x = 0
RUBY

# ok
code = <<~RUBY
  x = 0 #{}
RUBY

# good
trailing_whitespace = ' '
code = <<~RUBY
  x = 0#{trailing_whitespace}
RUBY

Example: AllowInHeredoc: true

# The line in this example contains spaces after the 0.
# good
code = <<~RUBY
  x = 0
RUBY

Trailing whitespace detected.
Open

          at = (((index + 1).to_d / lines.size) * 100.to_d) 
Severity: Minor
Found in lib/ntq_excelsior/importer.rb by rubocop

Looks for trailing whitespace in the source code.

Example:

# The line in this example contains spaces after the 0.
# bad
x = 0

# The line in this example ends directly after the 0.
# good
x = 0

Example: AllowInHeredoc: false (default)

# The line in this example contains spaces after the 0.
# bad
code = <<~RUBY
  x = 0
RUBY

# ok
code = <<~RUBY
  x = 0 #{}
RUBY

# good
trailing_whitespace = ' '
code = <<~RUBY
  x = 0#{trailing_whitespace}
RUBY

Example: AllowInHeredoc: true

# The line in this example contains spaces after the 0.
# good
code = <<~RUBY
  x = 0
RUBY

Missing top-level documentation comment for class NtqExcelsior::Importer.
Open

  class Importer
Severity: Minor
Found in lib/ntq_excelsior/importer.rb by rubocop

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, constant definitions or constant visibility declarations.

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

module Math
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

# allowed
  # Class without body
  class Person
  end

  # Namespace - A namespace can be a class or a module
  # Containing a class
  module Namespace
    # Description/Explanation of Person class
    class Person
      # ...
    end
  end

  # Containing constant visibility declaration
  module Namespace
    class Private
    end

    private_constant :Private
  end

  # Containing constant definition
  module Namespace
    Public = Class.new
  end

  # Macro calls
  module Namespace
    extend Foo
  end

Example: AllowedConstants: ['ClassMethods']

# good
 module A
   module ClassMethods
     # ...
   end
  end

Prefer ::Regexp.last_match(1) over $1.
Open

        header = $1
Severity: Minor
Found in lib/ntq_excelsior/importer.rb by rubocop

Looks for uses of Perl-style regexp match backreferences and their English versions like $1, $2, $&, &+, $MATCH, $PREMATCH, etc.

Example:

# bad
puts $1

# good
puts Regexp.last_match(1)

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

        e.message.delete_prefix('[').delete_suffix(']').split(",").map(&:strip).each do |header_missing|
Severity: Minor
Found in lib/ntq_excelsior/importer.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 double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

gem 'caxlsx', "~> 3.2"
Severity: Minor
Found in Gemfile 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"

Extra empty line detected at class body end.
Open


    end
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

Checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: beginning_only

# good

class Foo

  def bar
    # ...
  end
end

Example: EnforcedStyle: ending_only

# good

class Foo
  def bar
    # ...
  end

end

Redundant safe navigation detected, use . instead.
Open

        if progression_tracker&.is_a?(Proc)
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

Checks for redundant safe navigation calls. Use cases where a constant, named in camel case for classes and modules is nil are rare, and an offense is not detected when the receiver is a constant. The detection also applies to literal receivers, except for nil.

For all receivers, the instance_of?, kind_of?, is_a?, eql?, respond_to?, and equal? methods are checked by default. These are customizable with AllowedMethods option.

The AllowedMethods option specifies nil-safe methods, in other words, it is a method that is allowed to skip safe navigation. Note that the AllowedMethod option is not an option that specifies methods for which to suppress (allow) this cop's check.

In the example below, the safe navigation operator (&.) is unnecessary because NilClass has methods like respond_to? and is_a?.

Safety:

This cop is unsafe, because autocorrection can change the return type of the expression. An offending expression that previously could return nil will be autocorrected to never return nil.

Example:

# bad
CamelCaseConst&.do_something

# bad
do_something if attrs&.respond_to?(:[])

# good
do_something if attrs.respond_to?(:[])

# bad
while node&.is_a?(BeginNode)
  node = node.parent
end

# good
CamelCaseConst.do_something

# good
while node.is_a?(BeginNode)
  node = node.parent
end

# good - without `&.` this will always return `true`
foo&.respond_to?(:to_a)

# bad - for `nil`s conversion methods return default values for the type
foo&.to_h || {}
foo&.to_h { |k, v| [k, v] } || {}
foo&.to_a || []
foo&.to_i || 0
foo&.to_f || 0.0
foo&.to_s || ''

# good
foo.to_h
foo.to_h { |k, v| [k, v] }
foo.to_a
foo.to_i
foo.to_f
foo.to_s

Example: AllowedMethods: [nilsafemethod]

# bad
do_something if attrs&.nil_safe_method(:[])

# good
do_something if attrs.nil_safe_method(:[])
do_something if attrs&.not_nil_safe_method(:[])

Unused block argument - index. If it's necessary, use _ or _index as an argument name to indicate that it won't be used.
Open

        content[:styles]&.each_with_index do |(range, sty), index|
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

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

# good
do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

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

Example: IgnoreEmptyBlocks: true (default)

# good
do_something { |unused| }

Example: IgnoreEmptyBlocks: false

# bad
do_something { |unused| }

Example: AllowUnusedKeywordArguments: false (default)

# bad
do_something do |unused: 42|
  foo
end

Example: AllowUnusedKeywordArguments: true

# good
do_something do |unused: 42|
  foo
end

Use row_styles.length.zero? instead of row_styles.length == 0.
Open

      return {} if row_styles.length == 0 && cell_styles.length == 0
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

Checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. This cop can also be configured to do the reverse.

This cop can be customized allowed methods with AllowedMethods. By default, there are no methods to allowed.

This cop disregards #nonzero? as its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

This cop allows comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Integer polymorphic.

Safety:

This cop is unsafe because it cannot be guaranteed that the receiver defines the predicates or can be compared to a number, which may lead to a false positive for non-standard classes.

Example: EnforcedStyle: predicate (default)

# bad
foo == 0
0 > foo
bar.baz > 0

# good
foo.zero?
foo.negative?
bar.baz.positive?

Example: EnforcedStyle: comparison

# bad
foo.zero?
foo.negative?
bar.baz.positive?

# good
foo == 0
0 > foo
bar.baz > 0

Example: AllowedMethods: [] (default) with EnforcedStyle: predicate

# bad
foo == 0
0 > foo
bar.baz > 0

Example: AllowedMethods: [==] with EnforcedStyle: predicate

# good
foo == 0

# bad
0 > foo
bar.baz > 0

Example: AllowedPatterns: [] (default) with EnforcedStyle: comparison

# bad
foo.zero?
foo.negative?
bar.baz.positive?

Example: AllowedPatterns: ['zero'] with EnforcedStyle: predicate

# good
# bad
foo.zero?

# bad
foo.negative?
bar.baz.positive?

Use cell_styles.length.zero? instead of cell_styles.length == 0.
Open

      return {} if row_styles.length == 0 && cell_styles.length == 0
Severity: Minor
Found in lib/ntq_excelsior/exporter.rb by rubocop

Checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. This cop can also be configured to do the reverse.

This cop can be customized allowed methods with AllowedMethods. By default, there are no methods to allowed.

This cop disregards #nonzero? as its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

This cop allows comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Integer polymorphic.

Safety:

This cop is unsafe because it cannot be guaranteed that the receiver defines the predicates or can be compared to a number, which may lead to a false positive for non-standard classes.

Example: EnforcedStyle: predicate (default)

# bad
foo == 0
0 > foo
bar.baz > 0

# good
foo.zero?
foo.negative?
bar.baz.positive?

Example: EnforcedStyle: comparison

# bad
foo.zero?
foo.negative?
bar.baz.positive?

# good
foo == 0
0 > foo
bar.baz > 0

Example: AllowedMethods: [] (default) with EnforcedStyle: predicate

# bad
foo == 0
0 > foo
bar.baz > 0

Example: AllowedMethods: [==] with EnforcedStyle: predicate

# good
foo == 0

# bad
0 > foo
bar.baz > 0

Example: AllowedPatterns: [] (default) with EnforcedStyle: comparison

# bad
foo.zero?
foo.negative?
bar.baz.positive?

Example: AllowedPatterns: ['zero'] with EnforcedStyle: predicate

# good
# bad
foo.zero?

# bad
foo.negative?
bar.baz.positive?
Severity
Category
Status
Source
Language