michielbdejong/solid-ui

View on GitHub

Showing 337 of 337 total issues

Function findAgent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

function findAgent (uri, kb): PartialAgentTriple | null {
  const obj = sym(uri)
  const types = kb.findTypeURIs(obj)
  for (const ty in types) {
    console.log('    drop object type includes: ' + ty)
Severity: Minor
Found in src/acl/access-groups.ts - 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 comboToString has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export function comboToString (byCombo: ComboList): string {
  let str = ''
  for (const combo in byCombo) {
    const modeURIs = combo.split('\n')
    const initials = modeURIs
Severity: Minor
Found in src/acl/acl.ts - 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 participationObject has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

UI.pad.participationObject = function (subject, padDoc, me) {
  return new Promise(function (resolve, reject) {
    if (!me) {
      throw new Error('Not user id')
    }
Severity: Minor
Found in src/pad.js - About 1 hr to fix

    Function reloadAndSync has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var reloadAndSync = function () {
        if (reloading) {
          console.log('   Already reloading - stop')
          return // once only needed
        }
    Severity: Minor
    Found in src/pad.js - About 1 hr to fix

      Function go has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async function go () {
          function yank () {
            selectedMessageTable.selectedElement.scrollIntoView({ block: 'center' })
          }
      
      
      Severity: Minor
      Found in src/chat/infinite.js - About 1 hr to fix

        Function syncTableToArray has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function syncTableToArray (table, things, createNewRow) {
          let foundOne
          let row
          let i
        
        
        Severity: Minor
        Found in src/utils.js - About 1 hr to fix

          Function askName has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          buttons.askName = function (dom, kb, container, predicate, klass, noun) {
            // eslint-disable-next-line promise/param-names
            return new Promise(function (resolve, _reject) {
              var form = dom.createElement('div') // form is broken as HTML behaviour can resurface on js error
              // classLabel = utils.label(ns.vcard('Individual'))
          Severity: Minor
          Found in src/widgets/buttons.js - About 1 hr to fix

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

              render () {
                const container = document.createElement('div')
                container.style.display = 'flex'
            
                // TODO: take a look at UI.widgets.setName
            Severity: Minor
            Found in src/widgets/peoplePicker.js - About 1 hr to fix

              Function getPreferencesForClass has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getPreferencesForClass (subject, klass, predicates, context) {
                return new Promise(function (resolve, reject) {
                  recordSharedPreferences(subject, context).then(context => {
                    var sharedPreferences = context.sharedPreferences
                    if (context.me) {
              Severity: Minor
              Found in src/preferences.js - About 1 hr to fix

                Function ontologyLabel has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function ontologyLabel (term) {
                  if (term.uri === undefined) return '??'
                  var s = term.uri
                  var namespaces = []
                  var i = s.lastIndexOf('#')
                Severity: Minor
                Found in src/utils.js - About 1 hr to fix

                  Function rowFor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    var rowFor = function (y1) {
                      var y = y1.toNT()
                      if (rows[y]) return rows[y]
                      var tr = dom.createElement('tr')
                      var header = tr.appendChild(dom.createElement('td'))
                  Severity: Minor
                  Found in src/matrix.js - About 1 hr to fix

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

                    export async function findBookmarkDocument (userContext) {
                      const klass = BOOK('Bookmark')
                      const fileTail = 'bookmarks.ttl'
                      const isPublic = true
                    
                    
                    Severity: Minor
                    Found in src/chat/bookmarks.js - About 1 hr to fix

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

                        logger.msg = function (str, type, typestr) {
                          if (!type) {
                            type = TMESG
                            typestr = 'mesg'
                          }
                      Severity: Minor
                      Found in src/log.js - About 1 hr to fix

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

                        UI.pad.recordParticipation = function (subject, padDoc, refreshable) {
                          var me = UI.authn.currentUser()
                          if (!me) return // Not logged in
                        
                          var parps = kb.each(subject, ns.wf('participation')).filter(function (pn) {
                        Severity: Minor
                        Found in src/pad.js - About 1 hr to fix

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

                          export function logInLoadProfile (context: AuthenticationContext): Promise<AuthenticationContext> {
                            if (context.publicProfile) {
                              return Promise.resolve(context)
                            } // already done
                            const fetcher = kb.fetcher
                          Severity: Minor
                          Found in src/authn/authn.ts - About 1 hr to fix

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

                            function shortName (uri) {
                              let p = uri
                              if ('#/'.indexOf(p[p.length - 1]) >= 0) p = p.slice(0, -1)
                              const namespaces = []
                              for (const ns in this.prefixes) {
                            Severity: Minor
                            Found in src/utils.js - About 1 hr to fix

                              Function selectorPanelRefresh has 10 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                list,
                                dom,
                                kb,
                                type,
                                predicate,
                              Severity: Major
                              Found in src/widgets/buttons.js - About 1 hr to fix

                                Function findBookmarkDocument has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export async function findBookmarkDocument (userContext) {
                                  const klass = BOOK('Bookmark')
                                  const fileTail = 'bookmarks.ttl'
                                  const isPublic = true
                                
                                
                                Severity: Minor
                                Found in src/chat/bookmarks.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 getTerm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function getTerm (target) {
                                  var statementTr = target.parentNode
                                  var st = statementTr ? statementTr.AJAR_statement : undefined
                                
                                  var className = st ? target.className : '' // if no st then it's necessary to use getAbout
                                Severity: Minor
                                Found in src/utils.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 findImageFromURI has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                Open

                                buttons.findImageFromURI = function findImageFromURI (x) {
                                  const iconDir = UI.icons.iconBase
                                
                                  // Special cases from URI scheme:
                                  if (x.uri) {
                                Severity: Minor
                                Found in src/widgets/buttons.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

                                Severity
                                Category
                                Status
                                Source
                                Language