Showing 365 of 1,033 total issues
Function workToFormState
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function workToFormState(work) {
/** The front-end expects a language id rather than the language object. */
const aliases = work.aliasSet ?
work.aliasSet.aliases.map(({languageId, ...rest}) => ({
...rest,
- 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 checkConfigOverwrite
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function checkConfigOverwrite() {
const args = process.argv;
const configIndex = args.indexOf('--config');
// Check for '--config' followed by 'configPathFile'
- 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 generateEntityProps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function generateEntityProps(
entityType: string,
req: PassportRequest, res: $Response,
additionalProps: any,
initialStateCallback: (entity: any) => any = () => new Object()
- 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 loadSeriesItems
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function loadSeriesItems(req: $Request, res: $Response, next: NextFunction) {
try {
const {entity} = res.locals;
if (entity.dataId) {
const {relationships} = entity;
- 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 validateBBIDsForCollectionRemove
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function validateBBIDsForCollectionRemove(req, res, next) {
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 parseLanguages
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export async function parseLanguages(sourceEntitySection:Record<string, any>, orm):Promise<Record<string, any>> {
if (!sourceEntitySection) { return sourceEntitySection; }
const {Language} = orm;
const languages = [];
for (const langKey in sourceEntitySection) {
- 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 getValidOtherEntityTypes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getValidOtherEntityTypes(
relTypes: Array<RelationshipType>,
baseEntity: Entity
) {
let relationshipTypes = relTypes;
- 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 AuthorCreditRow
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function AuthorCreditRow({
index,
author,
joinPhrase,
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"
Further reading
Function getPrivsChanged
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getPrivsChanged(newPrivs: number, oldPrivs: number) {
const privsRemoved = [];
const privsAdded = [];
const totalBits = Object.keys(PrivilegeTypes).length;
- 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 7 (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) {
return 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 getEntityLabel
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function getEntityLabel(entity, returnHTML = true) {
if (entity.defaultAlias) {
return `${entity.defaultAlias.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"
Further reading
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return baseFormatter.formatScalarChange(
change, _.startCase(change.path[0])
);
Avoid too many return
statements within this function. Open
return formatChangedAnnotation(change);
Avoid too many return
statements within this function. Open
return {errorMessage: 'Month is not valid', isValid: false};
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return authorCreditFormatter.format(change);
Avoid too many return
statements within this function. Open
return baseFormatter.formatAreaChange(change, 'End Area');
Avoid too many return
statements within this function. Open
return baseFormatter.formatScalarChange(change, 'Page Count');
Avoid too many return
statements within this function. Open
return null;