SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,571 of 12,571 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export default function (state, args) {
  const {
    rowObjectId,
    rowObjectType,
    continuousUnit,
app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/mutations/setContinuousValue.js on lines 4..21

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 160.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export default function (state, args) {
  const {
    rowObjectId,
    rowObjectType,
    continuousValue,
app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/mutations/setContinuousUnit.js on lines 4..21

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 160.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    def build_sequences
      @total_data_lines = 0;

      sequences = {}
      sequence_values = {}

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. [64/25]
Open

  def self.generate(otus, project_members, root_otu_id = nil, reference_csv = nil, prefer_unlabelled_otus: true)

    # Until we have RC5 articulations we are simplifying handling the fact
    # that one taxon name can be used for many OTUs. Track to see that
    # an OTU with a given taxon name does not already exist
Severity: Minor
Found in lib/export/coldp/files/taxon.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 get_diffs has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

  def get_diffs version_new, version_old
    added_strings = []
    added_strings_indices = []
    deleted_strings = []
    deleted_strings_indices = []
Severity: Minor
Found in app/helpers/plugins/papertrail_helper.rb - About 6 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

Method build_da_for_otus has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    def build_da_for_otus
      @total_data_lines = 0
      i = 0
      import_klass = type_select.start_with?('im')
      att_klass = (type_select.capitalize + 'Attribute').safe_constantize
Severity: Minor
Found in lib/batch_load/import/otus/data_attributes_interpreter.rb - About 6 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

Function useGraph has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

export function useGraph() {
  const state = reactive(initState())

  const nodes = computed(() =>
    Object.fromEntries(

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const MutationFunctions = {
  [MutationNames.AddCitation]: addCitation,
  [MutationNames.AddToOtuList]: addToOtuList,
  [MutationNames.AddTopicSelected]: addTopicSelected,
  [MutationNames.AddToSourceList]: addToSourceList,
app/javascript/vue/tasks/otu/browse/store/mutations/mutations.js on lines 37..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 152.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const MutationFunctions = {
  [MutationNames.SetBiologicalAssociations]: setBiologicalAssociations,
  [MutationNames.SetCollectingEvents]: setCollectingEvents,
  [MutationNames.SetCollectionObjects]: setCollectionObjects,
  [MutationNames.SetCommonNames]: setCommonNames,
app/javascript/vue/tasks/citations/otus/store/mutations/mutations.js on lines 37..54

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 152.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Class OtusController has 42 methods (exceeds 20 allowed). Consider refactoring.
Open

class OtusController < ApplicationController
  include DataControllerConfiguration::ProjectDataControllerConfiguration

  before_action :set_otu, only: [
    :show, :edit, :update, :destroy, :collection_objects, :navigation,
Severity: Minor
Found in app/controllers/otus_controller.rb - About 5 hrs to fix

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

      def using_isbn_class
        unless identifier.nil?
          isbn = identifier.upcase
          # 'ISBN-13: 978-0-596-52068-7'
          isbn.gsub!('ISBN-10', '')

    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. [59/25]
    Open

      def all_sub_headers(filtered = false)
        unless filtered
          ce_headers # generate the header structure (see CollectionObject.selected_column_names)
          co_headers
          bc_headers

    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.

    File collection_objects_controller.rb has 401 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class CollectionObjectsController < ApplicationController
      include DataControllerConfiguration::ProjectDataControllerConfiguration
    
      before_action :set_collection_object, only: [
        :show, :edit, :update, :destroy, :navigation, :containerize,
    Severity: Minor
    Found in app/controllers/collection_objects_controller.rb - About 5 hrs to fix

      Method get_otu_contents has 138 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_otu_contents(options = {})
          opt = {otus: []}.merge!(options)
          m = opt[:observation_matrix]
      
          otus = Otu.select('otus.*, observation_matrix_rows.id AS row_id').
      Severity: Major
      Found in app/helpers/observation_matrices/export/otu_contents_helper.rb - About 5 hrs to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        function points(size) {
          return [...Array(6)]
            .map((_, i) => {
              const angleDeg = 72 * i - 36
              const angleRad = (Math.PI / 180) * angleDeg
        Severity: Major
        Found in app/javascript/vue/components/ui/VGraph/svg/pentagon.js and 2 other locations - About 5 hrs to fix
        app/javascript/vue/components/ui/VGraph/svg/hexagon.js on lines 16..29
        app/javascript/vue/components/ui/VGraph/svg/octagon.js on lines 16..29

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 143.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        function points(size) {
          return [...Array(9)]
            .map((_, i) => {
              const angleDeg = 45 * i - 22.5
              const angleRad = (Math.PI / 180) * angleDeg
        Severity: Major
        Found in app/javascript/vue/components/ui/VGraph/svg/octagon.js and 2 other locations - About 5 hrs to fix
        app/javascript/vue/components/ui/VGraph/svg/hexagon.js on lines 16..29
        app/javascript/vue/components/ui/VGraph/svg/pentagon.js on lines 19..32

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 143.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        function points(size) {
          return [...Array(7)]
            .map((_, i) => {
              const angleDeg = 60 * i - 30
              const angleRad = (Math.PI / 180) * angleDeg
        Severity: Major
        Found in app/javascript/vue/components/ui/VGraph/svg/hexagon.js and 2 other locations - About 5 hrs to fix
        app/javascript/vue/components/ui/VGraph/svg/octagon.js on lines 16..29
        app/javascript/vue/components/ui/VGraph/svg/pentagon.js on lines 19..32

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 143.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          def data_models
            allowed= %w{
              AlternateValue
              BiologicalAssociationsGraph
              BiologicalRelationship

        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.

        Function init has 133 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          init: function() {
          var
              animationTime = 250;
        
          function showAll() {
        Severity: Major
        Found in app/assets/javascripts/views/shared/lists.js - About 5 hrs to fix

          File useGraph.js has 388 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { reactive, computed, toRefs } from 'vue'
          import {
            BiologicalAssociation,
            BiologicalAssociationGraph,
            Citation
            Severity
            Category
            Status
            Source
            Language