michielbdejong/solid-panes

View on GitHub
src/attach/attachPane.js

Summary

Maintainability
F
5 days
Test Coverage

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

  render: function (subject, context) {
    const dom = context.dom
    var kb = context.session.store
    var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
    var QU = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
Severity: Minor
Found in src/attach/attachPane.js - About 2 days 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 render has 363 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render: function (subject, context) {
    const dom = context.dom
    var kb = context.session.store
    var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
    var QU = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
Severity: Major
Found in src/attach/attachPane.js - About 1 day to fix

    File attachPane.js has 388 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*   Attachment Pane
     **
     ** - Attach a document to a thing
     **  - View attachments
     ** - Look at all unattached Supporting Documents.
    Severity: Minor
    Found in src/attach/attachPane.js - About 5 hrs to fix

      Function headerButtons has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var headerButtons = function (dom, labels, intial, callback) {
            var head = dom.createElement('table')
            var current = intial
            head.setAttribute(
              'style',
      Severity: Minor
      Found in src/attach/attachPane.js - About 1 hr to fix

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

            var setAttachment = function (x, y, value, refresh) {
              if (kb.holds(x, predicate, y) === value) return
              var verb = value ? 'attach' : 'detach'
              // complain("Info: starting to "+verb+" " + y.uri + " to "+x.uri+ ":\n")
              var linkDone3 = function (uri, ok, body) {
        Severity: Minor
        Found in src/attach/attachPane.js - About 1 hr to fix

          Function getMembersAndSort has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var getMembersAndSort = function (subject) {
                var sortBy = getSortKey(subject)
                var u, x, key
                var uriHash = kb.findMemberURIs(subject)
                var pairs = []
          Severity: Minor
          Found in src/attach/attachPane.js - About 1 hr to fix

            Function showFiltered has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var showFiltered = function (mode) {
                  var filtered = mode === 0 ? objects : getFiltered()
                  // eslint-enable
                  UI.widgets.selectorPanelRefresh(
                    objectList,
            Severity: Minor
            Found in src/attach/attachPane.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if (
                    t['http://www.w3.org/ns/pim/trip#Trip'] || // If in any subclass
                    subject.uri === 'http://www.w3.org/ns/pim/trip#Trip' ||
                    t['http://www.w3.org/2005/01/wf/flow#Task'] ||
                    t['http://www.w3.org/2000/10/swap/pim/qif#Transaction'] ||
              Severity: Major
              Found in src/attach/attachPane.js - About 40 mins to fix

                There are no issues that match your filters.

                Category
                Status