SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,631 of 12,631 total issues

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

    def self.name_status(taxonworks_object, colrapi_result)
      o = taxonworks_object

      r = {
          taxonworks_name: collection_object_scientific_name(o),
Severity: Minor
Found in lib/vendor/colrapi.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 row_hash_initiate has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def row_hash_initiate
    h = {}
    rows = nil # Of either Otu or ObservationMatrixRow of type Otu !! TODO:
    if observation_matrix_id.to_i == 0 && !otu_filter.blank?

Severity: Minor
Found in lib/tools/image_matrix.rb - About 2 hrs to fix

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

        ObservationMatrixColumnItem.create({
          observation_matrix_column_item: data
        }).then((response) => {
          dispatch(ActionNames.GetMatrixObservationColumns, state.matrix.id)
          dispatch(ActionNames.GetMatrixObservationColumnsDynamic, state.matrix.id)
    app/javascript/vue/tasks/observation_matrices/image/store/actions/createObservation.js on lines 5..10

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

    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

          if (isValidResponseData(responseData)) {
            commit(
              MutationNames.SetObservationId,
              makeObservationIdArgs(responseData.id, responseData.global_id)
            )
    app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/actions/createObservation.js on lines 39..47

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

    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

        CreateColumnItem({ observation_matrix_column_item: data }).then(response => {
          dispatch(ActionNames.GetMatrixObservationColumns, state.matrix.id)
          dispatch(ActionNames.GetMatrixObservationColumnsDynamic, state.matrix.id)
          TW.workbench.alert.create('Column item was successfully created.', 'notice')
          return resolve(response)
    app/javascript/vue/tasks/observation_matrices/new/store/actions/createColumnItem.js on lines 6..16

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

    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

          if (isValidResponseData(responseData)) {
            commit(MutationNames.SetObservationId, makeObservationIdArgs(responseData.id, responseData.global_id))
            commit(MutationNames.SetObservation, {
              ...observation,
              id: responseData.id,
    app/javascript/vue/tasks/observation_matrices/matrix_column_coder/store/actions/createObservation.js on lines 66..77

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

    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 ({ commit }) {
      return new Promise(function (resolve, reject) {
        TaxonNameClassification.types().then((response) => {
          commit(MutationNames.SetStatusList, response.body)
          return resolve()
    app/javascript/vue/tasks/nomenclature/new_taxon_name/store/actions/loadRanks.js on lines 4..11

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

    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 ({ commit }) {
      return new Promise(function (resolve, reject) {
        TaxonName.ranks().then((response) => {
          commit(MutationNames.SetRankList, response.body)
          return resolve()
    app/javascript/vue/tasks/nomenclature/new_taxon_name/store/actions/loadStatus.js on lines 4..11

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

    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

    Function buildFeatureCollectionFromShape has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        buildFeatureCollectionFromShape: function (shape, shape_type) {
    
          //  var featureCollection = [];
          var feature = [];
          var coordinates = [];
    Severity: Minor
    Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - About 1 hr to fix

      Method all has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def all(nil_empty = false)
      
            # TODO: should turn off/on project_id here on nil empty?
      
            a = all_and_clauses
      Severity: Minor
      Found in lib/queries/query/filter.rb - About 1 hr to fix

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

        function deleteResource(url) {
          return new Promise((resolve, reject) => {
            ajaxCall('delete', url).then(
              (response) => {
                resolve(response.body)
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/request/MatrixRowCoderRequest.js on lines 4..15

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

        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

            TW.workbench.keyboard.createShortcut(
              `${actionKey}+right`,
              'Go to next',
              'Taxon names browse',
              () => {
        Severity: Major
        Found in app/assets/javascripts/views/shared/show.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/views/shared/show.js on lines 36..49

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

        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 getJSON(url) {
          return new Promise((resolve, reject) => {
            ajaxCall('get', url).then(
              (response) => {
                resolve(response.body)
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/request/MatrixRowCoderRequest.js on lines 43..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 74.

        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) {
          return descriptorId => {
            const observation = state.observations.find(o => o.descriptorId === descriptorId)
            return observation && observation.hasOwnProperty('continuousUnit') ? observation.continuousUnit : null
          }
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/getters/getContinuousValueFor.js on lines 1..6

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

        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

            TW.workbench.keyboard.createShortcut(
              `${actionKey}+left`,
              'Go to previous',
              'Taxon names browse',
              () => {
        Severity: Major
        Found in app/assets/javascripts/views/shared/show.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/views/shared/show.js on lines 51..64

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

        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) {
          return descriptorId => {
            const observation = state.observations.find(o => o.descriptorId === descriptorId)
            return observation && observation.hasOwnProperty('continuousValue') ? observation.continuousValue : null
          }
        app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/getters/getContinuousUnitFor.js on lines 1..6

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

        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

        Function request has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            request: function(element, options) {
              var $element = $(element);
              var $form = null;
              var opts = {};
        
        
        Severity: Minor
        Found in app/assets/javascripts/vendor/lib/jquery/jquery.ajaxify.js - About 1 hr to fix

          Method related_summary has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def related_summary(ids)
                h = { restrict: {}, destroy: {} }
                objects = self.where(id: ids)
          
                base = self.table_name.to_sym
          Severity: Minor
          Found in app/models/concerns/shared/is_data.rb - About 1 hr 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 destroy_couplet has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def destroy_couplet
              k = children.order(:position).reload.to_a
              return true if k.empty?
          
              # TODO: handle multiple facets
          Severity: Minor
          Found in app/models/lead.rb - About 1 hr 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 set_taxonomy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def set_taxonomy
                c = case self.class.base_class.name
                    when 'CollectionObject'
                      a = target_taxon_name # current_valid_taxon_name # !! See DwcExtensions, probably better placed here
          
          
          Severity: Minor
          Found in app/models/concerns/shared/taxonomy.rb - About 1 hr 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