Showing 110 of 220 total issues
Function runSerializer
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const runSerializer = (values, fields, method) => {
/**
* Reduce the list of fields to a map where keys are field names and values
* are field values, serializing the values of fields whose widgets have
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function inferWidget(name, value) {
if (value == null) {
return { widget: 'string' };
}
if (value instanceof Date) {
Function persistEntry
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function persistEntry(collection) {
return (dispatch, getState) => {
const state = getState();
const entryDraft = state.entryDraft;
Function persistUnpublishedEntry
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function persistUnpublishedEntry(collection, existingUnpublishedEntry) {
return (dispatch, getState) => {
const state = getState();
const entryDraft = state.entryDraft;
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { processing } = this.state;
const imageName = this.renderImageName();
if (processing) {
return (
Function renderCard
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderCard(collection, entry, inferedFields, publicFolder) {
const path = `/collections/${ collection.get('name') }/entries/${ entry.get('slug') }`;
const label = entry.get('label');
const title = label || entry.getIn(['data', inferedFields.titleField]);
let image = entry.getIn(['data', inferedFields.imageField]);
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { processing } = this.state;
const fileName = this.renderFileName();
if (processing) {
return (
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { entry, collection } = this.props;
if (!entry || !entry.get('data')) {
return null;
Function BackspaceCloseBlock
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const BackspaceCloseBlock = (options = {}) => ({
onKeyDown(e, data, state) {
if (data.key != 'backspace') return;
const { defaultBlock = 'paragraph', ignoreIn, onlyIn } = options;
- 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 remarkSquashReferences
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function remarkSquashReferences() {
return getTransform;
function getTransform(node) {
const getDefinition = mdastDefinitions(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 render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { onChange, onAddAsset, onRemoveAsset, getAsset, value } = this.props;
const { mode } = this.state;
const visualEditor = (
<div className="cms-editor-visual">
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { plugins, onComponentMenuItemClick, disabled } = this.props;
return (
<div className={styles.root}>
<ToolbarButton
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { props, state } = this;
const stickyPlaceholderHeight = state.shouldStick ? this.ref.getBoundingClientRect().height : 0;
return (
Function slugFormatter
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const slugFormatter = (template = "{{slug}}", entryData) => {
const date = new Date();
const getIdentifier = (entryData) => {
const validIdentifierFields = ["title", "path"];
Function authenticate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
authenticate(user) {
this.tokenPromise = user.jwt.bind(user);
return this.tokenPromise()
.then((token) => {
let validRole = true;
Consider simplifying this complex logical expression. Open
if (isRequired && (
value === null ||
value === undefined ||
(value.hasOwnProperty('length') && value.length === 0) ||
(value.constructor === Object && Object.keys(value).length === 0)
Function remarkImagesToText
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function remarkImagesToText() {
return transform;
function transform(node) {
const children = node.children ? node.children.map(transform) : node.children;
- 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 waitUntilAction
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function waitUntilAction({ dispatch, getState }) {
let pending = [];
function checkPending(action) {
const readyRequests = [];
- 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 integrations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const integrations = (state = null, action) => {
switch (action.type) {
case CONFIG_SUCCESS:
const integrations = action.payload.integrations || [];
const newState = integrations.reduce((acc, integration) => {
- 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 validateConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function validateConfig(config) {
if (!get(config, 'backend')) {
throw new Error("Error in configuration file: A `backend` wasn't found. Check your config.yml file.");
}
if (!get(config, ['backend', 'name'])) {
- 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"