SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,625 of 12,625 total issues

Method data_models has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def data_models
    allowed= %w{
      AlternateValue
      BiologicalAssociationsGraph
      BiologicalRelationship

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

              response.body.results.forEach(row => {
                const position = getters[GetterNames.GetRowPositionById](row.id)
                if (position) {
                  const payload = { pageIndex: position.pageIndex, rowIndex: position.rowIndex, row: row }
                  commit(MutationNames.SetRow, payload)
    app/javascript/vue/tasks/dwca_import/store/actions/importRow.js on lines 10..22

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

    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 () => {
      const store = useStore()
      const extract = computed({
        get () {
          return store.getters[GetterNames.GetExtract]
    app/javascript/vue/tasks/extracts/new_extract/composables/useSettings.js on lines 6..18

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

    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

          results.forEach((row) => {
            const position = getters[GetterNames.GetRowPositionById](row.id)
    
            if (position) {
              const payload = {
    app/javascript/vue/tasks/dwca_import/store/actions/processImport.js on lines 19..25

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

    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 () => {
      const store = useStore()
      const settings = computed({
        get () {
          return store.getters[GetterNames.GetSettings]
    app/javascript/vue/tasks/extracts/new_extract/composables/useExtract.js on lines 6..18

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

    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 mx_autocompleter has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      $.fn.mx_autocompleter = function(options) {
        if (!this.length) {   return this; }
        return this.each(function() {
          var $this = $(this);
          var $form = $this.parents("form");
    Severity: Major
    Found in app/assets/javascripts/vendor/lib/jquery/jquery.mx-autocompleter.js - About 2 hrs to fix

      Function ajaxify has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        $.fn.ajaxify = function(options) {
          var handlers = {
            onchange: function($e, options) {
              $e.bind('change', function(evt) {
                spinner($e, 'show');
      Severity: Major
      Found in app/assets/javascripts/vendor/lib/jquery/jquery.ajaxify.js - About 2 hrs to fix

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

        export default function ({ commit, state }, args) {
          const {
            descriptorId,
            characterStateId = null,
            obsId = null

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

        export function useShortcuts({ metadata, currentAnnotator }) {
          const shortcutList = computed(() => {
            const sliceTitles = Object.keys(metadata.value?.endpoints || {})
            const shortcuts = Object.fromEntries(
              sliceTitles.map((title) => {
        Severity: Minor
        Found in app/javascript/vue/components/radials/composables/useShortcuts.js - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

        export default function ({ commit, state }, args) {
          const {
            rowObjectId,
            rowObjectType,
            characterStateId = null,

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

          def is_destroyable?(user)
            u = user
            u = User.find(user) if !user.kind_of?(User)
            return true if u.is_administrator?
        
        
        Severity: Minor
        Found in app/models/concerns/shared/is_data.rb - About 2 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 sv_fix_add_nominotypical_sub has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def sv_fix_add_nominotypical_sub
              return false if list_of_coordinated_names.collect{|r| r.id}.include?(parent_id)
              rank  = rank_string
              p     = self.parent
              prank = p.rank_string
        Severity: Minor
        Found in app/models/protonym/soft_validation_extensions.rb - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method build_descriptors has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_descriptors
              @total_data_lines = 0
              i = 0
        
              # loop through rows

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

            def self.degrees_minutes_seconds_to_decimal_degrees(dms_in) # rubocop:disable Metrics/PerceivedComplexity !! But this is too complex :)
              match_string = nil
              # no_point     = false
              degrees      = 0.0
              minutes      = 0.0
        Severity: Minor
        Found in lib/utilities/geo.rb - About 2 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

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

        const ActionFunctions = {
          [ActionNames.AddMatchPerson]: addMatchPerson,
          [ActionNames.AddSelectPerson]: addSelectPerson,
          [ActionNames.FindMatchPeople]: findMatchPeople,
          [ActionNames.FindPeople]: findPeople,
        app/javascript/vue/tasks/collection_objects/browse/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/collection_objects/simple_new_specimen/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/content/editor/store/getters/getters.js on lines 21..30
        app/javascript/vue/tasks/images/new_image/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/loans/new/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/sources/new_source/store/actions/actions.js on lines 11..20

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

        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 7 locations. Consider refactoring.
        Open

        const ActionFunctions = {
          [ActionNames.CloneFrom]: cloneFrom,
          [ActionNames.CreateLoan]: createLoan,
          [ActionNames.CreateBatchLoad]: createBatchLoad,
          [ActionNames.DeleteLoanItem]: deleteLoanItem,
        Severity: Major
        Found in app/javascript/vue/tasks/loans/new/store/actions/actions.js and 6 other locations - About 2 hrs to fix
        app/javascript/vue/tasks/collection_objects/browse/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/collection_objects/simple_new_specimen/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/content/editor/store/getters/getters.js on lines 21..30
        app/javascript/vue/tasks/images/new_image/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/sources/new_source/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/uniquify/people/store/actions/actions.js on lines 12..21

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 80.

        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 7 locations. Consider refactoring.
        Open

        const ActionFunctions = {
          [ActionNames.LoadBiocurations]: loadBiocurations,
          [ActionNames.LoadCollectionObject]: loadCollectionObject,
          [ActionNames.LoadDwc]: loadDwc,
          [ActionNames.LoadIdentifiersFor]: loadIdentifiersFor,
        app/javascript/vue/tasks/collection_objects/simple_new_specimen/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/content/editor/store/getters/getters.js on lines 21..30
        app/javascript/vue/tasks/images/new_image/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/loans/new/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/sources/new_source/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/uniquify/people/store/actions/actions.js on lines 12..21

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 80.

        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 7 locations. Consider refactoring.
        Open

        const ActionFunctions = {
          [ActionNames.ApplyAttributions]: applyAttibutions,
          [ActionNames.ApplyDepictions]: applyDepictions,
          [ActionNames.ApplyPixelToCentimeter]: applyPixelToCentimeter,
          [ActionNames.ApplySource]: applySource,
        app/javascript/vue/tasks/collection_objects/browse/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/collection_objects/simple_new_specimen/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/content/editor/store/getters/getters.js on lines 21..30
        app/javascript/vue/tasks/loans/new/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/sources/new_source/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/uniquify/people/store/actions/actions.js on lines 12..21

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 80.

        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 7 locations. Consider refactoring.
        Open

        const GetterFunctions = {
          [GetterNames.GetCitationsList]: getCitationsList,
          [GetterNames.GetCitationsBySource]: getCitationsBySource,
          [GetterNames.GetContentSelected]: getContentSelected,
          [GetterNames.GetDepictionsList]: getDepictionsList,
        app/javascript/vue/tasks/collection_objects/browse/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/collection_objects/simple_new_specimen/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/images/new_image/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/loans/new/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/sources/new_source/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/uniquify/people/store/actions/actions.js on lines 12..21

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 80.

        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 7 locations. Consider refactoring.
        Open

        const ActionFunctions = {
          [ActionNames.CreateCollectionObject]: createCollectionObject,
          [ActionNames.CreateCollectingEvent]: createCollectingEvent,
          [ActionNames.CreateIdentifier]: createIdentifier,
          [ActionNames.CreateNewSpecimen]: createNewSpecimen,
        app/javascript/vue/tasks/collection_objects/browse/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/content/editor/store/getters/getters.js on lines 21..30
        app/javascript/vue/tasks/images/new_image/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/loans/new/store/actions/actions.js on lines 12..21
        app/javascript/vue/tasks/sources/new_source/store/actions/actions.js on lines 11..20
        app/javascript/vue/tasks/uniquify/people/store/actions/actions.js on lines 12..21

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 80.

        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

        Severity
        Category
        Status
        Source
        Language