SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,571 of 12,571 total issues

File csl_styles.rb has 2212 lines of code (exceeds 250 allowed). Consider refactoring.
Open

CSL_STYLES = {
"http://www.zotero.org/styles/vancouver-brackets-only-year-no-issue" => "Vancouver (brackets, only year in date, no issue numbers)",
"http://www.zotero.org/styles/physiologia-plantarum" => "Physiologia Plantarum",
"http://www.zotero.org/styles/orthopedic-clinics-of-north-america" => "Orthopedic Clinics of North America",
"http://www.zotero.org/styles/asa-cssa-sssa" => "American Society of Agronomy, Crop Science Society of America, Soil Science Society of America",
Severity: Major
Found in config/initializers/constants/_controlled_vocabularies/csl_styles.rb - About 6 days to fix

    Method useful_descriptors has a Cognitive Complexity of 197 (exceeds 5 allowed). Consider refactoring.
    Open

      def useful_descriptors
        list_of_remaining_taxa = {}
        language = language_id.blank? ? nil : language_id.to_i
        row_hash.each do |r_key, r_value|
          if r_value[:status] != 'eliminated'
    Severity: Minor
    Found in lib/tools/interactive_key.rb - About 4 days 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

    File soft_validation_extensions.rb has 1461 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Protonym::SoftValidationExtensions
    
      module Klass
        VALIDATIONS = {
          sv_validate_name: {
    Severity: Major
    Found in app/models/protonym/soft_validation_extensions.rb - About 3 days to fix

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

      export const parsedProperties = {
        GeographicArea: ({ ce }) => ce.geographicArea?.name,
      
        Dates: ({ ce }) =>
          [
      app/javascript/vue/tasks/collecting_events/new_collecting_event/helpers/parsedProperties.js on lines 4..74

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

      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

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

      export const parsedProperties = {
        GeographicArea: ({ ce }) => ce.geographicArea?.name,
      
        Dates: ({ ce }) =>
          [
      app/javascript/vue/components/Form/FormCollectingEvent/helpers/parsedProperties.js on lines 4..74

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

      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 dwcTerms.js has 997 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      export default [
        {
          name: 'type',
          qualName: 'http://purl.org/dc/terms/type',
          description: 'The nature or genre of the resource. For Darwin Core, recommended best practice is to use the name of the class that defines the root of the record.',
      Severity: Major
      Found in app/javascript/vue/tasks/dwca_import/const/dwcTerms.js - About 2 days to fix

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

                def invalid_relationship_remove_sf(project_id)
        
                  fixed = 0
                  combinations = 0
                  i = 0

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

          def useful_descriptors
            list_of_remaining_taxa = {}
            language = language_id.blank? ? nil : language_id.to_i
            row_hash.each do |r_key, r_value|
              if r_value[:status] != 'eliminated'
        Severity: Minor
        Found in lib/tools/interactive_key.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.

        File dates.rb has 797 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Utilities::Dates
        
          EARLIEST_DATE = '1700/01/10'.freeze # Reconcile with in-app
        
          LONG_MONTHS = %w{january february march april may june july august september october november december}.freeze
        Severity: Major
        Found in lib/utilities/dates.rb - About 1 day to fix

          Method has too many lines. [138/25]
          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').

          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.

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

          export default function ({ dispatch, state, commit }, descriptorId) {
            const observations = state.observations.filter(
              (o) => o.descriptorId === descriptorId && o.isUnsaved
            )
          
          
          app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/actions/saveObservationsFor.js on lines 5..30

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

          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

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

          export default function ({ dispatch, state, commit }, descriptorId) {
            const observations = state.observations
              .filter(o => o.descriptorId === descriptorId && o.isUnsaved)
          
            return Promise.all(observations.map(o => {
          app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/actions/saveObservation.js on lines 5..48

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

          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 get_otu_contents has a Cognitive Complexity of 85 (exceeds 5 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: Minor
          Found in app/helpers/observation_matrices/export/otu_contents_helper.rb - About 1 day 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 337 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function useGraph() {
            const state = reactive(initState())
          
            const nodes = computed(() =>
              Object.fromEntries(

            Method sv_potential_species_homonyms has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
            Open

                def sv_potential_species_homonyms
                  if persisted? && is_species_rank? && is_available?
                    if TaxonNameRelationship.where_subject_is_taxon_name(self).homonym_or_suppressed.empty?
                      if self.id == self.lowest_rank_coordinated_taxon.id
                        name1 = self.cached_primary_homonym ? self.cached_primary_homonym : nil
            Severity: Minor
            Found in app/models/protonym/soft_validation_extensions.rb - About 1 day 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

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

            const MutationFunctions = {
              [MutationNames.AddObservation]: addObservation,
              [MutationNames.CleanObservation]: cleanObservation,
              [MutationNames.CountdownStartedFor]: countdownStartedFor,
              [MutationNames.SetCharacterStateChecked]: setCharacterStateChecked,
            app/javascript/vue/tasks/images/new_image/store/mutations/mutations.js on lines 69..102

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

            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.AddAttribution]: addAttribution,
              [MutationNames.AddCitation]: addCitation,
              [MutationNames.AddDataAttribute]: addDataAttribute,
              [MutationNames.AddDepiction]: addDepiction,
            app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/mutations/mutations.js on lines 69..103

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

            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

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

            function makePayload(observation) {
              const payload = {
                day_made: observation.day,
                month_made: observation.month,
                year_made: observation.year,
            app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/actions/updateObservation.js on lines 41..72

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

            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

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

            function makePayload (observation) {
              const payload = {
                day_made: observation.day,
                month_made: observation.month,
                year_made: observation.year,
            app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/actions/updateObservation.js on lines 54..85

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

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

                    def read_shape(filename, index)
                      # TODO: For some reason, Gis::FACTORY does not seem to be the default factory, so we are being specific here, to get the lenient polygon tests.  This gets us past the problem polygons, but does not actually deal with the problem.
                      # See http://dazuma.github.io/rgeo-shapefile/rdoc/RGeo/Shapefile/Reader.html for reader options.
            
                      # ne10 = RGeo::Shapefile::Reader.open('G:\Share\Downloads\PostgreSQL\PostGIS\10m_cultural\10m_cultural\ne_10m_admin_0_countries.shp', factory: Gis::FACTORY)

            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