bio-miga/miga

View on GitHub

Showing 1,586 of 1,600 total issues

Assignment Branch Condition size for get_files_and_type is too high. [41.05/15]
Open

  def get_files_and_type
    files = cli.files
    file_type = nil
    if files.empty?
      cli.ensure_par({ dataset: '-D' },
Severity: Minor
Found in lib/miga/cli/action/add.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. [36/10]
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 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. [36/10]
Open

  def parse_cli
    default_opts_for_wf
    cli.defaults = {
      download: false, summaries: true, pvalue: 0.1,
      local: File.expand_path('.miga_db', ENV['MIGA_HOME'])
Severity: Minor
Found in lib/miga/cli/action/classify_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.

Assignment Branch Condition size for reference_db is too high. [41.23/15]
Open

  def reference_db
    cli.say "Locating reference database"
    ref_db_path = cli[:db_path]
    if ref_db_path.nil?
      if cli[:download]
Severity: Minor
Found in lib/miga/cli/action/classify_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 opt_object is too high. [41.98/15]
Open

  def opt_object(opt, what = %i[project dataset])
    what.each do |w|
      case w
      when :project
        opt.on(
Severity: Minor
Found in lib/miga/cli/opt_helper.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 seqs_length has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def seqs_length(file, format, opts = {})
    opts[:gc] = true if opts[:skew]
    fh = file =~ /\.gz/ ? Zlib::GzipReader.open(file) : File.open(file, 'r')
    l = []
    gc = 0
Severity: Minor
Found in lib/miga/common/format.rb - About 4 hrs 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

Assignment Branch Condition size for flush! is too high. [40.07/15]
Open

  def flush!
    # Check for finished jobs
    l_say(2, 'Checking for finished jobs')
    @jobs_running.select! do |job|
      ongoing =
Severity: Minor
Found in lib/miga/daemon.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. [35/10]
Open

  def parse_cli
    cli.parse do |opt|
      cli.opt_object(opt, [:project, :project_type_req])
      opt.on(
        '-n', '--name STRING',
Severity: Minor
Found in lib/miga/cli/action/new.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 check_software_requirements is too high. [40.8/15]
Open

  def check_software_requirements(rc_fh)
    cli.puts 'Looking for requirements:'
    opt_groups = {
      mytaxa: 'MyTaxa',
      rdp: 'RDP classifier',
Severity: Minor
Found in lib/miga/cli/action/init.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 perform is too high. [39.5/15]
Open

  def perform
    p = cli.load_project
    if !cli[:taxfile].nil?
      cli.say 'Reading tax-file and registering taxonomy'
      tfh = File.open(cli[:taxfile], 'r')
Severity: Minor
Found in lib/miga/cli/action/tax_set.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 perform is too high. [39.52/15]
Open

  def perform
    p = cli.load_project
    if not cli[:datum].nil?
      v = p.metadata[cli[:datum]]
      cli.puts v.nil? ? '?' : v
Severity: Minor
Found in lib/miga/cli/action/about.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. [39.85/15]
Open

  def parse_cli
    cli.defaults = {
      database: :recommended,
      version: :latest,
      local: File.join(ENV['MIGA_HOME'], '.miga_db'),
Severity: Minor
Found in lib/miga/cli/action/db.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 test_add_result_other is too high. [38.05/15]
Open

  def test_add_result_other
    d2 = project.add_dataset('ds_add_result_other')
    Dir.mkdir(
      File.join(
        project.path, 'data', '07.annotation', '01.function', '01.essential',
Severity: Minor
Found in test/dataset_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

Assignment Branch Condition size for test_import_dataset is too high. [37.12/15]
Open

  def test_import_dataset
    p1 = project
    d = p1.add_dataset('d1')
    File.open(
      File.join(p1.path, 'data', '01.raw_reads', "#{d.name}.1.fastq"), 'w'
Severity: Minor
Found in test/project_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

Assignment Branch Condition size for use_ncbi_taxonomy_dump is too high. [37.71/15]
Open

    def use_ncbi_taxonomy_dump(path, cli = nil)
      raise "Directory doesn't exist: #{path}" unless File.directory?(path)

      # Structure: { TaxID => ["name", "rank", parent TaxID] }
      MiGA::MiGA.DEBUG "Loading NCBI Taxonomy dump: #{path}"
Severity: Minor
Found in lib/miga/remote_dataset.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 save_to is too high. [37.36/15]
Open

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

  def import_dataset(ds, method = :hardlink)
    raise "Impossible to import dataset, it already exists: #{ds.name}." if
      MiGA::Dataset.exist?(self, ds.name)

    # Import dataset results
Severity: Minor
Found in lib/miga/project/dataset.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. [32/10]
Open

  def remote_list
    cli.say 'Downloading genome list'
    current_page = 1
    total_pages  = 1
    ds = {}

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

  def traverse_taxonomy(tab, dist)
    cli.say 'Traversing taxonomy'
    rank_i = 0
    Taxonomy.KNOWN_RANKS.each do |rank|
      next if rank == :ns
Severity: Minor
Found in lib/miga/cli/action/tax_dist.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 register_database is too high. [37.5/15]
Open

  def register_database(manif, db, ver)
    cli.say "Registering database locally"
    reg = (local_manifest || {}).merge(last_update: Time.now.to_s)
    reg[:databases] ||= {}
    reg[:databases][cli[:database]] ||= {}
Severity: Minor
Found in lib/miga/cli/action/db.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

Severity
Category
Status
Source
Language