kumabook/bebop

View on GitHub

Showing 36 of 36 total issues

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

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

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

export function deleteBookmark(cs) {
  return Promise.all(filter(cs, 'bookmark').map(({ args }) => browser.bookmarks.remove(args[1])));
}
Severity: Major
Found in src/actions.js and 1 other location - About 1 hr to fix
src/actions.js on lines 38..40

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

export function closeTab(cs) {
  return Promise.all(filter(cs, 'tab').map(({ args }) => browser.tabs.remove(args[0])));
}
Severity: Major
Found in src/actions.js and 1 other location - About 1 hr to fix
src/actions.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 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.
Confirmed

const searchActions = [
  { id: 'search'           , label: 'search'           , icon: 'open', handler: search        , contentHandler: noop },
  { id: 'search-in-new-tab', label: 'search in new tab', icon: 'tab' , handler: searchInNewTab, contentHandler: noop },
];
Severity: Major
Found in src/actions.js and 1 other location - About 1 hr to fix
src/actions.js on lines 251..254

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

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

      function* dispatchHatenaUserName() {
        const { hatenaUserName } = yield browser.storage.local.get('hatenaUserName');
        yield put({ type: 'HATENA_USER_NAME', payload: hatenaUserName });
      }
      Severity: Major
      Found in src/sagas/options.js and 1 other location - About 1 hr to fix
      src/sagas/options.js on lines 15..18

      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

      function* dispatchPopupWidth() {
        const { popupWidth } = yield browser.storage.local.get('popupWidth');
        yield put({ type: 'POPUP_WIDTH', payload: popupWidth });
      }
      Severity: Major
      Found in src/sagas/options.js and 1 other location - About 1 hr to fix
      src/sagas/options.js on lines 20..23

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

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

          const theme = (state = '', action) => {
            switch (action.type) {
              case 'SET_THEME':
                return action.payload || '';
              default:
          Severity: Minor
          Found in src/reducers/options.js and 1 other location - About 35 mins to fix
          src/reducers/options.js on lines 58..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 46.

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

          const hatenaUserName = (state = '', action) => {
            switch (action.type) {
              case 'HATENA_USER_NAME':
                return action.payload || '';
              default:
          Severity: Minor
          Found in src/reducers/options.js and 1 other location - About 35 mins to fix
          src/reducers/options.js on lines 67..74

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

          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

          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