Showing 110 of 220 total issues
File API.js
has 496 lines of code (exceeds 250 allowed). Consider refactoring. Open
import LocalForage from "localforage";
import { Base64 } from "js-base64";
import _ from "lodash";
import { filterPromises, resolvePromiseProperties } from "../../lib/promiseHelper";
import AssetProxy from "../../valueObjects/AssetProxy";
API
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
export default class API {
constructor(config) {
this.api_root = config.api_root || "https://api.github.com";
this.token = config.token || false;
this.branch = config.branch || "master";
Function localSearch
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
function localSearch(searchTerm, getState, dispatch) {
return (function acc(localResults = { entries: [] }) {
function processCollection(collection, collectionKey) {
const state = getState();
if (state.entries.hasIn(['pages', collectionKey, 'ids'])) {
- 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
File Icon.js
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import { Icon } from '../UI';
import { storiesOf } from '@kadira/storybook';
const style = {
Function render
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
collection,
entry,
fields,
Function render
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
user,
config,
children,
Function remarkPaddedLinks
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export default function remarkPaddedLinks() {
function transform(node) {
/**
- 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 editorialWorkflowGit
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
editorialWorkflowGit(fileTree, entry, filesList, options) {
const contentKey = entry.slug;
const branchName = `cms/${ contentKey }`;
const unpublished = options.unpublished || false;
if (!unpublished) {
File editorialWorkflow.js
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
import uuid from 'uuid';
import { actions as notifActions } from 'redux-notifications';
import { serializeValues } from '../lib/serializeEntryValues';
import { closeEntry } from './editor';
import { BEGIN, COMMIT, REVERT } from 'redux-optimist';
File entries.js
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { List } from 'immutable';
import { actions as notifActions } from 'redux-notifications';
import { serializeValues } from '../lib/serializeEntryValues';
import { closeEntry } from './editor';
import { currentBackend } from '../backends/backend';
Function convertNode
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function convertNode(node, nodes) {
/**
* Unified/Remark processors use mutable operations, so we don't want to
* change a node's type directly for conversion purposes, as that tends to
File backend.js
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { attempt, isError } from 'lodash';
import TestRepoBackend from "./test-repo/implementation";
import GitHubBackend from "./github/implementation";
import GitGatewayBackend from "./git-gateway/implementation";
import { resolveFormat } from "../formats/formats";
Function entryDraftReducer
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const entryDraftReducer = (state = Map(), action) => {
switch (action.type) {
case DRAFT_CREATE_FROM_ENTRY:
// Existing Entry
return state.withMutations((state) => {
Function onKeyDown
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function onKeyDown(e, data, state) {
const createDefaultBlock = () => {
return Block.create({
type: 'paragraph',
nodes: [Text.createFromString('')]
- 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 render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
onToggleMode,
rawMode,
plugins,
Function unpublishedEntries
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
const unpublishedEntries = (state = null, action) => {
const publishMode = action.payload && action.payload.publish_mode;
switch (action.type) {
case CONFIG_SUCCESS:
if (publishMode === EDITORIAL_WORKFLOW) {
Function SoftBreak
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const SoftBreak = (options = {}) => ({
onKeyDown(e, data, state) {
if (data.key != 'enter') return;
if (options.shift && e.shiftKey == false) return;
- 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 inferWidget
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function inferWidget(name, value) {
if (value == null) {
return { widget: 'string' };
}
if (value instanceof Date) {
- 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 convertNode
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function convertNode(node, children, shortcodePlugins) {
switch (node.type) {
/**
* General
Function render
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { errors } = this.state;
const { error } = this.props;
if (window.netlifyIdentity) {