bio-miga/miga-gui

View on GitHub
lib/miga/gui/view.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Class has too many lines. [216/100]
Open

class MiGA::GUI::View < Shoes
  
  # Class-level
  url "/",        :index
  url "/blank",        :blank
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

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

Assignment Branch Condition size for report is too high. [53.24/15]
Open

  def report
    header("\xC2\xBB " + c.project.name.unmiga_name)
    stack(margin:40) do
      @done_para = subtitle "Dataset tasks advance: "
      @done = 0.0
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for dataset is too high. [39.2/15]
Open

  def dataset(name)
    header("\xC2\xBB " + c.project.name.unmiga_name +
      " \xC2\xBB " + name.unmiga_name)
    stack(margin:40) do
      ds = c.project.dataset(name)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for graphic_advance is too high. [35.75/15]
Open

    def graphic_advance(ds, h=10)
      ds_adv = ds.profile_advance
      flow(width:30*MiGA::Dataset.PREPROCESSING_TASKS.size) do
        nostroke
        col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

  def report
    header("\xC2\xBB " + c.project.name.unmiga_name)
    stack(margin:40) do
      @done_para = subtitle "Dataset tasks advance: "
      @done = 0.0
Severity: Minor
Found in lib/miga/gui/view.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.

Assignment Branch Condition size for project is too high. [29.02/15]
Open

  def project
    header "\xC2\xBB #{c.project.name.unmiga_name}"
    stack(margin:40) do
      menu_bar [:list_datasets, :new_dataset, :progress_report, :help]
      stack(margin_top:10) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

  def dataset(name)
    header("\xC2\xBB " + c.project.name.unmiga_name +
      " \xC2\xBB " + name.unmiga_name)
    stack(margin:40) do
      ds = c.project.dataset(name)
Severity: Minor
Found in lib/miga/gui/view.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. [23/10]
Open

    def graphic_advance(ds, h=10)
      ds_adv = ds.profile_advance
      flow(width:30*MiGA::Dataset.PREPROCESSING_TASKS.size) do
        nostroke
        col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
Severity: Minor
Found in lib/miga/gui/view.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.

Assignment Branch Condition size for box is too high. [27.46/15]
Open

    def box(opts={}, &blk)
      flow(margin_bottom:5) do
        opts[:alpha] ||= 0.2
        opts[:side_line] ||= miga_blue
        opts[:background] ||= miga_blue(opts[:alpha])
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for datasets is too high. [27/15]
Open

  def datasets
    header "\xC2\xBB #{c.project.name.unmiga_name}"
    stack(margin:40, margin_top:10) do
      subtitle "#{c.project.metadata[:datasets].size} datasets:"
      para ""
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

    def box(opts={}, &blk)
      flow(margin_bottom:5) do
        opts[:alpha] ||= 0.2
        opts[:side_line] ||= miga_blue
        opts[:background] ||= miga_blue(opts[:alpha])
