Showing 365 of 1,033 total issues
Avoid too many return
statements within this function. Open
return out.rowCount;
Avoid too many return
statements within this function. Open
return getConsecutiveDaysWithEdits(orm, editorId, 6);
Avoid too many return
statements within this function. Open
return 'Unnamed';
Function render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {baseUrl, sourceUrl, originalUrl, formBody} = this.props;
const formInputs = [];
for (const field in formBody) {
if (Object.hasOwnProperty.call(formBody, field)) {
- 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 EditionGroupTableRow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function EditionGroupTableRow({editionGroup, showAddedAtColumn, showCheckboxes, selectedEntities, onToggleRow}) {
const name = getEntityLabel(editionGroup);
const number = editionGroup.number || '?';
const disambiguation = getEntityDisambiguation(editionGroup);
const editionGroupType = editionGroup.editionGroupType ? editionGroup.editionGroupType.label : '?';
- 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 getEntityDiff
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static getEntityDiff(diff) {
let mergeBadge = null;
let deleteBadge = null;
if (diff.isDeletion) {
if (diff.entityRevision.isMerge) {
- 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 formatIdentifier
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function formatIdentifier(change) {
const identifierSetAdded =
change.kind === 'N' && _.isEqual(change.path, ['identifierSet']);
if (identifierSetAdded) {
return formatNewIdentifierSet(change);
- 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 handleSubmit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async handleSubmit() {
const {privs, note} = this.state;
const oldPrivs = this.props.targetUser.privs;
if (privs === oldPrivs) {
return;
- 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 getOrderedCollectionsForEditorPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export async function getOrderedCollectionsForEditorPage(from, size, entityType, req) {
const {Editor, UserCollection} = req.app.locals.orm;
// If editor isn't present, throw an error
await new Editor({id: req.params.id})
.fetch()
- 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 getInitState
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getInitState(
baseEntity: Entity, initRelationship: _Relationship | null | undefined
): RelationshipModalState {
if (_.isNull(initRelationship)) {
return {
- 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 seriesToFormState
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function seriesToFormState(series) {
const aliases = series.aliasSet ?
series.aliasSet.aliases.map(({languageId, ...rest}) => ({
...rest,
language: languageId
- 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 getCachedJSON
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export async function getCachedJSON<T>(cacheKey: string) {
if (redisClient.isReady) {
const cachedValue = await redisClient.get(cacheKey);
if (cachedValue) {
try {
- 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 SeriesSection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function SeriesSection({
entity,
entityName,
entityType,
hideItemSelect,
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
function reducer(
state: State = Immutable.Map({
orderType: 1,
seriesItems: Immutable.OrderedMap(),
seriesType: '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 parseInitialState
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export async function parseInitialState(req, type):Promise<Record<string, any>> {
const emptyState = {
nameSection: {
disambiguation: '',
exactMatches: 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 loadWikipediaExtract
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export async function loadWikipediaExtract(req: $Request, res: $Response, next: NextFunction) {
const {entity} = res.locals;
if (!entity) {
return next(new error.SiteError('Failed to load 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 preprocessForm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export async function preprocessForm(body:Record<string, any>, orm):Promise<Record<string, any>> {
async function processForm(currentForm) {
const {id, type} = currentForm;
const isNew = _.get(currentForm, '__isNew__', true);
// if new entity, no need to process further
- 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 getEditorActivity
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export async function getEditorActivity(editorId, startDate, Revision, endDate = Date.now()) {
if (!isValid(startDate)) {
throw new Error('Start date is invalid');
}
if (!isValid(endDate)) {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
function reducer(
state: State = Immutable.OrderedMap(),
action
) {
const {type, payload} = 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 validateForm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function validateForm(
formData: any, identifierTypes?: Array<_IdentifierType> | null | undefined,
isMerge?:boolean
): boolean {
let validAuthorCredit;
- 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"