Showing 28 of 74 total issues
File background.js
has 580 lines of code (exceeds 250 allowed). Consider refactoring. Open
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';
File StickyView.js
has 458 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import browser from 'webextension-polyfill';
import ColorPicker from './ColorPicker';
import TagEditor from './TagEditor';
import Dialog from './Dialog';
import StickyMenu from './StickyMenu';
Function handleContentScriptMessage
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function handleContentScriptMessage(msg) {
logger.info(`handleContentScriptMessage ${JSON.stringify(msg)}`);
const port = getPort(msg.portName);
switch (msg.type) {
case 'load-options': {
Function handlePopupMessage
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function handlePopupMessage(msg) {
logger.info(`handlePopupMessage ${msg.type} from ${msg.portName}`);
const port = getPort(msg.portName);
switch (msg.type) {
case 'list-menu': {
Function messageListener
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function messageListener(msg) {
const { type } = msg;
switch (type) {
case 'load-stickies':
loadStickies(msg.stickies, msg.targetUrl);
File StickyList.jsx
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
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';
Function importStickies
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function importStickies(stickies, db) {
const createdStickies = [];
const updatedStickies = [];
return stickies.reduce((p, s) => {
s = Sticky.normalize(s);
Function render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="container">
<div className="navBar">
<button
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="container">
<div className="navBar">
<button
Function messageListener
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
function messageListener(msg) {
const { type } = msg;
switch (type) {
case 'load-stickies':
loadStickies(msg.stickies, msg.targetUrl);
- 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
Function setupContextMenus
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setupContextMenus() {
browser.contextMenus.create({
id: 'create-sticky',
title: 'create sticky',
contexts: ['all'],
Function handleSidebarMessage
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function handleSidebarMessage(msg) {
const port = getPort(msg.portName);
switch (msg.type) {
case 'fetch-stickies': {
idb.open(dbName).then(db => Promise.all([
Function drag
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Function splitToNames
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
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(',');
- 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
Function handleOptionsUIMessage
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function handleOptionsUIMessage(msg) {
const port = getPort(msg.portName);
switch (msg.type) {
case 'import': {
const stickies = msg.payload;
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const groupByOptions = Object.keys(GroupBy).map((key) => {
const value = GroupBy[key];
return (
<option
Function sendRequest
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
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');
Function showMenu
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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({
Function addStickyView
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addStickyView(sticky) {
const stickyView = new StickyView({
sticky,
onClickDeleteButton: () => setTimeout(() => deleteSticky(sticky), 0),
onClickMinimizeButton: () => stickyView.minimize(),
Function watchPort
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function* watchPort() {
const portChannel = yield call(createPortChannel, port);
for (;;) {
const event = yield take(portChannel);