Severity: Minor
Found in lib/miga/gui/view.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. [17/10]
Open

    def menu_bar actions
      box do
        flow do
          img = {
            open_project: "iconmonstr-archive-5-icon-40",
Severity: Minor
Found in lib/miga/gui/view.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. [14/10]
Open

  def datasets
    header "\xC2\xBB #{c.project.name.unmiga_name}"
    stack(margin:40, margin_top:10) do
      subtitle "#{c.project.metadata[:datasets].size} datasets:"
      para ""
Severity: Minor
Found in lib/miga/gui/view.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. [13/10]
Open

    def status_bar(*msg)
      stack(bottom:0) do
        flow bottom:0, height:20, margin:0 do
          background "#CCC"
          stack(width:-300, height:1.0, margin_left:45) do
Severity: Minor
Found in lib/miga/gui/view.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. [11/10]
Open

  def project
    header "\xC2\xBB #{c.project.name.unmiga_name}"
    stack(margin:40) do
      menu_bar [:list_datasets, :new_dataset, :progress_report, :help]
      stack(margin_top:10) do
Severity: Minor
Found in lib/miga/gui/view.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 report has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def report
    header("\xC2\xBB " + c.project.name.unmiga_name)
    stack(margin:40) do
      @done_para = subtitle "Dataset tasks advance: "
      @done = 0.0
Severity: Minor
Found in lib/miga/gui/view.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method box has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def box(opts={}, &blk)
      flow(margin_bottom:5) do
        opts[:alpha] ||= 0.2
        opts[:side_line] ||= miga_blue
        opts[:background] ||= miga_blue(opts[:alpha])
Severity: Minor
Found in lib/miga/gui/view.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method graphic_advance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def graphic_advance(ds, h=10)
      ds_adv = ds.profile_advance
      flow(width:30*MiGA::Dataset.PREPROCESSING_TASKS.size) do
        nostroke
        col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
Severity: Minor
Found in lib/miga/gui/view.rb - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Inconsistent indentation detected.
Open

            para link(name.unmiga_name){ c.show_dataset(name) },
              margin:5, align: "center"
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Space missing after colon.
Open

        flow bottom:0, height:20, margin:0 do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          stack(width:-300, height:1.0, margin_left:45) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          stack(width:160, margin:2) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          stack(width:-300, height:1.0, margin_left:45) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          left:10, bottom:5, width:30, height:32
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

      rgb(0,121,166,alpha)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

          stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing to the left of {.
Open

      (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

1 trailing blank lines detected.
Open

Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Ambiguous splat operator. Parenthesize the method arguments if it's surely a splat operator, or add a whitespace to the right of the * if it should be a multiplication.
Open

        inscription *msg, margin:5
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks for ambiguous operators in the first argument of a method invocation without parentheses.

Example:

# bad

# The `*` is interpreted as a splat operator but it could possibly be
# a `*` method invocation (i.e. `do_something.*(some_array)`).
do_something *some_array

Example:

# good

# With parentheses, there's no ambiguity.
do_something(*some_array)

Missing top-level class documentation comment.
Open

class MiGA::GUI::View < Shoes
Severity: Minor
Found in lib/miga/gui/view.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

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

          subtitle "Advance"
Severity: Minor
Found in lib/miga/gui/view.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 2 (not -5) spaces for indentation.
Open

        background miga_blue(0.25)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for indentation that doesn't use the specified number of spaces.

See also the IndentationConsistency cop which is the companion to this one.

Example:

# bad
class A
 def test
  puts 'hello'
 end
end

# good
class A
  def test
    puts 'hello'
  end
end

Example: IgnoredPatterns: ['^\s*module']

# bad
module A
class B
  def test
  puts 'hello'
  end
end
end

# good
module A
class B
  def test
    puts 'hello'
  end
end
end

Space missing after comma.
Open

      rgb(179,0,3,alpha)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

          stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Surrounding space missing for operator ==.
Open

      end if @done==1.0
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator *.
Open

      flow(width:30*MiGA::Dataset.PREPROCESSING_TASKS.size) do
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator >.
Open

      (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
Severity: Minor
Found in lib/miga/gui/view.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

Space inside } missing.
Open

            help: "iconmonstr-help-3-icon-40"}
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

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

      @done_para = subtitle "Dataset tasks advance: "
Severity: Minor
Found in lib/miga/gui/view.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"

Inconsistent indentation detected.
Open

    def box(opts={}, &blk)
      flow(margin_bottom:5) do
        opts[:alpha] ||= 0.2
        opts[:side_line] ||= miga_blue
        opts[:background] ||= miga_blue(opts[:alpha])
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Space missing after colon.
Open

    stack(margin:40) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

            inscription MiGA::MiGA.LONG_VERSION, align:"right", margin:5
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

        col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing to the left of {.
Open

          @done = c.project.datasets.map{|ds| graphic_advance(ds,7)}.inject(:+)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Space missing inside }.
Open

      return 0.0 if ds_adv.count{|i| i>0} <= 1
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

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

        stack(width: 5, height: 1.0) do
          background opts[:side_line]
        end if opts[:right]
Severity: Minor
Found in lib/miga/gui/view.rb 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 when you don't need string interpolation or special symbols.
Open

require "shoes/swt"
Severity: Minor
Found in lib/miga/gui/view.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

  url "/",        :index
Severity: Minor
Found in lib/miga/gui/view.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

        ds.metadata.each { |k,v| para strong(k.to_s.capitalize), ": ", v }
Severity: Minor
Found in lib/miga/gui/view.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"

Align the parameters of a method call if they span more than one line.
Open

          "please consider citing:\n", MiGA::MiGA.CITATION
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Here we check if the parameters on a multi-line method call or definition are aligned.

Example: EnforcedStyle: withfirstparameter (default)

# good

foo :bar,
    :baz

# bad

foo :bar,
  :baz

Example: EnforcedStyle: withfixedindentation

# good

foo :bar,
  :baz

# bad

foo :bar,
    :baz

Space missing after colon.
Open

    stack(margin:40, margin_top:10) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          s = stack(margin:5, &blk)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

        col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

      rgb(179,0,3,alpha)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

          stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing to the left of {.
Open

            para link(name.unmiga_name){ c.show_dataset(name) },
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Trailing whitespace detected.
Open

    
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Do not introduce global variables.
Open

              image $miga_gui_path + "/img/#{img[k]}.png", margin: 2
Severity: Minor
Found in lib/miga/gui/view.rb 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

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

        para strong("Path"), ": ", c.project.path
Severity: Minor
Found in lib/miga/gui/view.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

          para sprintf("%.1f%% Complete", done*100)
Severity: Minor
Found in lib/miga/gui/view.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"

Align the parameters of a method call if they span more than one line.
Open

              margin:5, align: "center"
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Here we check if the parameters on a multi-line method call or definition are aligned.

Example: EnforcedStyle: withfirstparameter (default)

# good

foo :bar,
    :baz

# bad

foo :bar,
  :baz

Example: EnforcedStyle: withfixedindentation

# good

foo :bar,
  :baz

# bad

foo :bar,
    :baz

Inconsistent indentation detected.
Open

    def show_report_hover(w, y)
      unless @task.nil?
        @task_ds_box.clear do
          para strong("Task: "), @task, "\n", strong("Dataset: "), @dataset
        end
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Space missing after colon.
Open

      flow(margin_top:10) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

    stack(margin:40) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

        flow bottom:0, height:20, margin:0 do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

            inscription MiGA::MiGA.LONG_VERSION, align:"right", margin:5
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

          @done = c.project.datasets.map{|ds| graphic_advance(ds,7)}.inject(:+)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Surrounding space missing in default value assignment.
Open

    def graphic_advance(ds, h=10)
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing in default value assignment.
Open

    def box(opts={}, &blk)
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator -.
Open

        @task_ds_box.move(w-20, y-115)
Severity: Minor
Found in lib/miga/gui/view.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

Space missing to the left of {.
Open

            s.click{ visit opts[:click] }
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Tab detected.
Open

    title msg, margin_top: 6, margin_left: 6
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

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

    header("Microbial Genomes Atlas")
Severity: Minor
Found in lib/miga/gui/view.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

            (c.project.add_result(t, false).nil? ? "Pending" : "Done")
Severity: Minor
Found in lib/miga/gui/view.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"

Space missing after colon.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Surrounding space missing for operator +.
Open

        w = 40+30*MiGA::Dataset.PREPROCESSING_TASKS.size
Severity: Minor
Found in lib/miga/gui/view.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

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

    Shoes.app title: "MiGA | Microbial Genomes Atlas",
Severity: Minor
Found in lib/miga/gui/view.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

        subtitle "Project-wide tasks:"
Severity: Minor
Found in lib/miga/gui/view.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

  url "/",        :index
Severity: Minor
Found in lib/miga/gui/view.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"

Inconsistent indentation detected.
Open

    def miga_blue(alpha=1.0)
      rgb(0,121,166,alpha)
    end
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Space missing after colon.
Open

    stack(margin:40) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

            flow(margin:0, width:200) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

        inscription *msg, margin:5
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Closing hash brace must be on the line after the last hash element when opening brace is on a separate line from the first hash element.
Open

            help: "iconmonstr-help-3-icon-40"}
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks that the closing brace in a hash literal is either on the same line as the last hash element, or a new line.

When using the symmetrical (default) style:

If a hash's opening brace is on the same line as the first element of the hash, then the closing brace should be on the same line as the last element of the hash.

If a hash's opening brace is on the line above the first element of the hash, then the closing brace should be on the line below the last element of the hash.

When using the new_line style:

The closing brace of a multi-line hash literal must be on the line after the last element of the hash.

When using the same_line style:

The closing brace of a multi-line hash literal must be on the same line as the last element of the hash.

Example: EnforcedStyle: symmetrical (default)

# bad
  { a: 1,
    b: 2
  }
  # bad
  {
    a: 1,
    b: 2 }

  # good
  { a: 1,
    b: 2 }

  # good
  {
    a: 1,
    b: 2
  }

Example: EnforcedStyle: new_line

# bad
  {
    a: 1,
    b: 2 }

  # bad
  { a: 1,
    b: 2 }

  # good
  { a: 1,
    b: 2
  }

  # good
  {
    a: 1,
    b: 2
  }

Example: EnforcedStyle: same_line

# bad
  { a: 1,
    b: 2
  }

  # bad
  {
    a: 1,
    b: 2
  }

  # good
  {
    a: 1,
    b: 2 }

  # good
  { a: 1,
    b: 2 }

Space missing after colon.
Open

              margin:5, align: "center"
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

      flow(margin:[40,10,40,0]) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after colon.
Open

      flow(margin:[40,10,40,0]) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

        col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing to the left of {.
Open

          stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Space between { and | missing.
Open

      return 0.0 if ds_adv.count{|i| i>0} <= 1
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

Space missing after comma.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space between { and | missing.
Open

      (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

Tab detected.
Open

        background miga_blue(0.25)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Surrounding space missing in default value assignment.
Open

    def miga_blue(alpha=1.0)
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator ==.
Open

          para(strong(k.to_s.capitalize), ": ", v) unless k==:datasets
Severity: Minor
Found in lib/miga/gui/view.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 def with parentheses when there are parameters.
Open

    def menu_bar actions
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for parentheses around the arguments in method definitions. Both instance and class/singleton methods are checked.

Example: EnforcedStyle: require_parentheses (default)

# The `require_parentheses` style requires method definitions
# to always use parentheses

# bad
def bar num1, num2
  num1 + num2
end

def foo descriptive_var_name,
        another_descriptive_var_name,
        last_descriptive_var_name
  do_something
end

# good
def bar(num1, num2)
  num1 + num2
end

def foo(descriptive_var_name,
        another_descriptive_var_name,
        last_descriptive_var_name)
  do_something
end

Example: EnforcedStyle: requirenoparentheses

# The `require_no_parentheses` style requires method definitions
# to never use parentheses

# bad
def bar(num1, num2)
  num1 + num2
end

def foo(descriptive_var_name,
        another_descriptive_var_name,
        last_descriptive_var_name)
  do_something
end

# good
def bar num1, num2
  num1 + num2
end

def foo descriptive_var_name,
        another_descriptive_var_name,
        last_descriptive_var_name
  do_something
end

Example: EnforcedStyle: requirenoparenthesesexceptmultiline

# The `require_no_parentheses_except_multiline` style prefers no
# parantheses when method definition arguments fit on single line,
# but prefers parantheses when arguments span multiple lines.

# bad
def bar(num1, num2)
  num1 + num2
end

def foo descriptive_var_name,
        another_descriptive_var_name,
        last_descriptive_var_name
  do_something
end

# good
def bar num1, num2
  num1 + num2
end

def foo(descriptive_var_name,
        another_descriptive_var_name,
        last_descriptive_var_name)
  do_something
end

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

  $miga_gui_path = File.expand_path("../../../../", __FILE__)
Severity: Minor
Found in lib/miga/gui/view.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"

Space missing to the left of {.
Open

            @task_name_field.clear{ para @task }
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

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

    MiGA::GUI::View.init(blk: big_blk) { visit "/blank" }
Severity: Minor
Found in lib/miga/gui/view.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

          para(strong(k.to_s.capitalize), ": ", v) unless k==:datasets
Severity: Minor
Found in lib/miga/gui/view.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"

Tab detected.
Open

        inscription *msg, margin:5
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

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

require "miga/gui/controller"
Severity: Minor
Found in lib/miga/gui/view.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

      para ""
Severity: Minor
Found in lib/miga/gui/view.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

            (c.project.add_result(t, false).nil? ? "Pending" : "Done")
Severity: Minor
Found in lib/miga/gui/view.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"

Align the elements of a hash literal if they span more than one line.
Open

      width: 750, height: 400, resizable: false, data: data, &blk
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

- key (left align keys)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)

The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
- ignore_explicit (with curly braces)

Example:

# EnforcedHashRocketStyle: key (default)
# EnforcedColonStyle: key (default)

# good
{
  foo: bar,
  ba: baz
}
{
  :foo => bar,
  :ba => baz
}

# bad
{
  foo: bar,
   ba: baz
}
{
  :foo => bar,
   :ba => baz
}

Example:

# EnforcedHashRocketStyle: separator
# EnforcedColonStyle: separator

#good
{
  foo: bar,
   ba: baz
}
{
  :foo => bar,
   :ba => baz
}

#bad
{
  foo: bar,
  ba: baz
}
{
  :foo => bar,
  :ba => baz
}
{
  :foo => bar,
  :ba  => baz
}

Example:

# EnforcedHashRocketStyle: table
# EnforcedColonStyle: table

#good
{
  foo: bar,
  ba:  baz
}
{
  :foo => bar,
  :ba  => baz
}

#bad
{
  foo: bar,
  ba: baz
}
{
  :foo => bar,
   :ba => baz
}

Align the parameters of a method call if they span more than one line.
Open

          left:10, bottom:5, width:30, height:32
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Here we check if the parameters on a multi-line method call or definition are aligned.

Example: EnforcedStyle: withfirstparameter (default)

# good

foo :bar,
    :baz

# bad

foo :bar,
  :baz

Example: EnforcedStyle: withfixedindentation

# good

foo :bar,
  :baz

# bad

foo :bar,
    :baz

Inconsistent indentation detected.
Open

    def miga_red(alpha=1.0)
      rgb(179,0,3,alpha)
    end  
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Space missing after colon.
Open

          stack(width:250, height:1.0, right: 5) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

      flow(margin_bottom:5) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

        c.project.metadata.each do |k,v|
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

          motion { |_,y| show_report_hover(w, y) }
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

      flow(margin:[40,10,40,0]) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

      rgb(0,121,166,alpha)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Surrounding space missing for operator -.
Open

        @task_ds_box.move(w-20, y-115)
Severity: Minor
Found in lib/miga/gui/view.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

Space missing to the left of {.
Open

      return 0.0 if ds_adv.count{|i| i>0} <= 1
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Space missing inside }.
Open

      (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

Trailing whitespace detected.
Open

    
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

      unless @task.nil?
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

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

    status_bar "Microbial Genomes Atlas"
Severity: Minor
Found in lib/miga/gui/view.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

        para strong("Datasets"), ": ", c.project.metadata[:datasets].size
Severity: Minor
Found in lib/miga/gui/view.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

          para strong(t), ": ",
Severity: Minor
Found in lib/miga/gui/view.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"

Space missing after colon.
Open

        stack(width:w) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

        stack(width:-w) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

      @task_ds_box = stack(width:-w)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

        flow bottom:0, height:20, margin:0 do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

        col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

      rgb(179,0,3,alpha)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Surrounding space missing for operator *.
Open

      w = 40+30*MiGA::Dataset.PREPROCESSING_TASKS.size
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator *.
Open

        @done_para.text += sprintf("%.1f%% Complete.", @done*100)
Severity: Minor
Found in lib/miga/gui/view.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

Space missing to the left of {.
Open

              button(k.to_s.unmiga_name.capitalize, top:5){ c.send(k) }
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Space between { and | missing.
Open

      (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

Trailing whitespace detected.
Open

  
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Trailing whitespace detected.
Open

    
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Favor format over sprintf.
Open

        @done_para.text += sprintf("%.1f%% Complete.", @done*100)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop enforces the use of a single string formatting utility. Valid options include Kernel#format, Kernel#sprintf and String#%.

The detection of String#% cannot be implemented in a reliable manner for all cases, so only two scenarios are considered - if the first argument is a string literal and if the second argument is an array literal.

Example: EnforcedStyle: format(default)

# bad
puts sprintf('%10s', 'hoge')
puts '%10s' % 'hoge'

# good
puts format('%10s', 'hoge')

Example: EnforcedStyle: sprintf

# bad
puts format('%10s', 'hoge')
puts '%10s' % 'hoge'

# good
puts sprintf('%10s', 'hoge')

Example: EnforcedStyle: percent

# bad
puts format('%10s', 'hoge')
puts sprintf('%10s', 'hoge')

# good
puts '%10s' % 'hoge'

Do not introduce global variables.
Open

        image "#{$miga_gui_path}/img/MiGA-sq.png",
Severity: Minor
Found in lib/miga/gui/view.rb 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

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

        para strong("Path"), ": ", c.project.path
Severity: Minor
Found in lib/miga/gui/view.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

        para strong("Datasets"), ": ", c.project.metadata[:datasets].size
Severity: Minor
Found in lib/miga/gui/view.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

              margin:5, align: "center"
Severity: Minor
Found in lib/miga/gui/view.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

          subtitle "Task"
Severity: Minor
Found in lib/miga/gui/view.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"

Space missing after colon.
Open

      stack(margin_top:10) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

    stack(margin:40) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

      stack(bottom:0) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          left:10, bottom:5, width:30, height:32
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

      flow(width:30*MiGA::Dataset.PREPROCESSING_TASKS.size) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

      rgb(0,121,166,alpha)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Surrounding space missing for operator *.
Open

        w = 40+30*MiGA::Dataset.PREPROCESSING_TASKS.size
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator *.
Open

          para sprintf("%.1f%% Complete", done*100)
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator +.
Open

      w = 40+30*MiGA::Dataset.PREPROCESSING_TASKS.size
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator /.
Open

      (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
Severity: Minor
Found in lib/miga/gui/view.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

Space missing inside }.
Open

      (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

Tab detected.
Open

      end
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Trailing whitespace detected.
Open

  
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Trailing whitespace detected.
Open

    
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Do not introduce global variables.
Open

  $miga_gui_path = File.expand_path("../../../../", __FILE__)
Severity: Minor
Found in lib/miga/gui/view.rb 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

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

        stack(width: 5, height: 1.0) do
          background opts[:side_line]
        end unless opts[:right]
Severity: Minor
Found in lib/miga/gui/view.rb 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 when you don't need string interpolation or special symbols.
Open

          @task_name_field = stack { para "" }
Severity: Minor
Found in lib/miga/gui/view.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"

Inconsistent indentation detected.
Open

    def menu_bar actions
      box do
        flow do
          img = {
            open_project: "iconmonstr-archive-5-icon-40",
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Inconsistent indentation detected.
Open

    def graphic_advance(ds, h=10)
      ds_adv = ds.profile_advance
      flow(width:30*MiGA::Dataset.PREPROCESSING_TASKS.size) do
        nostroke
        col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Use 2 (not -5) spaces for indentation.
Open

    image $miga_gui_path + "/img/MiGA-sm.png", width: 120, height: 50
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for indentation that doesn't use the specified number of spaces.

See also the IndentationConsistency cop which is the companion to this one.

Example:

# bad
class A
 def test
  puts 'hello'
 end
end

# good
class A
  def test
    puts 'hello'
  end
end

Example: IgnoredPatterns: ['^\s*module']

# bad
module A
class B
  def test
  puts 'hello'
  end
end
end

# good
module A
class B
  def test
    puts 'hello'
  end
end
end

Space missing after colon.
Open

    stack(margin:40, margin_top:10) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

      stack(width:w) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

            flow(margin:0, width:200) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

        ds.metadata.each { |k,v| para strong(k.to_s.capitalize), ": ", v }
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Space missing after comma.
Open

      flow(margin:[40,10,40,0]) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Surrounding space missing for operator ==.
Open

        tasks += MiGA::Project.INCLADE_TASK if c.project.metadata[:type]==:clade
Severity: Minor
Found in lib/miga/gui/view.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

Space missing inside }.
Open

          @done = c.project.datasets.map{|ds| graphic_advance(ds,7)}.inject(:+)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

end at 202, 3 is not aligned with stack(width:-300, height:1.0, margin_left:45) do at 200, 10.
Open

      end
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks whether the end keywords are aligned properly for do end blocks.

Three modes are supported through the EnforcedStyleAlignWith configuration parameter:

start_of_block : the end shall be aligned with the start of the line where the do appeared.

start_of_line : the end shall be aligned with the start of the line where the expression started.

either (which is the default) : the end is allowed to be in either location. The autofixer will default to start_of_line.

Example: EnforcedStyleAlignWith: either (default)

# bad

foo.bar
   .each do
     baz
       end

# good

variable = lambda do |i|
  i
end

Example: EnforcedStyleAlignWith: startofblock

# bad

foo.bar
   .each do
     baz
       end

# good

foo.bar
  .each do
     baz
   end

Example: EnforcedStyleAlignWith: startofline

# bad

foo.bar
   .each do
     baz
       end

# good

foo.bar
  .each do
     baz
end

Favor format over sprintf.
Open

          para sprintf("%.1f%% Complete", done*100)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop enforces the use of a single string formatting utility. Valid options include Kernel#format, Kernel#sprintf and String#%.

The detection of String#% cannot be implemented in a reliable manner for all cases, so only two scenarios are considered - if the first argument is a string literal and if the second argument is an array literal.

Example: EnforcedStyle: format(default)

# bad
puts sprintf('%10s', 'hoge')
puts '%10s' % 'hoge'

# good
puts format('%10s', 'hoge')

Example: EnforcedStyle: sprintf

# bad
puts format('%10s', 'hoge')
puts '%10s' % 'hoge'

# good
puts sprintf('%10s', 'hoge')

Example: EnforcedStyle: percent

# bad
puts format('%10s', 'hoge')
puts sprintf('%10s', 'hoge')

# good
puts '%10s' % 'hoge'

Do not introduce global variables.
Open

    image $miga_gui_path + "/img/MiGA-sm.png", width: 120, height: 50
Severity: Minor
Found in lib/miga/gui/view.rb 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

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

  url "/blank",        :blank
Severity: Minor
Found in lib/miga/gui/view.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

        para "Welcome to the MiGA GUI. If you use MiGA in your research, ",
Severity: Minor
Found in lib/miga/gui/view.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"

Align the parameters of a method call if they span more than one line.
Open

            (c.project.add_result(t, false).nil? ? "Pending" : "Done")
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Here we check if the parameters on a multi-line method call or definition are aligned.

Example: EnforcedStyle: withfirstparameter (default)

# good

foo :bar,
    :baz

# bad

foo :bar,
  :baz

Example: EnforcedStyle: withfixedindentation

# good

foo :bar,
  :baz

# bad

foo :bar,
    :baz

Inconsistent indentation detected.
Open

    def header(msg)
      flow(margin:[40,10,40,0]) do
    image $miga_gui_path + "/img/MiGA-sm.png", width: 120, height: 50
    title msg, margin_top: 6, margin_left: 6
      end
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Space missing after colon.
Open

          stack(width:160, margin:2) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

        stack(margin_top:10) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after comma.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

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

          unless opts[:click].nil?
Severity: Minor
Found in lib/miga/gui/view.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?

Inconsistent indentation detected.
Open

    def status_bar(*msg)
      stack(bottom:0) do
        flow bottom:0, height:20, margin:0 do
          background "#CCC"
          stack(width:-300, height:1.0, margin_left:45) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Space missing after colon.
Open

      stack(margin_top:10) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          left:10, bottom:5, width:30, height:32
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Surrounding space missing in default value assignment.
Open

  def self.init(data={}, &blk)
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing in default value assignment.
Open

  def new_window(controller=nil, &blk)
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator ==.
Open

      (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
Severity: Minor
Found in lib/miga/gui/view.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

Space missing to the left of {.
Open

      (ds_adv.count{|i| i==1}.to_f - 1.0)/(ds_adv.count{|i| i>0}.to_f - 1.0)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Space between { and | missing.
Open

          @done = c.project.datasets.map{|ds| graphic_advance(ds,7)}.inject(:+)
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

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

require "shoes"
Severity: Minor
Found in lib/miga/gui/view.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

        @done_para.text += sprintf("%.1f%% Complete.", @done*100)
Severity: Minor
Found in lib/miga/gui/view.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"

Space missing after colon.
Open

          stack(width:250, height:1.0, right: 5) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Surrounding space missing in default value assignment.
Open

    def miga_red(alpha=1.0)
Severity: Minor
Found in lib/miga/gui/view.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

Surrounding space missing for operator *.
Open

          stack(width:28,margin:0,top:0,left:i*30,height:h) do
Severity: Minor
Found in lib/miga/gui/view.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

Tab detected.
Open

    image $miga_gui_path + "/img/MiGA-sm.png", width: 120, height: 50
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Use nested module/class definitions instead of compact style.
Open

class MiGA::GUI::View < Shoes
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

Example: EnforcedStyle: nested (default)

# good
# have each child on its own line
class Foo
  class Bar
  end
end

Example: EnforcedStyle: compact

# good
# combine definitions as much as possible
class Foo::Bar
end

The compact style is only forced for classes/modules with one child.

Space missing after colon.
Open

              button(k.to_s.unmiga_name.capitalize, top:5){ c.send(k) }
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          stack(width:-300, height:1.0, margin_left:45) do
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Space missing after colon.
Open

          left:10, bottom:5, width:30, height:32
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

Checks for colon (:) not followed by some kind of space. N.B. this cop does not handle spaces after a ternary operator, which are instead handled by Layout/SpaceAroundOperators.

Example:

# bad
def f(a:, b:2); {a:3}; end

# good
def f(a:, b: 2); {a: 3}; end

Surrounding space missing for operator >.
Open

      return 0.0 if ds_adv.count{|i| i>0} <= 1
Severity: Minor
Found in lib/miga/gui/view.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

Trailing whitespace detected.
Open

    end  
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

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

      stack(margin_top:10) do
        subtitle "Project-wide tasks:"
        tasks = MiGA::Project.DISTANCE_TASKS
        tasks += MiGA::Project.INCLADE_TASK if c.project.metadata[:type]==:clade
        tasks.each do |t|
Severity: Minor
Found in lib/miga/gui/view.rb 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 when you don't need string interpolation or special symbols.
Open

          para strong("Task: "), @task, "\n", strong("Dataset: "), @dataset
Severity: Minor
Found in lib/miga/gui/view.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

            new_dataset: "iconmonstr-note-25-icon-40",
Severity: Minor
Found in lib/miga/gui/view.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

            progress_report: "iconmonstr-bar-chart-2-icon-40",
Severity: Minor
Found in lib/miga/gui/view.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

            new_project: "iconmonstr-plus-5-icon-40",
Severity: Minor
Found in lib/miga/gui/view.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

        col = ["#CCC", rgb(119,130,61), rgb(160,41,50)]
Severity: Minor
Found in lib/miga/gui/view.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

            open_project: "iconmonstr-archive-5-icon-40",
Severity: Minor
Found in lib/miga/gui/view.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 %i or %I for an array of symbols.
Open

      menu_bar [:open_project, :new_project, :help]
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

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

            inscription MiGA::MiGA.LONG_VERSION, align:"right", margin:5
Severity: Minor
Found in lib/miga/gui/view.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 %i or %I for an array of symbols.
Open

      menu_bar [:list_datasets, :new_dataset, :progress_report, :help]
Severity: Minor
Found in lib/miga/gui/view.rb by rubocop

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

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

    image $miga_gui_path + "/img/MiGA-sm.png", width: 120, height: 50
Severity: Minor
Found in lib/miga/gui/view.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

          background "#CCC"
Severity: Minor
Found in lib/miga/gui/view.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

          para strong("Task: "), @task, "\n", strong("Dataset: "), @dataset
Severity: Minor
Found in lib/miga/gui/view.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

            help: "iconmonstr-help-3-icon-40"}
Severity: Minor
Found in lib/miga/gui/view.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

            list_datasets: "iconmonstr-note-10-icon-40",
Severity: Minor
Found in lib/miga/gui/view.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"

There are no issues that match your filters.

Category
Status