bio-miga/miga

View on GitHub

Showing 839 of 1,651 total issues

Perceived complexity for parse is too high. [10/7]
Open

    def parse(path, opts = {})
      opts = default_opts(opts)

      # Read JSON
      cont = path
Severity: Minor
Found in lib/miga/json.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 initialize is too high. [18.17/15]
Open

  def initialize(path, update = false)
    @datasets = {}
    @do_not_save = false
    @path = File.absolute_path(path)
    self.create if !update && !Project.exist?(self.path)
Severity: Minor
Found in lib/miga/project.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. [13/10]
Open

  def add_result_subclades(base, _opts)
    if result_files_exist?(base, %w[.empty])
      r = MiGA::Result.new("#{base}.json")
      r.add_file(:empty, 'miga-project.empty')
      return r
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.

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

  def <<(value)
    case value
    when Hash
      value.each do |r, n|
        next if n.nil? || n == ''
Severity: Minor
Found in lib/miga/taxonomy.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 add_dataset(name)
    unless metadata[:datasets].include? name
      d = MiGA::Dataset.new(self, name)
      @metadata[:datasets] << name
      @dataset_names_hash[name] = true if @dataset_names_hash
Severity: Minor
Found in lib/miga/project/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.

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

  def add_result_ogs(base, _opts)
    if result_files_exist?(base, %w[.empty])
      r = MiGA::Result.new("#{base}.json")
      r.add_file(:empty, 'miga-project.empty')
      return r
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.

Method has too many lines. [13/10]
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 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 add_metadata is too high. [10/7]
Open

  def add_metadata(obj, cli = self)
    raise "Unsupported object: #{obj.class}" unless obj.respond_to? :metadata

    (cli[:metadata] || '').split(',').each do |pair|
      (k, v) = pair.split('=')
Severity: Minor
Found in lib/miga/cli/objects_helper.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

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

  def parse_cli
    default_opts_for_wf
    cli.defaults = { mytaxa: false }
    cli.parse do |opt|
      opt.on(
Severity: Minor
Found in lib/miga/cli/action/index_wf.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 parse_cli
    cli.defaults = { details: false, json: true }
    cli.parse do |opt|
      cli.opt_object(opt, [:project, :dataset_opt])
      opt.on(
Severity: Minor
Found in lib/miga/cli/action/files.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 read_ncbi_list_json(file)
    cli.say "Reusing remote list: #{file}"
    list = {}
    n_tot = nil
    File.open(file, 'r') do |fh|

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 clean_fasta_file is too high. [10/7]
Open

  def clean_fasta_file(file, min_len = 1)
    tmp_fh = nil
    tmp_path = nil
    begin
      if file =~ /\.gz/
Severity: Minor
Found in lib/miga/common/format.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 check_bidir is too high. [18.79/15]
Open

  def check_bidir(cli)
    cli.say 'Checking if reference distances are bidirectional'
    project = cli.load_project
    ref_ds = project.each_dataset.select(&:ref?)

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 check_status is too high. [18.79/15]
Open

  def check_status(cli)
    cli.say 'Updating metadata status'
    p = cli.load_project
    n = p.dataset_names.size
    (0 .. cli[:threads] - 1).map do |i|

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. [13/10]
Open

  def check_mdfiles(cli)
    cli.say 'Looking for unregistered files in the metadata folder'
    md = File.join(cli.load_project.path, 'metadata')
    Dir.each_child(md) do |file|
      expected_ds = File.basename(file, '.json')

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 opt_object_type is too high. [18.68/15]
Open

  def opt_object_type(opt, obj, multi)
    conf =
      case obj
      when :dataset
        ['type', 'datasets', :dataset_type, MiGA::Dataset]
Severity: Minor
Found in lib/miga/cli/action/wf.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 parse_cli is too high. [18.03/15]
Open

  def parse_cli
    cli.defaults = { try_load: false, thr: 1, env: false, check_first: false }
    cli.parse do |opt|
      cli.opt_object(opt, [:project, :dataset_opt, :result_opt])
      opt.on(
Severity: Minor
Found in lib/miga/cli/action/run.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

Cyclomatic complexity for perform is too high. [9/6]
Open

  def perform
    unless cli[:value].nil?
      cli.ensure_par(
        { key: '-k' },
        '%<name>s is mandatory when --value is set: provide %<flag>s'
Severity: Minor
Found in lib/miga/cli/action/option.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 perform is too high. [9/6]
Open

  def perform
    ds = cli.load_and_filter_datasets(cli[:silent])
    p  = cli.load_project
    exit(ds.empty? ? 1 : 0) if cli[:silent]

Severity: Minor
Found in lib/miga/cli/action/ls.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. [13/10]
Open

  def perform
    # Input data
    cli.ensure_par(input_type: '-i')
    norun = %w[
      project_stats haai_distances aai_distances ani_distances clade_finding
Severity: Minor
Found in lib/miga/cli/action/preproc_wf.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