SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,624 of 12,624 total issues

Method generate has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.generate(otu, project_members, reference_csv = nil)
     name_total = 0
    ::CSV.generate(col_sep: "\t") do |csv|
      csv << %w{
        ID
Severity: Major
Found in lib/export/coldp/files/name.rb - About 3 hrs to fix

    Method generate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.generate(otus, project_members, reference_csv = nil)
        ::CSV.generate(col_sep: "\t") do |csv|
    
          csv << %w{taxonID nameID status remarks referenceID modified modifiedBy}
    
    
    Severity: Minor
    Found in lib/export/coldp/files/synonym.rb - About 3 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

    Class SourcesController has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class SourcesController < ApplicationController
      include DataControllerConfiguration::SharedDataControllerConfiguration
    
      before_action :set_source, only: [:show, :edit, :update, :destroy, :clone, :api_show]
      after_action -> { set_pagination_headers(:sources) }, only: [:index, :api_index ], if: :json_request?
    Severity: Minor
    Found in app/controllers/sources_controller.rb - About 3 hrs to fix

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

      function init(element) {
        const id = `radial-quick-forms-${Math.random().toString(36).substr(2, 5)}`
        const globalId = element.getAttribute('data-global-id')
        const props = {
          id,
      Severity: Major
      Found in app/javascript/vue/initializers/RadialQuickForms/main.js and 1 other location - About 3 hrs to fix
      app/javascript/vue/initializers/RadialNavigation/main.js on lines 4..14

      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 105.

      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

      function init(element) {
        const id = `radial-navigation-${Math.random().toString(36).substr(2, 5)}`
        const globalId = element.getAttribute('data-global-id')
        const props = {
          id,
      Severity: Major
      Found in app/javascript/vue/initializers/RadialNavigation/main.js and 1 other location - About 3 hrs to fix
      app/javascript/vue/initializers/RadialQuickForms/main.js on lines 4..14

      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 105.

      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

      File taxon_names_controller.rb has 310 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class TaxonNamesController < ApplicationController
        include DataControllerConfiguration::ProjectDataControllerConfiguration
      
        before_action :set_taxon_name, only: [:show, :edit, :update, :destroy, :browse, :original_combination, :catalog, :api_show, :api_summary, :api_catalog]
        after_action -> { set_pagination_headers(:taxon_names) }, only: [:index, :api_index, :origin_citation], if: :json_request?
      Severity: Minor
      Found in app/controllers/taxon_names_controller.rb - About 3 hrs to fix

        Method build_collecting_events has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_collecting_events
              # DRMFieldNumbers DRMFN
              namespace_drm_field_numbers = Namespace.find_by(name: 'DRMFieldNumbers')
        
              @total_data_lines = 0
        Severity: Minor
        Found in lib/batch_load/import/collecting_events/castor_interpreter.rb - About 3 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 included_annotator_facets has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.included_annotator_facets
              f = [
                ::Queries::Concerns::Users
              ]
        
        
        Severity: Minor
        Found in lib/queries/query/filter.rb - About 3 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 has too many lines. [40/25]
        Open

          def to_hash(geometry_collection)
            data = {
              points:   [],
              lines:    [],
              polygons: []

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

            def permitted_params(hsh)
              h = self.class::PARAMS.deep_dup
              h.unshift(:per)
              h.unshift(:page)
              h.unshift(:paginate)
        Severity: Minor
        Found in lib/queries/query/filter.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.

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

            date[:end_date_month] = date[:end_date_month].gsub('january', '1')
                .gsub('february', '2')
                .gsub('march', '3')
                .gsub('april', '4')
                .gsub('may', '5')
        Severity: Major
        Found in lib/utilities/dates.rb and 1 other location - About 3 hrs to fix
        lib/utilities/dates.rb on lines 882..917

        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 118.

        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

            date[:start_date_month] = date[:start_date_month].gsub('january', '1')
                .gsub('february', '2')
                .gsub('march', '3')
                .gsub('april', '4')
                .gsub('may', '5')
        Severity: Major
        Found in lib/utilities/dates.rb and 1 other location - About 3 hrs to fix
        lib/utilities/dates.rb on lines 919..954

        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 118.

        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 {
            descriptorId,
            description
          } = args
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/mutations/setPresence.js on lines 4..12

        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 102.

        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 {
            descriptorId,
            isChecked
          } = args
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/mutations/setFreeTextValue.js on lines 4..12

        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 102.

        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

        Consider simplifying this complex logical expression.
        Open

                if (name =~ /^[a-zA-Z]*$/) || # !! should reference NOT_LATIN
                    (nomenclatural_code == :iczn && name =~ /^[a-zA-Z]-[a-zA-Z]*$/) ||
                    (nomenclatural_code == :icnp && name =~ /^[a-zA-Z]-[a-zA-Z]*$/) ||
                    (nomenclatural_code == :icn && name =~  /^[a-zA-Z]*-[a-zA-Z]*$/) ||
                    (nomenclatural_code == :icn && name =~  /^[a-zA-Z]*\s×\s[a-zA-Z]*$/) ||
        Severity: Critical
        Found in app/models/protonym/soft_validation_extensions.rb - About 3 hrs to fix

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

                      google.maps.event.addListener(map_item[0], 'center_changed', function (event) {
                        var feature = TW.vendor.lib.google.maps.draw.buildFeatureCollectionFromShape(map_item[0], map_item[1]);
                        $(feature_control).val(JSON.stringify(feature[0]));
                      });
          Severity: Major
          Found in app/assets/javascripts/vendor/lib/google/maps/draw.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/vendor/lib/google/maps/draw.js on lines 151..154

          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 101.

          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

                      google.maps.event.addListener(map_item[0], 'radius_changed', function (event) {
                        var feature = TW.vendor.lib.google.maps.draw.buildFeatureCollectionFromShape(map_item[0], map_item[1]);
                        $(feature_control).val(JSON.stringify(feature[0]));
                      });
          Severity: Major
          Found in app/assets/javascripts/vendor/lib/google/maps/draw.js and 1 other location - About 3 hrs to fix
          app/assets/javascripts/vendor/lib/google/maps/draw.js on lines 155..158

          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 101.

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

            def create_objects
              return true unless !collection_object_params.nil?
              begin
                metadata.each do |i|
                  next unless i['metadata'].blank?
          Severity: Minor
          Found in app/models/sled_image.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. [39/25]
          Open

            def self.used_recently(user_id, project_id, used_on = nil)
              return Sequence.none if used_on.nil?
              t = case used_on
                  when 'GeneAttribute'
                    GeneAttribute.arel_table
          Severity: Minor
          Found in app/models/sequence.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. [39/25]
          Open

                def autocomplete
          
                  # [ query, order by use if true- don't if nil ]
                  queries = [
                    [ autocomplete_exact_id, false],
          Severity: Minor
          Found in lib/queries/source/autocomplete.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