bio-miga/miga

View on GitHub

Showing 839 of 1,651 total issues

Assignment Branch Condition size for check_directories is too high. [16.88/15]
Open

  def check_directories
    each_project do |project|
      d = project_daemon(project)
      next if d.active?

Severity: Minor
Found in lib/miga/lair.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. [11/10]
Open

  def test_set_bool
    o = TestWithOption.new
    assert_nil(o.option(:bool))
    assert(!o.saved)
    assert_raise { o.set_option(:bool, 'true') }
Severity: Minor
Found in test/with_option_test.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 test_declare_alive_loop is too high. [16.28/15]
Open

  def test_declare_alive_loop
    d = TestWithDaemon.new(tmpfile('nope'))
    assert_equal(:no_home, d.declare_alive_loop)

    d = TestWithDaemon.new(tmpdir)
Severity: Minor
Found in test/with_daemon_test.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. [11/10]
Open

  def setup
    initialize_miga_home(
      <<~DAEMON
        { "maxjobs": 1, "ppn": 1, "latency": 1, "varsep": " ",
          "var": "{{key}}={{value}}", "cmd": "echo {{task_name}} >/dev/null",
Severity: Minor
Found in test/lair_test.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 test_unlink
    r = project.add_result(:clade_finding)
    path = r.path
    done = r.path(:done)
    data = r.file_path(:empty)
Severity: Minor
Found in test/result_test.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 test_each_project is too high. [16.28/15]
Open

  def test_each_project
    lair = MiGA::Lair.new(tmpdir)
    y = []
    lair.each_project { |p| y << p }
    assert_equal(3, y.size)
Severity: Minor
Found in test/lair_test.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. [11/10]
Confirmed

  def initialize(ids, db, universe)
    ids = [ids] unless ids.is_a? Array
    @ids = (ids.is_a?(Array) ? ids : [ids])
    @db = db.to_sym
    @universe = universe.to_sym
Severity: Minor
Found in lib/miga/remote_dataset.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 aai_taxtest is too high. [16.09/15]
Open

    def aai_taxtest(aai, test, opts = {})
      meaning = {
        most_likely: [0.00, 0.01],
        probably: [0.01, 0.10],
        possibly_even: [0.10, 0.50]
Severity: Minor
Found in lib/miga/tax_dist.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

Perceived complexity for runopts is too high. [8/7]
Open

  def runopts(k, v = nil, force = false)
    k = k.to_sym
    unless v.nil?
      case k
      when :latency, :maxjobs, :ppn, :ppn_project, :format_version, :verbosity,
Severity: Minor
Found in lib/miga/daemon/base.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Cyclomatic complexity for launch_job is too high. [7/6]
Open

  def launch_job(job, hostk = nil)
    # Execute job
    job[:cmd] = job_cmd(job)
    MiGA::MiGA.DEBUG "CMD: #{job[:cmd]}"
    case runopts(:type)
Severity: Minor
Found in lib/miga/daemon.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for get_metadata is too high. [7/6]
Open

  def get_metadata(metadata_def = {})
    metadata_def.each { |k, v| @metadata[k] = v }
    return @metadata if @metadata[:bypass_metadata]

    case universe
Severity: Minor
Found in lib/miga/remote_dataset.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for check_datasets is too high. [7/6]
Open

  def check_datasets
    l_say(2, 'Checking datasets')
    o = false
    project.each_dataset do |ds|
      next unless ds.status == :incomplete
Severity: Minor
Found in lib/miga/daemon.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

  def tabulate(header, values, tabular = false)
    fields = []
    fields << header.map(&:to_s) unless tabular && header.all?(&:nil?)
    fields << fields.first.map { |h| h.gsub(/\S/, '-') } unless tabular
    fields += values.map { |r| r.map { |cell| cell.nil? ? '?' : cell.to_s } }
Severity: Minor
Found in lib/miga/common/format.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.

Cyclomatic complexity for save_to is too high. [7/6]
Confirmed

  def save_to(project, name = nil, is_ref = true, metadata_def = {})
    name ||= ids.join('_').miga_name
    project = MiGA::Project.new(project) if project.is_a? String
    MiGA::Dataset.exist?(project, name) and
      raise "Dataset #{name} exists in the project, aborting..."
Severity: Minor
Found in lib/miga/remote_dataset.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

  def parse(&fun)
    if expect_operation
      @operation = @argv.shift unless argv.first =~ /^-/
    end
    OptionParser.new do |opt|
Severity: Minor
Found in lib/miga/cli.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 add_result_distances(base, _opts)
    return nil unless result_files_exist?(base, ['.txt']) &&
      (result_files_exist?(base, ['.rds']) ||
       result_files_exist?(base, ['.rda']))

Severity: Minor
Found in lib/miga/project/result.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.

Perceived complexity for assert_valid_option_value is too high. [8/7]
Open

  def assert_valid_option_value(key, value, from_string = false)
    opt = assert_has_option(key)
    value = option_from_string(key, value) if from_string

    # nil is always valid, and so are supported tokens
Severity: Minor
Found in lib/miga/common/with_option.rb by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Assignment Branch Condition size for run_block is too high. [16.67/15]
Open

  def run_block(&blk)
    busy_attempts ||= 0
    io_attempts ||= 0
    SQLite3::Database.new(path) { |conn| blk[conn] }
  rescue SQLite3::BusyException => e
Severity: Minor
Found in lib/miga/sqlite.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. [11/10]
Open

  def run_cmd_opts(opts = {})
    {
      stdout: nil,
      stderr: nil,
      dry: false,
Severity: Minor
Found in lib/miga/common/system_call.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 http_request(method, url, *opts)
    doc = nil
    remote_connection(url).start do |http|
      res = http.send(method, remote_connection_uri.to_s, *opts)
      if %w[301 302].include?(res.code)
Severity: Minor
Found in lib/miga/common/net.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.

Severity
Category
Status
Source
Language