Showing 365 of 1,033 total issues
Function handleSubmit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleSubmit() {
const cleanedEntities = this.getCleanedEntities();
const bbids = cleanedEntities.map(entity => entity.id);
if (bbids.length) {
request.post(`/collection/${this.props.collectionId}/add`)
Function handleSubmit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleSubmit(event) {
const {note} = this.state;
event.preventDefault();
if (!note || !note.length) {
Function saveEntitiesAndFinishRevision
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function saveEntitiesAndFinishRevision(
orm, transacting, isNew: boolean, newRevision: any, mainEntity: any,
updatedEntities: any[], editorID: number, note: string
) {
const parentRevisionIDs = _.compact(_.uniq(updatedEntities.map(
Function refreshAccessToken
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function refreshAccessToken(
editorId: number,
refreshToken: string,
orm: Record<string, any>
): Promise<any> {
Function transformNewForm
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function transformNewForm(data) {
const aliases = entityRoutes.constructAliases(
data.aliasEditor, data.nameSection
);
Function submit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function submit(
submissionUrl: string,
isUnifiedForm = false
): SubmitResult {
return (dispatch, getState) => {
Function validateCollectionParams
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function validateCollectionParams(req, res, next) {
const {collaborators = [], name, entityType} = req.body;
const {orm} = req.app.locals;
const {Editor} = orm;
Function loadSeriesItems
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function loadSeriesItems(req: $Request, res: $Response, next: NextFunction) {
try {
const {entity} = res.locals;
if (entity.dataId) {
const {relationships} = entity;
Function submitSingleEntity
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function submitSingleEntity(submissionUrl:string, entityType:EntityTypeString, callback:(newEntity)=>void, initialState = {}):SubmitResult {
return async (dispatch, getState) => {
const rootState = getState();
dispatch(setSubmitted(true));
const JSONState = rootState.toJS();
Function validateBBIDsForCollectionAdd
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function validateBBIDsForCollectionAdd(req, res, next) {
const {Entity} = req.app.locals.orm;
const {bbids = []} = req.body;
if (!bbids.length) {
return next(new error.BadRequestError('BBIDs array is empty'));
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<Row>
<Col lg={{offset: 3, span: 6}}>
<form
Function saveEntitiesAndFinishRevision
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
orm, transacting, isNew: boolean, newRevision: any, mainEntity: any,
updatedEntities: any[], editorID: number, note: string
Function getChangedProps
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
orm, transacting, isNew, currentEntity, body, entityType,
newRevision, derivedProps
Function format
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function format(
change, setProp, itemProp, newSetFormatter, addDeleteFormatter,
modifyFormatter
) {
const setAdded =
- 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 reducer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function reducer(
state = Immutable.Map({
canEdit: true,
lastRelationships: null,
relationshipEditorProps: 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 render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
render() {
let messageComponent = null;
if (this.state.message.text) {
messageComponent = (
<div>
- 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 diffRevisionsWithParents
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function diffRevisionsWithParents(orm, entityRevisions, entityType) {
// entityRevisions - collection of *entityType*_revisions matching id
const promises = entityRevisions.map(
async (revision) => {
const dataId = revision.get('dataId');
- 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 handleAddToCollection
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
handleAddToCollection() {
const selectedEntities = this.state.selected;
if (selectedEntities.length) {
const areAllEntitiesOfSameType = selectedEntities.every(entity => entity.type === selectedEntities[0].type);
const entityTypes = ['Author', 'Edition', 'EditionGroup', 'Publisher', 'Series', 'Work'];
- 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 formatEntityChange
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function formatEntityChange(entity, change) {
const aliasChanged =
_.isEqual(change.path, ['aliasSet']) ||
_.isEqual(change.path.slice(0, 2), ['aliasSet', 'aliases']) ||
_.isEqual(change.path.slice(0, 2), ['aliasSet', 'defaultAlias']);
- 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 formatAuthorChange
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function formatAuthorChange(change) {
if (_.isEqual(change.path, ['beginDate'])) {
return baseFormatter.formatScalarChange(change, 'Begin 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"