kumabook/stickynotes

View on GitHub

Showing 74 of 74 total issues

File background.js has 580 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global setTimeout: false, clearTimeout: false */
/* eslint no-use-before-define: ["error", { "functions": false }] */
import browser from 'webextension-polyfill';
import idb     from './utils/indexedDB';
import logger  from './utils/logger';
Severity: Major
Found in src/background.js - About 1 day to fix

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

    StickyView.prototype.bind = function bind() {
      this.deleteButton.addEventListener('click', this.onClickDeleteButton);
      this.minimizeButton.addEventListener('click', this.onClickMinimizeButton);
      this.editTagButton.addEventListener('click', this.onClickEditTagButton);
      this.editTagButton.addEventListener('focus', this.onClickEditTagButton);
    Severity: Major
    Found in src/content_scripts/StickyView.js and 1 other location - About 1 day to fix
    src/content_scripts/StickyView.js on lines 294..307

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

    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

    StickyView.prototype.unbind = function unbind() {
      this.dom.removeEventListener('mousedown', this.drag);
      this.dom.removeEventListener('dblclick', this.maximize);
    
      this.deleteButton.removeEventListener('click', this.onClickDeleteButton);
    Severity: Major
    Found in src/content_scripts/StickyView.js and 1 other location - About 1 day to fix
    src/content_scripts/StickyView.js on lines 279..292

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

    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

    Sticky.findBySince = function findBySince(date, db) {
      const store = this.objectStore(db);
      const items = [];
      return new Promise((resolve, reject) => {
        const index       = store.index('updated_at');
    Severity: Major
    Found in src/models/Sticky.js and 1 other location - About 7 hrs to fix
    src/models/Sticky.js on lines 87..105

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

    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

    Sticky.findByUrl = function findByUrl(url, db) {
      const store = this.objectStore(db);
      const items = [];
      return new Promise((resolve, reject) => {
        const index   = store.index('url');
    Severity: Major
    Found in src/models/Sticky.js and 1 other location - About 7 hrs to fix
    src/models/Sticky.js on lines 107..125

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

    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

    File StickyView.js has 458 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import browser from 'webextension-polyfill';
    import ColorPicker from './ColorPicker';
    import TagEditor from './TagEditor';
    import Dialog from './Dialog';
    import StickyMenu from './StickyMenu';
    Severity: Minor
    Found in src/content_scripts/StickyView.js - About 7 hrs to fix

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

      StickyMenu.prototype.onSelect = function onSelect(e) {
        e.stopPropagation();
        e.preventDefault();
        const id = e.target.id || e.target.parentNode.id;
        this.items.forEach((item) => {
      Severity: Major
      Found in src/content_scripts/StickyMenu.js and 1 other location - About 4 hrs to fix
      src/content_scripts/FontPicker.js on lines 49..58

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

      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

      FontPicker.prototype.onSelect = function onSelect(e) {
        e.stopPropagation();
        e.preventDefault();
        const id = e.target.id || e.target.parentNode.id;
        this.items.forEach((item) => {
      Severity: Major
      Found in src/content_scripts/FontPicker.js and 1 other location - About 4 hrs to fix
      src/content_scripts/StickyMenu.js on lines 56..65

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

      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

      Tag.findByName = function findByName(name, db) {
        const objectStore = this.objectStore(db);
        const index = objectStore.index('name');
        return new Promise((resolve, reject) => {
          const request     = index.get(name);
      Severity: Major
      Found in src/models/Tag.js and 1 other location - About 3 hrs to fix
      src/models/Page.js on lines 13..21

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

      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

      Page.findByUrl = function findByUrl(url, db) {
        const objectStore = this.objectStore(db);
        const index = objectStore.index('url');
        return new Promise((resolve, reject) => {
          const request     = index.get(url);
      Severity: Major
      Found in src/models/Page.js and 1 other location - About 3 hrs to fix
      src/models/Tag.js on lines 13..21

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

      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 createStickyOnActiveTab() {
        browser.tabs.query({ currentWindow: true, active: true }).then((tabs) => {
          if (tabs.length > 0) {
            getContentScriptPorts().forEach(p => p.postMessage({
              type:      'create-sticky',
      Severity: Major
      Found in src/background.js and 1 other location - About 3 hrs to fix
      src/background.js on lines 55..64

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

      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 toggleStickies() {
        browser.tabs.query({ currentWindow: true, active: true }).then((tabs) => {
          if (tabs.length > 0) {
            getContentScriptPorts().forEach(p => p.postMessage({
              type:      'toggle-visibility',
      Severity: Major
      Found in src/background.js and 1 other location - About 3 hrs to fix
      src/background.js on lines 44..53

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

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

      function handleContentScriptMessage(msg) {
        logger.info(`handleContentScriptMessage ${JSON.stringify(msg)}`);
        const port = getPort(msg.portName);
        switch (msg.type) {
          case 'load-options': {
      Severity: Major
      Found in src/background.js - About 3 hrs to fix

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

          getErrorMessage() {
            if (this.props.loginStatus.type === 'failed') {
              let message = getMessage('loginError');
              switch (this.props.loginStatus.type) {
                case 401:
        Severity: Major
        Found in src/containers/Login.jsx and 1 other location - About 3 hrs to fix
        src/containers/SignUp.jsx on lines 8..25

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

        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

          getErrorMessage() {
            if (this.props.signupStatus.type === 'failed') {
              let message = getMessage('signupError');
              switch (this.props.signupStatus.type) {
                case 401:
        Severity: Major
        Found in src/containers/SignUp.jsx and 1 other location - About 3 hrs to fix
        src/containers/Login.jsx on lines 8..25

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

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

        function handlePopupMessage(msg) {
          logger.info(`handlePopupMessage ${msg.type} from ${msg.portName}`);
          const port = getPort(msg.portName);
          switch (msg.type) {
            case 'list-menu': {
        Severity: Major
        Found in src/background.js - About 3 hrs to fix

          Function messageListener has 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function messageListener(msg) {
            const { type } = msg;
            switch (type) {
              case 'load-stickies':
                loadStickies(msg.stickies, msg.targetUrl);
          Severity: Major
          Found in src/content_script.js - About 3 hrs to fix

            File StickyList.jsx has 282 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from 'react';
            import PropTypes from 'prop-types';
            import { connect } from 'react-redux';
            import { withRouter } from 'react-router-dom';
            import TreeView from 'react-treeview';
            Severity: Minor
            Found in src/containers/StickyList.jsx - About 2 hrs to fix

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

              StickyView.prototype.toggleMenuDialog = function toggleMenuDialog() {
                const c = StickyView.classes;
                this.hideDialog();
                if (!this.dialog || this.dialog.className !== c.MENU_DIALOG) {
                  this.showMenu();
              Severity: Major
              Found in src/content_scripts/StickyView.js and 1 other location - About 2 hrs to fix
              src/content_scripts/StickyView.js on lines 458..464

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

              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

              StickyView.prototype.toggleTagDialog = function toggleTagDialog() {
                const c = StickyView.classes;
                this.hideDialog();
                if (!this.dialog || this.dialog.className !== c.TAGS_DIALOG) {
                  this.showTagDialog();
              Severity: Major
              Found in src/content_scripts/StickyView.js and 1 other location - About 2 hrs to fix
              src/content_scripts/StickyView.js on lines 450..456

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

              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