kumabook/stickynotes

View on GitHub

Showing 74 of 74 total issues

Function setupContextMenus has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function setupContextMenus() {
  browser.contextMenus.create({
    id:       'create-sticky',
    title:    'create sticky',
    contexts: ['all'],
Severity: Minor
Found in src/background.js - About 1 hr to fix

    Function handleSidebarMessage has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function handleSidebarMessage(msg) {
      const port = getPort(msg.portName);
      switch (msg.type) {
        case 'fetch-stickies': {
          idb.open(dbName).then(db => Promise.all([
    Severity: Minor
    Found in src/background.js - About 1 hr to fix

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

      StickyView.prototype.drag = function drag(e) {
        const c      = StickyView.classes;
        const pos    = this.getElementPosition(this.dom);
        const right  = pos.left + parseInt(this.dom.style.width, 10);
        const bottom = pos.top + parseInt(this.dom.style.height, 10);
      Severity: Minor
      Found in src/content_scripts/StickyView.js - About 1 hr to fix

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

        TagEditor.prototype.splitToNames = function splitToNames(str) {
          /* eslint-disable no-irregular-whitespace  */
          const tagsStr = `${str},`.replace(/^[\s ]+|[\s ]+$/g, '');
          const tags     = [];
          let tagList      = (tagsStr).split(',');
        Severity: Minor
        Found in src/content_scripts/TagEditor.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

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

        function getAccessToken() {
          return browser.storage.local.get('accessToken').then((v) => {
            if (v && v.accessToken) {
              return v.accessToken;
            }
        Severity: Major
        Found in src/utils/api.js and 1 other location - About 1 hr to fix
        src/utils/api.js on lines 20..27

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

        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 getUser() {
          return browser.storage.local.get('user').then((v) => {
            if (v && v.user) {
              return v.user;
            }
        Severity: Major
        Found in src/utils/api.js and 1 other location - About 1 hr to fix
        src/utils/api.js on lines 7..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 66.

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

        function handleOptionsUIMessage(msg) {
          const port = getPort(msg.portName);
          switch (msg.type) {
            case 'import': {
              const stickies = msg.payload;
        Severity: Minor
        Found in src/background.js - About 1 hr to fix

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

                    return Sticky.update(item, db)
                      .then((v) => {
                        logger.trace(`Updated ${v.id}`);
                        updatedStickies.push(v);
                      })
          Severity: Major
          Found in src/background.js and 1 other location - About 1 hr to fix
          src/background.js on lines 400..406

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

          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

                  return Sticky.new(s, db).then((st) => {
                    logger.trace(`Created ${s.id}`);
                    createdStickies.push(st);
                  }).catch((e) => {
                    logger.fatal(`Failed to created ${s.id}`);
          Severity: Major
          Found in src/background.js and 1 other location - About 1 hr to fix
          src/background.js on lines 386..391

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

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

            render() {
              const groupByOptions = Object.keys(GroupBy).map((key) => {
                const value = GroupBy[key];
                return (
                  <option
          Severity: Minor
          Found in src/containers/StickyList.jsx - About 1 hr to fix

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

            function sendRequest(method, url, params) {
              /* eslint-disable prefer-promise-reject-errors */
              return getAccessToken().then((accessToken) => {
                const headers = new Headers();
                headers.append('Accept', 'application/json');
            Severity: Minor
            Found in src/utils/api.js - About 1 hr to fix

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

                return new Promise((resolve, reject) => {
                  const request = store.add(data);
                  request.onerror = reject;
                  request.onsuccess = resolve;
                }).then(() => data);
              Severity: Major
              Found in src/models/Model.js and 1 other location - About 1 hr to fix
              src/models/Model.js on lines 66..70

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

              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

                return new Promise((resolve, reject) => {
                  const request = store.put(data);
                  request.onerror = reject;
                  request.onsuccess = resolve;
                }).then(() => data);
              Severity: Major
              Found in src/models/Model.js and 1 other location - About 1 hr to fix
              src/models/Model.js on lines 53..57

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

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

              StickyView.prototype.showMenu = function showMenu() {
                const c = StickyView.classes;
                this.hideDialog();
                this.dialog = new Dialog({ className: c.MENU_DIALOG });
                this.dialog.push(new StickyMenu({
              Severity: Minor
              Found in src/content_scripts/StickyView.js - About 1 hr to fix

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

                    return (
                      <TreeView
                        key={p.id}
                        nodeLabel={label}
                        collapsed={!this.state.collapsedMap[p.id]}
                Severity: Major
                Found in src/containers/StickyList.jsx and 1 other location - About 1 hr to fix
                src/containers/StickyList.jsx on lines 69..77

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

                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

                    return (
                      <TreeView
                        key={t.name}
                        nodeLabel={label}
                        collapsed={!this.state.collapsedMap[t.id]}
                Severity: Major
                Found in src/containers/StickyList.jsx and 1 other location - About 1 hr to fix
                src/containers/StickyList.jsx on lines 92..100

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

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

                function addStickyView(sticky) {
                  const stickyView = new StickyView({
                    sticky,
                    onClickDeleteButton:   () => setTimeout(() => deleteSticky(sticky), 0),
                    onClickMinimizeButton: () => stickyView.minimize(),
                Severity: Minor
                Found in src/content_script.js - About 1 hr to fix

                  Function watchPort has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function* watchPort() {
                    const portChannel = yield call(createPortChannel, port);
                  
                    for (;;) {
                      const event = yield take(portChannel);
                  Severity: Minor
                  Found in src/sagas/sidebar.js - About 1 hr to fix

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

                      this.items.forEach((item) => {
                        item.dom = this.createMenuItem(item);
                        this.dom.appendChild(item.dom);
                      });
                    Severity: Major
                    Found in src/content_scripts/FontPicker.js and 1 other location - About 1 hr to fix
                    src/content_scripts/StickyMenu.js on lines 36..39

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

                    const stickies = (state = [], action) => {
                      switch (action.type) {
                        case 'FETCHED_STICKIES':
                          return action.payload.stickies;
                        case 'CREATED_STICKIES':
                    Severity: Minor
                    Found in src/reducers/sidebar.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language