sanger/limber

View on GitHub

Showing 187 of 187 total issues

Function addComment has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async addComment(newTitle, newDescription) {
      let payload = {
        data: {
          type: 'comments',
          attributes: {
Severity: Minor
Found in app/frontend/javascript/asset-comments/comment-store.js - About 1 hr to fix

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

        waitLabware: function () {
          this.clearLabware()
          this.labwareContainer().removeClass('good-labware bad-labware scan-labware')
          this.labwareContainer().addClass('wait-labware')
          $('#summary_tab').addClass('ui-disabled')
    Severity: Major
    Found in app/frontend/entrypoints/pages/pooled_tubes.js and 1 other location - About 1 hr to fix
    app/frontend/entrypoints/pages/pooled_tubes.js on lines 121..126

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

    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

        badLabware: function () {
          this.clearLabware()
          this.labwareContainer().removeClass('good-labware wait-labware scan-labware')
          this.labwareContainer().addClass('bad-labware')
          $('#summary_tab').addClass('ui-disabled')
    Severity: Major
    Found in app/frontend/entrypoints/pages/pooled_tubes.js and 1 other location - About 1 hr to fix
    app/frontend/entrypoints/pages/pooled_tubes.js on lines 109..114

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

    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

      control.find('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
        let viewName = e.target.dataset.plateView
        if (viewModel[viewName]) {
          viewModel[viewName].activate()
        }
    Severity: Major
    Found in app/frontend/javascript/legacy_scripts_a.js and 1 other location - About 1 hr to fix
    app/frontend/javascript/legacy_scripts_a.js on lines 47..52

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

    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

      control.find('a[data-toggle="tab"]').on('hide.bs.tab', function (e) {
        let viewName = e.target.dataset.plateView
        if (viewModel[viewName]) {
          viewModel[viewName].deactivate()
        }
    Severity: Major
    Found in app/frontend/javascript/legacy_scripts_a.js and 1 other location - About 1 hr to fix
    app/frontend/javascript/legacy_scripts_a.js on lines 40..45

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

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

    let limberPlateView = function (defaultTab) {
      let plateElement = $(this)
    
      let control = $('#plate-view-control')
    
    
    Severity: Minor
    Found in app/frontend/javascript/legacy_scripts_a.js - About 1 hr to fix

      Method can_be_enabled? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def can_be_enabled?(states, default: true)
              return default unless respond_to?(:state) # No state method.
              return default if states.blank? # No states to check.
      
              current_state = state.to_s
      Severity: Minor
      Found in app/models/concerns/presenters/statemachine/feature_in_states.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

      Function newScanned has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      let newScanned = function (bed, labware) {
        let new_li
        // $('#whole\\['+bed+'\\]').detach();
        new_li = $(document.createElement('li'))
          .attr('data-bed', bed)
      Severity: Minor
      Found in app/frontend/entrypoints/pages/bed_verification.js - About 1 hr to fix

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

          trigger: function () {
            if (!this.o) this.o = $({})
        
            this.o.trigger.apply(this.o, arguments)
          },
        Severity: Major
        Found in app/frontend/javascript/state_machine.js and 1 other location - About 1 hr to fix
        app/frontend/javascript/state_machine.js on lines 8..12

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

        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

          on: function () {
            if (!this.o) this.o = $({})
        
            this.o.on.apply(this.o, arguments)
          },
        Severity: Major
        Found in app/frontend/javascript/state_machine.js and 1 other location - About 1 hr to fix
        app/frontend/javascript/state_machine.js on lines 14..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 60.

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

        const applyMouseEvents = function () {
          const core = graph.getCore()
        
          core.elements().unbind('mouseover')
          core.elements().bind('mouseover', (event) => {
        Severity: Minor
        Found in app/frontend/javascript/pipeline-graph/index.js - About 1 hr to fix

          Function extractChildUsedOligos has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function extractChildUsedOligos(parentUsedOligos, parentWellSubmDetails, tagLayout, tagSubstitutions, tagGroupOligos) {
            if (
              !isValidChildUsedOligoParameters(
                parentUsedOligos,
                parentWellSubmDetails,
          Severity: Minor
          Found in app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js - About 1 hr to fix

            Function generateTooltipContent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const generateTooltipContent = function (ele) {
              // pipeline properties
              const pipelineName = graph.getElementPipeline(ele)
            
              // purpose node properties
            Severity: Minor
            Found in app/frontend/javascript/pipeline-graph/index.js - About 1 hr to fix

              Function renderSourceWells has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              SCAPE.renderSourceWells = function () {
                let capPoolOffset = 0
                for (let plateIndex = 0; plateIndex < SCAPE.plates.length; plateIndex += 1) {
                  if (SCAPE.plates[plateIndex] === undefined) {
                    $('.plate-id-' + plateIndex).hide()
              Severity: Minor
              Found in app/frontend/entrypoints/pages/multi_plate_pooling.js - About 1 hr to fix

                Method sorted_pre_cap_pool_json has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def sorted_pre_cap_pool_json(current_plate) # rubocop:todo Metrics/AbcSize
                    unsorted =
                      current_plate
                        .wells_in_columns
                        .each_with_object({}) do |well, pool_store|
                Severity: Minor
                Found in app/helpers/plate_helper.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

                Function value has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    value: function (value) {
                      // Steps 1-2.
                      if (this == null) {
                        throw new TypeError('this is null or not defined')
                      }
                Severity: Minor
                Found in app/frontend/javascript/lib/array_fill_polyfill.js - 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

                Function newElement has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  newElement: function () {
                    let scanned = this
                    this.listElement = $(document.createElement('li'))
                      .attr('id', 'listElement[' + this.tubeBarcode + ']')
                      .attr('class', 'wait-tube')
                Severity: Minor
                Found in app/frontend/entrypoints/pages/multi_tube_pooling.js - About 1 hr to fix

                  Function extractParentWellSubmissionDetails has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function extractParentWellSubmissionDetails(parentPlate) {
                    if (!parentPlate) {
                      return {}
                    }
                  
                  
                  Severity: Minor
                  Found in app/frontend/javascript/custom-tagged-plate/tagClashFunctions.js - About 1 hr to fix

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

                      {
                        "resource": "asset",
                        "attributes": {
                          "uuid": "",
                          "custom_metadatum_collection": {
                    Severity: Major
                    Found in app/frontend/javascript/shared/resources.js and 1 other location - About 1 hr to fix
                    app/frontend/javascript/shared/resources.js on lines 602..617

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

                    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

                      {
                        "resource": "racked_tube",
                        "attributes": {
                          "coordinate": "",
                          "tube": {
                    Severity: Major
                    Found in app/frontend/javascript/shared/resources.js and 1 other location - About 1 hr to fix
                    app/frontend/javascript/shared/resources.js on lines 70..85

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 56.

                    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