SpeciesFileGroup/taxonworks

View on GitHub

Showing 12,624 of 12,624 total issues

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

export const PANEL_COMPONENTS = {
  [PANEL_NAME.PanelAuthor]: PanelAuthor,
  [PANEL_NAME.PanelCopyrightHolder]: PanelCopyrightHolder,
  [PANEL_NAME.PanelEditor]: PanelEditor,
  [PANEL_NAME.PanelLicenses]: PanelLicenses,
Severity: Major
Found in app/javascript/vue/tasks/images/new_image/const/layout.js and 4 other locations - About 3 hrs to fix
app/javascript/vue/tasks/dwca_import/store/actions/actions.js on lines 14..25
app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/actions/actions.js on lines 14..25
app/javascript/vue/tasks/observation_matrices/new/store/actions/actions.js on lines 13..24
app/javascript/vue/tasks/observation_matrices/new/store/getters/getters.js on lines 25..36

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

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

const ActionFunctions = {
  [ActionNames.ImportRow]: importRow,
  [ActionNames.LoadDataset]: loadDataset,
  [ActionNames.LoadDatasetRecords]: loadDatasetRecords,
  [ActionNames.LoadNamespace]: loadNamespace,
app/javascript/vue/tasks/images/new_image/const/layout.js on lines 25..36
app/javascript/vue/tasks/observation_matrices/matrix_row_coder/store/actions/actions.js on lines 14..25
app/javascript/vue/tasks/observation_matrices/new/store/actions/actions.js on lines 13..24
app/javascript/vue/tasks/observation_matrices/new/store/getters/getters.js on lines 25..36

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

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

export default function(state, value) {
  let index = state.depictionsCreated.findIndex(item => {
    return item.id == value.id
  })
  if(index > -1) {
app/javascript/vue/tasks/images/new_image/store/mutations/addAttribution.js on lines 1..11
app/javascript/vue/tasks/images/new_image/store/mutations/addCitation.js on lines 1..11
app/javascript/vue/tasks/images/new_image/store/mutations/addTag.js on lines 1..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 97.

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

export default function(state, value) {
  let index = state.citations.findIndex(item => {
    return item.id == value.id
  })
  if(index > -1) {
app/javascript/vue/tasks/images/new_image/store/mutations/addAttribution.js on lines 1..11
app/javascript/vue/tasks/images/new_image/store/mutations/addDepiction.js on lines 1..11
app/javascript/vue/tasks/images/new_image/store/mutations/addTag.js on lines 1..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 97.

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

export default function(state, value) {
  let index = state.tags.findIndex(item => {
    return item.id == value.id
  })
  if(index > -1) {
app/javascript/vue/tasks/images/new_image/store/mutations/addAttribution.js on lines 1..11
app/javascript/vue/tasks/images/new_image/store/mutations/addCitation.js on lines 1..11
app/javascript/vue/tasks/images/new_image/store/mutations/addDepiction.js on lines 1..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 97.

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

export default function(state, value) {
  let index = state.attributionsCreated.findIndex(item => {
    return item.id == value.id
  })
  if(index > -1) {
app/javascript/vue/tasks/images/new_image/store/mutations/addCitation.js on lines 1..11
app/javascript/vue/tasks/images/new_image/store/mutations/addDepiction.js on lines 1..11
app/javascript/vue/tasks/images/new_image/store/mutations/addTag.js on lines 1..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 97.

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

  def self.create_quick_verbatim(options  = {})
    # We could refactor this to use nested attributes, but it's not that much cleaner
    opts = {
      'collection_objects' => {},
      'note' => nil,
Severity: Minor
Found in lib/material.rb - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function initializeGoogleMap has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    initializeGoogleMap: function (map_canvas, fcdata, map_center) {

      // does this need to be set?  would it alter fcdata if not set?
      var mapData = fcdata;
      //
Severity: Major
Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - About 3 hrs to fix

    Function initializeDrawingManager has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        initializeDrawingManager: function (map, mapDrawingModes) {
          var drawingMode = undefined;      // "active: circle, polygon, circle" results in hand, polygon, circle(selected)
          var drawingModes = [];            // "polygon, circle" results in hand(active), polygon, circle in draw mode menu
          var i;                  // loop counter
          var j = 0;              // offset for start of i-loop when ACTIVE:mode has explicit position
    Severity: Major
    Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - About 3 hrs to fix

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

        def type_report
          @klass = params.require(:klass)&.safe_constantize
          @time_span = params.require(:time_span)
          @target = params.require(:target)
          # @projects = params[:project_id].blank? ? Project.all : Project.where(id: params[:project_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.

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

            def autocomplete
              queries = [
                autocomplete_exact_name,
                #autocomplete_exact_alternate_value,
                autocomplete_exact_alternate_value('name', 'AlternateValue::Translation'),
      Severity: Minor
      Found in lib/queries/serial/autocomplete.rb by rubocop

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

              def soft_validations_sf(project_id)
                fixed = 0
                print "\nApply soft validation fixes to taxa 1st pass \n"
                i = 0
                GC.start

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

          def self.compare(object, opts = {} )
            r = {
              object: object,
              comparing_current: false,
              version_a: opts[:version_a].to_i,
      Severity: Minor
      Found in lib/vendor/papertrail.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 task-filter.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var CarrouselTask = function (sec, rows, columns) {
        // sec = Name of data section, this is for identify div.
        // rows = This is for the number of rows that will be displayed, if this number is less than the number of items, it will activate the navigation controls
      
        this.children = []
      Severity: Minor
      Found in app/assets/javascripts/views/hub/task-filter.js - About 3 hrs to fix

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

          Promise.all(promises)
            .then(() => {
              state.settings.applied.source = true
              TW.workbench.alert.create(
                `Citation(s) were successfully saved.`,
        app/javascript/vue/tasks/images/new_image/store/actions/applyAttibutions.js on lines 85..95

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

        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

          Promise.all(promises)
            .then(() => {
              state.settings.applied.attribution = true
              TW.workbench.alert.create(
                `Attribution(s) were successfully saved.`,
        app/javascript/vue/tasks/images/new_image/store/actions/applySource.js on lines 36..46

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

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

        function makeInitialState() {
          return reactive({
            settings: {
              increment: false,
              isLocked: false,
        Severity: Major
        Found in app/javascript/vue/tasks/digitize/store/store.js - About 3 hrs to fix

          Method eml has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def eml
                return @eml if @eml
                @eml = Tempfile.new('eml.xml')
          
                # This may need to be logged somewhere
          Severity: Major
          Found in lib/export/dwca/data.rb - About 3 hrs to fix

            Class LeadsController has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class LeadsController < ApplicationController
              include DataControllerConfiguration::ProjectDataControllerConfiguration
              before_action :set_lead, only: %i[
                edit create_for_edit update destroy show show_all show_all_print all_texts
                destroy_couplet insert_couplet delete_couplet duplicate update_meta otus]
            Severity: Minor
            Found in app/controllers/leads_controller.rb - About 3 hrs to fix

              Class Autocomplete has 26 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Autocomplete < Query::Autocomplete
              
                    # Either match against all Sources (default) or just those with ProjectSource
                    # @return [Boolean]
                    # @param limit_to_project [String] `true` or `false`
              Severity: Minor
              Found in lib/queries/source/autocomplete.rb - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language