Showing 8 of 43 total issues
Function handleAction
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function handleAction(action, ...args) {
return (dispatch) => {
switch (action) {
case OPEN_ADD_BOOKMARK:
return dispatch(openAddBookmark(...args));
Function getListItem
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getListItem(url, handleAction) {
if (url.status === SyncClient.statuses.ERROR) {
return (<ListItem
style={listElementStyle}
key={url.url}
Function loadItems
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function loadItems(parentID = 'noparent') {
return (dispatch) => {
const foldersPromise = syncClient
.folders
.where({ parentID })
Function getView
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
{(function getView() {
switch (view) {
case LIST_VIEW:
return (<List />);
case ADD_BOOKMARK_VIEW:
Function addSyncUrl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function addSyncUrl(url) {
return (dispatch) => {
syncClient.connect(url)
.then(() => syncClient.syncable.getStatus(url))
.then((currentStatus) => {
Function initSyncStatusListeners
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function initSyncStatusListeners() {
return (dispatch) => {
syncClient.getStatuses()
.then((statuses) => {
dispatch({
Function rightMenuIcon
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
const rightMenuIcon = (
handleAction,
type,
id,
url,
- 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. Open
Open
return 1;