Showing 11 of 36 total issues
File actions.js
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Confirmed
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';
File popup.js
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Confirmed
Confirmed
import browser from 'webextension-polyfill';
import logger from 'kiroku';
import { delay } from 'redux-saga';
import {
fork,
Function runCommand
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
export function runCommand(cs) {
return Promise.all(filter(cs, 'command').map(async ({ args }) => {
const [name] = args;
switch (name) {
case 'open-options':
Function watchReturn
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
function* watchReturn() {
yield takeEvery('RETURN', function* handleReturn({ payload: { actionIndex } }) {
const {
candidates: { index, items },
mode, markedCandidateIds, prev,
Function messageListener
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
export function messageListener(request) {
switch (request.type) {
case 'SEND_MESSAGE_TO_ACTIVE_CONTENT_TAB': {
return getActiveContentTab().then((tab) => {
if (tab.url.startsWith('chrome://')) {
Function watchListActions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
function* watchListActions() {
/* eslint-disable object-curly-newline */
yield takeEvery('LIST_ACTIONS', function* handleListActions() {
const {
candidates: { index, items },
Function runCommandOnContent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
Confirmed
export function runCommandOnContent(cs) {
return Promise.all(filter(cs, 'command').map(({ args }) => {
const [name] = args;
switch (name) {
case 'go-forward':
Function candidates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Confirmed
Confirmed
export default async function candidates(q, { maxResults } = {}) {
const { hatenaUserName } = await browser.storage.local.get('hatenaUserName');
if (!hatenaUserName && maxResults !== 0) {
return {
items: [openOptionCommand],
- Read upRead up
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
Confirmed
return { index: null, items: scheme.enum || [] };
Avoid too many return
statements within this function. Confirmed
Confirmed
return downloadBookmarks(hatenaUserName);
Function candidates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Confirmed
Confirmed
const candidates = (state = { index: null, items: [] }, action) => {
switch (action.type) {
case 'CANDIDATES': {
const { items } = action.payload;
return normalize({ index: state.index, items });
- Read upRead up
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"