michielbdejong/solid-panes

View on GitHub
src/transaction/pane.js

Summary

Maintainability
F
1 wk
Test Coverage

Function render has 467 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render: function (subject, context) {
    const dom = context.dom
    var kb = context.session.store
    var fetcher = kb.fetcher
    var Q = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
Severity: Major
Found in src/transaction/pane.js - About 2 days to fix

    Function render has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
    Open

      render: function (subject, context) {
        const dom = context.dom
        var kb = context.session.store
        var fetcher = kb.fetcher
        var Q = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
    Severity: Minor
    Found in src/transaction/pane.js - About 1 day 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

    File pane.js has 485 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*   Financial Transaction Pane
     **
     **  This outline pane allows a user to interact with a transaction
     **  downloaded from a bank statement, annotting it with classes and comments,
     ** trips, etc
    Severity: Minor
    Found in src/transaction/pane.js - About 7 hrs to fix

      Function calculations has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            var calculations = function () {
              var total = {}
              var yearTotal = {}
              var yearCategoryTotal = {}
              var trans = kb.each(undefined, TRIP('trip'), subject)
      Severity: Major
      Found in src/transaction/pane.js - About 4 hrs to fix

        Function transactionTable has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var transactionTable = function (dom, list, filter) {
              var table = dom.createElement('table')
              table.setAttribute(
                'style',
                'padding-left: 0.5em; padding-right: 0.5em; font-size: 9pt; width: 85%;'
        Severity: Minor
        Found in src/transaction/pane.js - About 2 hrs to fix

          Function transactionRow has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                var transactionRow = function (dom, x) {
                  var tr = dom.createElement('tr')
          
                  var setTRStyle = function (tr, account) {
                    // var mystyle = "padding: 0.5em 1.5em 1em 1.5em; "
          Severity: Minor
          Found in src/transaction/pane.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                            for (i = 0; i < ny; i++) {
                              z = yearCategoryTotal[years[i]][types[j]]
                              cell = row.appendChild(numericCell(z, true))
                            }
            Severity: Major
            Found in src/transaction/pane.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              for (i = 0; i < ny; i++) {
                                z = yearTotal[years[i]]
                                cell = row.appendChild(numericCell(z ? d2(z) : ''))
                              }
              Severity: Major
              Found in src/transaction/pane.js - About 45 mins to fix

                Function expandAfterRowOrCollapse has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      dom,
                      row,
                      subject,
                      paneName,
                      solo
                Severity: Minor
                Found in src/transaction/pane.js - About 35 mins to fix

                  Function expandAfterRow has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      var expandAfterRow = function (dom, row, subject, paneName, solo) {
                  Severity: Minor
                  Found in src/transaction/pane.js - About 35 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return 0
                    Severity: Major
                    Found in src/transaction/pane.js - About 30 mins to fix

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

                            var transactionRow = function (dom, x) {
                              var tr = dom.createElement('tr')
                      
                              var setTRStyle = function (tr, account) {
                                // var mystyle = "padding: 0.5em 1.5em 1em 1.5em; "
                      Severity: Major
                      Found in src/transaction/pane.js and 1 other location - About 2 days to fix
                      src/transaction/period.js on lines 183..228

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

                      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

                          var expandAfterRow = function (dom, row, subject, paneName, solo) {
                            var siblings = row.parentNode.children
                            if (solo) {
                              for (var j = siblings.length - 1; j >= 0; j--) {
                                if (siblings[j].expanded) {
                      Severity: Major
                      Found in src/transaction/pane.js and 1 other location - About 1 day to fix
                      src/transaction/period.js on lines 135..160

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

                      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

                          var oderByDate = function (x, y) {
                            const dx = kb.any(x, ns.qu('date'))
                            const dy = kb.any(y, ns.qu('date'))
                            if (dx !== undefined && dy !== undefined) {
                              if (dx.value < dy.value) return -1
                      Severity: Major
                      Found in src/transaction/pane.js and 1 other location - About 6 hrs to fix
                      src/transaction/period.js on lines 97..107

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

                      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

                          var mention = function mention (message, style) {
                            if (style === undefined) style = 'color: grey'
                            var pre = dom.createElement('pre')
                            pre.setAttribute('style', style)
                            div.appendChild(pre)
                      Severity: Major
                      Found in src/transaction/pane.js and 1 other location - About 2 hrs to fix
                      src/trip/tripPane.js on lines 49..55

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

                      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

                          var expandAfterRowOrCollapse = function (
                            dom,
                            row,
                            subject,
                            paneName,
                      Severity: Major
                      Found in src/transaction/pane.js and 1 other location - About 1 hr to fix
                      src/transaction/period.js on lines 162..175

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

                      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

                          var insertedPane = function (context, subject, paneName) {
                            var p = context.session.paneRegistry.byName(paneName)
                            var d = p.render(subject, context)
                            d.setAttribute('style', 'border: 0.1em solid green;')
                            return d
                      Severity: Major
                      Found in src/transaction/pane.js and 1 other location - About 1 hr to fix
                      src/transaction/period.js on lines 128..133

                      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

                            if (s.indexOf('.') >= 0) {
                              return s.split('.')[0] + '.' + (s.split('.')[1] + '00').slice(0, 2)
                            }
                      Severity: Major
                      Found in src/transaction/pane.js and 1 other location - About 1 hr to fix
                      src/transaction/period.js on lines 87..89

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

                      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

                            for (var i = 0; i < list2.length; i++) {
                              table.appendChild(transactionRow(dom, list2[i]))
                            }
                      Severity: Minor
                      Found in src/transaction/pane.js and 1 other location - About 35 mins to fix
                      src/transaction/period.js on lines 233..235

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

                      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

                      There are no issues that match your filters.

                      Category
                      Status