michielbdejong/solid-ui

View on GitHub

Showing 337 of 337 total issues

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

const UI = {
  authn: require('./authn/authn'),
  icons: require('./iconBase'),
  log: require('./log'),
  ns: require('./ns'),
Severity: Major
Found in src/create.js and 1 other location - About 2 hrs to fix
src/folders.js on lines 5..14

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

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

AddAgentButtons has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

export class AddAgentButtons {
  private readonly rootElement: HTMLElement
  private readonly barElement: HTMLElement
  private isExpanded: boolean = false

Severity: Minor
Found in src/acl/add-agent-buttons.ts - About 2 hrs to fix

    Function loadPrevious has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async loadPrevious (date, backwards) {
        const thisDateFolder = this
        async function previousPeriod (file, level) {
          function younger (x) {
            if (backwards ? x.uri >= file.uri : x.uri <= file.uri) return false // later than we want or same -- looking for different
    Severity: Major
    Found in src/chat/dateFolder.js - About 2 hrs to fix

      Function tryParent has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const tryParent = function (uri) {
            if (uri.slice(-1) === '/') {
              uri = uri.slice(0, -1)
            }
            const right = uri.lastIndexOf('/')
      Severity: Major
      Found in src/acl/acl.ts - About 2 hrs to fix

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

        function updatePromise (del, ins) {
          return new Promise(function (resolve, reject) {
            kb.updater.update(del, ins, function (uri, ok, errorBody) {
              if (!ok) {
                reject(new Error(errorBody))
        Severity: Major
        Found in src/chat/messageTools.js and 1 other location - About 2 hrs to fix
        src/chat/bookmarks.js on lines 74..84

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

        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

        function updatePromise (del, ins) {
          return new Promise(function (resolve, reject) {
            kb.updater.update(del, ins, function (uri, ok, errorBody) {
              if (!ok) {
                reject(new Error(errorBody))
        Severity: Major
        Found in src/chat/bookmarks.js and 1 other location - About 2 hrs to fix
        src/chat/messageTools.js on lines 46..56

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

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

          function sentimentButton (
            context,
            target,
            icon,
            actionClass,
        Severity: Major
        Found in src/chat/messageTools.js - About 2 hrs to fix

          Function refreshItem has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var refreshItem = function (box, x) {
              // Scope to hold item and x
              var item, image
          
              var setStyle = function () {
          Severity: Major
          Found in src/widgets/buttons.js - About 2 hrs to fix

            Function consistencyCheck has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              var consistencyCheck = function () {
                var found = []
                var failed = 0
                function complain2 (msg) {
                  complain(msg)
            Severity: Major
            Found in src/pad.js - About 2 hrs to fix

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

                var dropListener = function (e) {
                  if (e.preventDefault) e.preventDefault() // stops the browser from redirecting off to the text.
                  console.log('Drop event. dropEffect: ' + e.dataTransfer.dropEffect)
                  console.log(
                    'Drop event. types: ' +
              Severity: Minor
              Found in src/widgets/dragAndDrop.js - About 2 hrs to fix

                Function firstLeaf has 50 lines of code (exceeds 25 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 2 hrs to fix

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

                    var sync = function () {
                      // var first = kb.the(subject, PAD('next'))
                      if (kb.each(subject, PAD('next')).length !== 1) {
                        var msg =
                          'Pad: Inconsistent data - NEXT pointers: ' +
                  Severity: Minor
                  Found in src/pad.js - About 2 hrs to fix

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

                                console.log(
                                  'Filename: ' +
                                    f.name +
                                    ', type: ' +
                                    (f.type || 'n/a') +
                    Severity: Major
                    Found in src/widgets/dragAndDrop.js and 1 other location - About 2 hrs to fix
                    src/widgets/dragAndDrop.js on lines 173..182

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

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

                    function signInOrSignUpBox (
                      dom: HTMLDocument,
                      setUserCallback: (user: string) => void,
                      options: {
                        buttonStyle?: string
                    Severity: Minor
                    Found in src/authn/authn.ts - About 2 hrs to fix

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

                        var boxHandler = function (_e) {
                          tx.style = 'color: #bbb;' // grey -- not saved yet
                          var toDelete = input.state === true ? ins : input.state === false ? del : []
                          input.newState =
                            input.state === null
                      Severity: Minor
                      Found in src/widgets/forms.js - About 2 hrs to fix

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

                            console.log(
                              ' dropped: Filename: ' +
                                f.name +
                                ', type: ' +
                                (f.type || 'n/a') +
                        Severity: Major
                        Found in src/widgets/dragAndDrop.js and 1 other location - About 2 hrs to fix
                        src/widgets/dragAndDrop.js on lines 71..82

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

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

                          var orderedSync = function () {
                            var items = getItems()
                            if (!vertical) {
                              // mainElement.setAttribute('colspan', items.length + (onClose ? 1 : 0))
                            }
                        Severity: Minor
                        Found in src/tabs.js - About 1 hr to fix

                          Function deleteFolder has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports.deleteFolder = function (folder, store, dom) {
                            store = store || UI.store
                            if (typeof docuent !== 'undefined') {
                              dom = dom || document
                            }
                          Severity: Minor
                          Found in src/folders.js - About 1 hr to fix

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

                              var hash = function (x) {
                                return x.split('').reduce(function (a, b) {
                                  a = (a << 5) - a + b.charCodeAt(0)
                                  return a & a
                                }, 0)
                            Severity: Major
                            Found in src/utils.js and 1 other location - About 1 hr to fix
                            src/pad.js on lines 31..36

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

                            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 hash = function (x) {
                                return x.split('').reduce(function (a, b) {
                                  a = (a << 5) - a + b.charCodeAt(0)
                                  return a & a
                                }, 0)
                            Severity: Major
                            Found in src/pad.js and 1 other location - About 1 hr to fix
                            src/utils.js on lines 99..104

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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language