Showing 365 of 1,033 total issues
Function entitiesToFormState
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function entitiesToFormState(entities: any[]) {
const [targetEntity, ...otherEntities] = entities;
const aliases: any[] = entities.reduce((returnValue, entity) => {
if (Array.isArray(_.get(entity, 'aliasSet.aliases'))) {
return returnValue.concat(
- 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 relationshipTypeCreateOrEditHandler
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function relationshipTypeCreateOrEditHandler(req, res, next) {
try {
const {RelationshipType, RelationshipTypeAttributeType, bookshelf} = req.app.locals.orm;
const trx = await bookshelf.transaction();
let newRelationshipType;
File content-tab.tsx
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as Bootstrap from 'react-bootstrap/';
import {ContentTabDispatchProps, ContentTabProps, ContentTabStateProps, State} from '../interface/type';
import {addBulkSeriesItems, addSeriesItem, removeAllSeriesItems, updateOrderType, updateSeriesType} from '../../entity-editor/series-section/actions';
import {addSeries, addWork, duplicateWork, removeSeries} from './action';
import {closeEntityModal, dumpEdition, loadEdition, openEntityModal} from '../action';
Function Footer
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Footer(props) {
const {repositoryUrl, siteRevision} = props;
return (
<footer className="footer">
Function UnifiedForm
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function UnifiedForm(props:UnifiedFormProps) {
const {allIdentifierTypes, validator, onSubmit, formValid,
languageOptions, contentTabEmpty, coverTabValid, coverTabEmpty, detailTabValid, detailTabEmpty} = props;
const rest = omit(props, ['contentTabEmpty', 'coverTabValid', 'coverTabEmpty', 'detailTabValid', 'formValid', 'detailTabEmpty']);
React.useMemo(() => {
Function renderBadges
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderBadges() {
const {achievement} = this.props;
let achievementBsSize = 12;
if (achievement.length === 1) {
achievementBsSize = 8;
Function handleCreateMultipleEntities
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function handleCreateMultipleEntities(
req: PassportRequest,
res: $Response
) {
const {orm}: {orm?: any} = req.app.locals;
File author-section.tsx
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (C) 2016 Ben Ockmore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Function collectionCreateOrEditHandler
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function collectionCreateOrEditHandler(req, res, next) {
try {
const {UserCollection, UserCollectionCollaborator} = req.app.locals.orm;
const isNew = !res.locals.collection;
let newCollection;
Function transformNewForm
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function transformNewForm(data) {
const aliases = entityRoutes.constructAliases(
data.aliasEditor, data.nameSection
);
Function getProgress
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getProgress(achievementId, editorId, orm) {
const revisionist = [1, 2, 3];
if (revisionist.includes(achievementId)) {
const {Editor} = orm;
const editor = await new Editor({id: editorId})
Function render
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
render() {
const noResults = !this.props.results || this.props.results.length === 0;
const results = this.props.results.map((result) => {
if (!result) {
- 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 SeriesEditor
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function SeriesEditor({baseEntity, relationshipTypes, seriesType, orderType, onRemove, hideItemSelect,
onAdd, onEdit, onSort, seriesItemsArray, isUnifiedForm}:SeriesItemsProps) {
const [seriesItem, setSeriesItem] = useState(null);
const [targetEntity, setTargetEntity] = useState(null);
- 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 mapDispatchToProps
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function mapDispatchToProps(dispatch: Dispatch<Action>): DispatchProps {
return {
onDepthChange: (event) => dispatch(debouncedUpdateDepth(
event.target.value ? parseInt(event.target.value, 10) : null
)),
- 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 helpers.ts
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {ADD_AUTHOR, ADD_PUBLISHER} from './cover-tab/action';
import {Action, State} from './interface/type';
import {CLOSE_ENTITY_MODAL, DUMP_EDITION, LOAD_EDITION, OPEN_ENTITY_MODAL} from './action';
import {ISBNReducer, authorsReducer, autoISBNReducer, publishersReducer} from './cover-tab/reducer';
import {seriesReducer, worksReducer} from './content-tab/reducer';
Function init
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function init(app) {
const {orm} = app.locals;
try {
let strategy;
// eslint-disable-next-line node/no-process-env
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const switches = Object.values(PrivilegeTypes).map(priv => (
<Form.Check
checked={this.state.privs & priv.value}
id={`bit${priv.bit}`}
File index.js
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (C) 2016 Daniel Hsing
* 2016 Ben Ockmore
* 2015 Sean Burke
* 2015 Leo Verto
Function render
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
homepage,
siteRevision,
repositoryUrl,
Function render
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {showLastModified, showOwner, showIfOwnerOrCollaborator, showPrivacy, results, tableHeading, user, ownerId} = this.props;
const entityTypeSelect = (
<DropdownButton
className="margin-bottom-d5"
- 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"