Showing 365 of 1,033 total issues
Function validateBBIDsForCollectionAdd
has a Cognitive Complexity of 9 (exceeds 5 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'));
- 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 getDefaultAliasIndex
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function getDefaultAliasIndex(aliasSet) {
if (_.isNil(aliasSet)) {
return null;
}
const {aliases, defaultAliasId} = aliasSet;
- 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 ContentTab
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function ContentTab({works, onChange, onModalClose, onModalOpen, onSeriesChange, series,
onAddSeriesItem, onSubmitWork, resetSeries, bulkAddSeriesItems, ...rest}:ContentTabProps) {
const [isChecked, setIsChecked] = React.useState(true);
const [copyToSeries, setCopyToSeries] = React.useState(false);
const toggleCheck = React.useCallback(() => {
- 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 ISODateStringToObject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function ISODateStringToObject(value: string | DateObject): DateObject {
if (!_.isString(value)) {
if (_.isPlainObject(value) && _.has(value, 'year')) {
return value;
}
- 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 EditionTableRow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function EditionTableRow({edition, showAddedAtColumn, showAuthorCreditsColumn, showCheckboxes, selectedEntities, onToggleRow}) {
const name = getEntityLabel(edition);
const disambiguation = getEntityDisambiguation(edition);
const number = edition.number || '?';
const releaseDate = getEditionReleaseDate(edition);
- 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 getBrowsedRelationships
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export async function getBrowsedRelationships(orm, locals, browsedEntityType,
getEntityInfoMethod, fetchRelated, filterRelationshipMethod) {
Function IdentifierButton
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function IdentifierButton({
identifiersInvalid,
numIdentifiers,
isUnifiedForm,
...props
- 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 formatEditionChange
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function formatEditionChange(change) {
if (_.isEqual(change.path, ['editionGroupBbid'])) {
return baseFormatter.formatScalarChange(change, 'EditionGroup');
}
- 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 renderBasicInfo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
renderBasicInfo() {
const {user, editor} = this.props;
const {
cachedMetabrainzName,
metabrainzUserId,
- 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 formatRelationship
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function formatRelationship(entity, change) {
if (change.kind === 'N') {
return formatAddOrDeleteRelationshipSet(entity, change);
}
if (change.kind === 'A') {
- 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 format
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
change, setProp, itemProp, newSetFormatter, addDeleteFormatter,
modifyFormatter
Function awardTitle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function awardTitle(orm, editorId, tier) {
const {TitleType, TitleUnlock} = orm;
if (tier.titleName) {
const title = await new TitleType({title: tier.titleName})
.fetch({require: false});
- 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 dateIsBefore
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function dateIsBefore(beginValue: string | DateObject, endValue: string | DateObject): boolean {
const beginDateObject = ISODateStringToObject(beginValue);
const endDateObject = ISODateStringToObject(endValue);
if (isNullDate(beginDateObject) || isNullDate(endDateObject) || !validateDate(beginDateObject).isValid ||
!validateDate(endDateObject).isValid) {
- 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 validateCollectionParams
has a Cognitive Complexity of 8 (exceeds 5 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;
- 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 validateEditionSectionPublisher
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function validateEditionSectionPublisher(value: any): boolean {
if (!value) {
return true;
}
const publishers = convertMapToObject(value);
- 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 processMergeOperation
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export async function processMergeOperation(orm, transacting, session, mainEntity, allEntities, relationshipSets) {
Function deleteRelationships
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function deleteRelationships(orm: any, transacting: Transaction, mainEntity: any) {
const mainBBID = mainEntity.bbid;
const {relationshipSet} = mainEntity;
const otherBBIDs = [];
const otherEntities = [];
- 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 CoverTab
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function CoverTab(props:CoverProps) {
const {publisherValue: publishers, onPublisherChange, identifierEditorVisible,
onClearPublisher, handleClearPublishers, modalIsOpen, ...rest} = props;
const publisherValue:EntitySelect[] = Object.values(convertMapToObject(publishers ?? {}));
const onChangeHandler = React.useCallback((value:EntitySelect[], action) => {
- 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 UnifiedForm
has a Cognitive Complexity of 8 (exceeds 5 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(() => {
- 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 SearchAdminPage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function SearchAdminPage() {
const [loading, setLoading] = useState(false);
const [errorMessage, setErrorMessage] = useState<string>();
const [success, setSuccess] = useState(false);
const indexEntity = useCallback(async (entityType?:string) => {
- 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"