michielbdejong/solid-ui

View on GitHub

Showing 337 of 337 total issues

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

  } else if (from.sameTerm(ns.owl('DatatypeProperty'))) {
    possibleProperties = buttons.propertyTriage(kb)
    for (p in possibleProperties.dp) possible.push(kb.fromNT(p))
    opts.disambiguate = true
  }
Severity: Major
Found in src/widgets/forms.js and 1 other location - About 1 hr to fix
src/widgets/forms.js on lines 1034..1042

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

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

  } else if (from.sameTerm(ns.owl('ObjectProperty'))) {
    possibleProperties = buttons.propertyTriage(kb)
    for (p in possibleProperties.op) possible.push(kb.fromNT(p))
    opts.disambiguate = true
  } else if (from.sameTerm(ns.owl('DatatypeProperty'))) {
Severity: Major
Found in src/widgets/forms.js and 1 other location - About 1 hr to fix
src/widgets/forms.js on lines 1038..1042

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

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

export function fixIndividualACL (item: $rdf.NamedNode, subjects: Array<$rdf.NamedNode>, log: Function, callbackFunction: Function): void {
  log = log || console.log
  const doc = item.doc()
  getACLorDefault(doc, function (
    ok,
Severity: Minor
Found in src/acl/acl.ts - About 1 hr to fix

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

      function inferColumnsFromFormula (columns, formula) {
        UI.log.debug('>> processing formula')
    
        for (let i = 0; i < formula.statements.length; ++i) {
          var statement = formula.statements[i]
    Severity: Minor
    Found in src/table.js - About 1 hr to fix

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

        function generateColumnAddDropdown (type) {
          var resultDiv = doc.createElement('div')
      
          var unusedColumns = type.getUnusedColumns()
      
      
      Severity: Minor
      Found in src/table.js - About 1 hr to fix

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

            var onResult = function (values) {
              if (!query.running) {
                return
              }
        
        
        Severity: Minor
        Found in src/table.js - About 1 hr to fix

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

          export function preventBrowserDropEvents (document: HTMLDocument): void {
            console.log('preventBrowserDropEvents called.')
            const global: any = window
            if (typeof global !== 'undefined') {
              if (global.preventBrowserDropEventsDone) return
          Severity: Minor
          Found in src/acl/acl-control.ts - About 1 hr to fix

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

              var parps = kb.each(subject, ns.wf('participation')).filter(function (pn) {
                return kb.holds(pn, ns.wf('participant'), me)
              })
            Severity: Major
            Found in src/pad.js and 1 other location - About 1 hr to fix
            src/pad.js on lines 104..106

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

            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 parps = kb.each(subject, ns.wf('participation')).filter(function (pn) {
                  return kb.holds(pn, ns.wf('participant'), me)
                })
            Severity: Major
            Found in src/pad.js and 1 other location - About 1 hr to fix
            src/pad.js on lines 150..152

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

            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

                    is.forEach(st => {
                      if (!docs.includes(st.why.uri)) docs.push(st.why.uri)
                    })
            Severity: Major
            Found in src/widgets/forms.js and 1 other location - About 1 hr to fix
            src/widgets/forms.js on lines 754..756

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

            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

                    ds.forEach(st => {
                      if (!docs.includes(st.why.uri)) docs.push(st.why.uri)
                    })
            Severity: Major
            Found in src/widgets/forms.js and 1 other location - About 1 hr to fix
            src/widgets/forms.js on lines 751..753

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

            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 selectorPanel has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

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

                var setPartStyle = function (part, colors, pending) {
                  var chunk = part.subject
                  colors = colors || ''
                  var baseStyle =
                    'font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;'
              Severity: Minor
              Found in src/pad.js - About 1 hr to fix

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

                function RDFComparePredicateSubject (self, other) {
                  var x = self.predicate.compareTerm(other.predicate)
                  if (x !== 0) return x
                  return self.subject.compareTerm(other.subject)
                }
                Severity: Major
                Found in src/utils.js and 1 other location - About 1 hr to fix
                src/utils.js on lines 640..644

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

                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

                function RDFComparePredicateObject (self, other) {
                  var x = self.predicate.compareTerm(other.predicate)
                  if (x !== 0) return x
                  return self.object.compareTerm(other.object)
                }
                Severity: Major
                Found in src/utils.js and 1 other location - About 1 hr to fix
                src/utils.js on lines 646..650

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

                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 firstLeaf has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  async firstLeaf (backwards) {
                    // backwards -> last leafObject
                    var folderStore = $rdf.graph()
                    var folderFetcher = new $rdf.Fetcher(folderStore)
                    async function earliestSubfolder (parent) {
                Severity: Minor
                Found in src/chat/dateFolder.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  public render (): HTMLElement {
                    this.rootElement.innerHTML = ''
                    if (this.isUsingDefaults) {
                      this.renderStatus(`The sharing for this ${this.noun} is the default for folder `)
                      if (this.defaultHolder) {
                Severity: Minor
                Found in src/acl/access-controller.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 removeAgentFromCombos has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  private removeAgentFromCombos (uri: string): void {
                    for (let k = 0; k < 16; k++) {
                      const combos = this.byCombo[kToCombo(k)]
                      if (combos) {
                        for (let i = 0; i < combos.length; i++) {
                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 createIfNotExists has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function createIfNotExists (doc, contentType = 'text/turtle', data = '') {
                  const fetcher = UI.store.fetcher
                  try {
                    var response = await fetcher.load(doc)
                  } catch (err) {
                Severity: Minor
                Found in src/chat/infinite.js - About 1 hr to fix

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

                        async function (_event) {
                          if (action) {
                            await deleteThingThen(action)
                            action = null
                            setColor()
                  Severity: Minor
                  Found in src/chat/messageTools.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language