kumabook/bebop

View on GitHub

Showing 11 of 36 total issues

File actions.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Confirmed

/* eslint-disable no-multi-spaces, comma-spacing, object-curly-newline */
import browser from 'webextension-polyfill';
import isUrl from 'is-url';
import { click } from './link';
import * as cursor from './cursor';
Severity: Minor
Found in src/actions.js - About 3 hrs to fix

    File popup.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
    Confirmed

    import browser from 'webextension-polyfill';
    import logger from 'kiroku';
    import { delay } from 'redux-saga';
    import {
      fork,
    Severity: Minor
    Found in src/sagas/popup.js - About 3 hrs to fix

      Function runCommand has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Confirmed

      export function runCommand(cs) {
        return Promise.all(filter(cs, 'command').map(async ({ args }) => {
          const [name] = args;
          switch (name) {
            case 'open-options':
      Severity: Major
      Found in src/actions.js - About 2 hrs to fix

        Function watchReturn has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Confirmed

        function* watchReturn() {
          yield takeEvery('RETURN', function* handleReturn({ payload: { actionIndex } }) {
            const {
              candidates: { index, items },
              mode, markedCandidateIds, prev,
        Severity: Minor
        Found in src/sagas/popup.js - About 1 hr to fix

          Function messageListener has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Confirmed

          export function messageListener(request) {
            switch (request.type) {
              case 'SEND_MESSAGE_TO_ACTIVE_CONTENT_TAB': {
                return getActiveContentTab().then((tab) => {
                  if (tab.url.startsWith('chrome://')) {
          Severity: Minor
          Found in src/background.js - About 1 hr to fix

            Function watchListActions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Confirmed

            function* watchListActions() {
              /* eslint-disable object-curly-newline */
              yield takeEvery('LIST_ACTIONS', function* handleListActions() {
                const {
                  candidates: { index, items },
            Severity: Minor
            Found in src/sagas/popup.js - About 1 hr to fix

              Function runCommandOnContent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Confirmed

              export function runCommandOnContent(cs) {
                return Promise.all(filter(cs, 'command').map(({ args }) => {
                  const [name] = args;
                  switch (name) {
                    case 'go-forward':
              Severity: Minor
              Found in src/actions.js - About 1 hr to fix

                Function candidates has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Confirmed

                export default async function candidates(q, { maxResults } = {}) {
                  const { hatenaUserName } = await browser.storage.local.get('hatenaUserName');
                  if (!hatenaUserName && maxResults !== 0) {
                    return {
                      items: [openOptionCommand],
                Severity: Minor
                Found in src/sources/hatena_bookmark.js - About 45 mins 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

                Avoid too many return statements within this function.
                Confirmed

                      return { index: null, items: scheme.enum || [] };
                Severity: Major
                Found in src/reducers/popup.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Confirmed

                          return downloadBookmarks(hatenaUserName);
                  Severity: Major
                  Found in src/actions.js - About 30 mins to fix

                    Function candidates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Confirmed

                    const candidates = (state = { index: null, items: [] }, action) => {
                      switch (action.type) {
                        case 'CANDIDATES': {
                          const { items } = action.payload;
                          return normalize({ index: state.index, items });
                    Severity: Minor
                    Found in src/reducers/popup.js - About 25 mins 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

                    Severity
                    Category
                    Status
                    Source
                    Language