michielbdejong/solid-ui

View on GitHub

Showing 337 of 337 total issues

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

      () => this.addAgent(ns.foaf('Agent').uri)
        .then(() => this.groupList.controller.renderTemporaryStatus('Adding the general public to those who can read. Drag the globe to a different level to give them more access.'))
        .then(() => this.renderCleanup()))
Severity: Major
Found in src/acl/add-agent-buttons.ts and 1 other location - About 1 hr to fix
src/acl/add-agent-buttons.ts on lines 114..116

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

  var columnNumberFor = function (x1) {
    var xNT = x1.toNT() // xNT is a NT string
    var col = null
    // These are data columns (not headings)
    for (var i = 0; i < columns.length; i++) {
Severity: Minor
Found in src/matrix.js - About 1 hr to fix

    Function registrationList has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function registrationList (context: AuthenticationContext, options: {
      private?: boolean
      public?: boolean
    }): Promise<AuthenticationContext> {
      const dom = context.dom as HTMLDocument
    Severity: Minor
    Found in src/authn/authn.ts - About 1 hr to fix

      Function makeSelectForCategory has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      forms.makeSelectForCategory = function (
        dom,
        kb,
        subject,
        category,
      Severity: Minor
      Found in src/widgets/forms.js - About 1 hr to fix

        Function loadMoreWhereNeeded has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async function loadMoreWhereNeeded (event, fixScroll) {
            if (lock) return
            lock = true
            const freeze = !fixScroll
            const magicZone = 150
        Severity: Minor
        Found in src/chat/infinite.js - About 1 hr to fix

          Function makeSelectForNestedCategory has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          forms.makeSelectForNestedCategory = function (
            dom,
            kb,
            subject,
            category,
          Severity: Minor
          Found in src/widgets/forms.js - About 1 hr to fix

            Function selectorPanelRefresh has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            buttons.selectorPanelRefresh = function (
              list,
              dom,
              kb,
              type,
            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

            Function SubjectType has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function SubjectType (type) {
                this.type = type
                this.columns = null
                this.allColumns = null
                this.useCount = 0
            Severity: Minor
            Found in src/table.js - About 1 hr to fix

              Function renderNumberSelector has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function renderNumberSelector (rows, columns, column) {
                  var result = doc.createElement('div')
              
                  var minSelector = doc.createElement('input')
                  minSelector.setAttribute('type', 'text')
              Severity: Minor
              Found in src/table.js - About 1 hr to fix

                Function renderValue has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function renderValue (obj, column) {
                    // hint
                    var hints = getHints(column)
                    var cellFormat = hints.cellFormat
                    if (cellFormat) {
                Severity: Minor
                Found in src/table.js - About 1 hr to fix

                  Function adoptACLDefault has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function adoptACLDefault (
                    doc: $rdf.NamedNode,
                    aclDoc: $rdf.NamedNode,
                    defaultResource: $rdf.NamedNode,
                    defaultACLdoc: $rdf.NamedNode
                  Severity: Minor
                  Found in src/acl/acl.ts - About 1 hr to fix

                    Function removePart has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      var removePart = function (part) {
                        var chunk = part.subject
                        if (!chunk) throw new Error('No chunk for line to be deleted!') // just in case
                        var prev = kb.any(undefined, PAD('next'), chunk)
                        var next = kb.any(chunk, PAD('next'))
                    Severity: Minor
                    Found in src/pad.js - About 1 hr to fix

                      Function loadIndex has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function loadIndex (
                        context: AuthenticationContext,
                        predicate: $rdf.NamedNode,
                        isPublic: boolean
                      ): Promise<AuthenticationContext> {
                      Severity: Minor
                      Found in src/authn/authn.ts - About 1 hr to fix

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

                              if (
                                statement.predicate.termType === 'NamedNode' &&
                                statement.subject.termType === 'Variable'
                              ) {
                                const variable = statement.subject.toString()
                        Severity: Major
                        Found in src/table.js and 1 other location - About 1 hr to fix
                        src/table.js on lines 1670..1679

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

                        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 (
                                statement.predicate.termType === 'NamedNode' &&
                                statement.object.termType === 'Variable'
                              ) {
                                var variable = statement.object.toString()
                        Severity: Major
                        Found in src/table.js and 1 other location - About 1 hr to fix
                        src/table.js on lines 1680..1689

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

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

                        UI.pad.renderPartipants = function (dom, table, padDoc, subject, me, options) {
                          table.setAttribute('style', 'margin: 0.8em;')
                        
                          var newRowForParticpation = function (parp) {
                            var person = kb.any(parp, ns.wf('participant'))
                        Severity: Minor
                        Found in src/pad.js - About 1 hr to fix

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

                          export function getACL (
                            doc: $rdf.NamedNode,
                            callbackFunction: (
                              ok: boolean,
                              messageOrStatus: number | string,
                          Severity: Minor
                          Found in src/acl/acl.ts - About 1 hr to fix

                            Function createIfNotExists has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function createIfNotExists (doc) {
                              return new Promise(function (resolve, reject) {
                                kb.fetcher.load(doc).then(
                                  response => {
                                    console.log('createIfNotExists doc exists, all good ' + doc)
                            Severity: Minor
                            Found in src/chat/bookmarks.js - About 1 hr to fix

                              Function syncMessages has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function syncMessages (about, messageTable) {
                                  var displayed = {}
                                  var ele, ele2
                                  for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
                                    if (ele.AJAR_subject) {
                              Severity: Minor
                              Found in src/chat/infinite.js - About 1 hr to fix

                                Function makeNewSlot has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  var makeNewSlot = function (item) {
                                    var ele = dom.createElement(tabElement)
                                    ele.subject = item
                                    var div = ele.appendChild(dom.createElement('div'))
                                    div.setAttribute('style', unselectedStyle)
                                Severity: Minor
                                Found in src/tabs.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language