SpeciesFileGroup/taxonworks

View on GitHub

Showing 739 of 12,579 total issues

Avoid too many return statements within this method.
Open

        return date
Severity: Major
Found in lib/utilities/dates.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return {} if coordinates[:lat_sec].to_f >= 60
    Severity: Major
    Found in lib/utilities/geo.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return c
      Severity: Major
      Found in lib/utilities/geo.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return {}
        Severity: Major
        Found in lib/utilities/dates.rb - About 30 mins to fix

          Function default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function (observationData) {
            if (observationData.type === ObservationTypes.Qualitative) {
              return makeQualitativeObservation(observationData)
            } else if (observationData.type === ObservationTypes.Continuous) {
              return makeContinuousObservation(observationData)

          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 perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def perform(import_dataset, uuid, max_time, max_records)
              begin
                Current.user_id = import_dataset.created_by_id
                Current.project_id = import_dataset.project_id
          
          
          Severity: Minor
          Found in app/jobs/import_dataset_import_job.rb - About 25 mins 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 checkChildFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          CarrouselTask.prototype.checkChildFilter = function (childTag) {
            let find = 0
            let isTrue = 0
          
            for (let key in this.filters) {
          Severity: Minor
          Found in app/assets/javascripts/views/hub/task-filter.js - About 25 mins 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 closeSlideoutPanel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            closeSlideoutPanel: function (panel) {
              if ($(panel).hasClass('slide-left')) {
                $(panel).css('right', '')
                if ($(panel).css('left') == '0px') {
                  $(panel).attr('data-panel-open', 'false')
          Severity: Minor
          Found in app/assets/javascripts/views/shared/slideout.js - About 25 mins 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 start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            start () {
              this.update()
          
              this.intervalId = setInterval(() => {
                if (!this.isPaused) {
          Severity: Minor
          Found in app/javascript/vue/tasks/dwc/dashboard/components/Countdown/countdown.js - About 25 mins 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 togglePanel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            togglePanel (e) {
              const element = e.target
          
              if (element.classList.contains('slide-panel-circle-icon')) {
                const panelElement = element.closest('.slide-panel')
          Severity: Minor
          Found in app/assets/javascripts/views/shared/slideout.js - About 25 mins 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 addToArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function addToArray(arr, obj, opts = {}) {
            const { property = 'id', prepend = false, primitive = false } = opts
          
            const index = primitive
              ? arr.findIndex((item) => obj === item)
          Severity: Minor
          Found in app/javascript/vue/helpers/arrays.js - About 25 mins 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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function (observationData) {
            if (observationData.type === ObservationTypes.Qualitative) { 
              return makeQualitativeObservation(observationData)
            } else if (observationData.type === ObservationTypes.Continuous) { 
              return makeContinuousObservation(observationData)

          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 useAnnotationHandlers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export function useAnnotationHandlers(annotationLists) {
          
            function handleRadialCreate({ item }) {
              if (annotationLists[item.base_class]) {
                addToArray(annotationLists[item.base_class].value, item)

          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 annotators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def annotators
              known = ApplicationRecord.subclasses.select {|a| a.column_names.include?('project_id')}.map(&:name)
          
              known.each do |k|
                next if k.safe_constantize.table_name == 'test_classes' # TODO: a kludge to ignore stubbed classes in testing
          Severity: Minor
          Found in app/models/project.rb - About 25 mins 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 member_syncronize_matrices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def member_syncronize_matrices
                  # TODO: refine to eliminate other possibilities
                  # Don't bother with the overhead if there are no matrices
                  if ObservationMatrix.where(project_id: project_id).any?
          
          
          Severity: Minor
          Found in app/models/concerns/shared/matrix_hooks/member.rb - About 25 mins 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 sv_validate_coordinated_names_part_of_speech has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def sv_validate_coordinated_names_part_of_speech
                return true unless is_available?
                return true unless is_species_rank?
                list_of_coordinated_names.each do |t|
                  if self.part_of_speech_class != t.part_of_speech_class
          Severity: Minor
          Found in app/models/protonym/soft_validation_extensions.rb - About 25 mins 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 sv_validate_parent_rank has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def sv_validate_parent_rank
                if self.rank_class && self.id == self.cached_valid_taxon_name_id
                  if rank_string == 'NomenclaturalRank' || self.parent&.rank_string == 'NomenclaturalRank' || !!self.iczn_uncertain_placement_relationship
                    true
                  elsif !self.rank_class&.valid_parents.include?(self.parent&.rank_string)
          Severity: Minor
          Found in app/models/protonym/soft_validation_extensions.rb - About 25 mins 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 sv_validate_coordinated_names_type_species has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def sv_validate_coordinated_names_type_species
                return true unless is_valid?
                return true unless is_genus_rank?
                list_of_coordinated_names.each do |t|
                  if self.type_species != t.type_species
          Severity: Minor
          Found in app/models/protonym/soft_validation_extensions.rb - About 25 mins 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 sv_validate_coordinated_names_gender has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def sv_validate_coordinated_names_gender
                return true unless is_available?
                return true unless is_genus_rank?
                s = self.gender_class
                list_of_coordinated_names.each do |t|
          Severity: Minor
          Found in app/models/protonym/soft_validation_extensions.rb - About 25 mins 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 validate_number has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def validate_number
              t = self.collection_type.to_s
              if self.number_of_collection_objects.nil? && self.number_of_containers.nil?
                errors.add(:number_of_collection_objects, 'At least one number of specimens or number of containers should be specified')
                errors.add(:number_of_containers, 'At least one number of specimens or number of containers should be specified')
          Severity: Minor
          Found in app/models/collection_profile.rb - About 25 mins 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

          Severity
          Category
          Status
          Source
          Language