Showing 365 of 1,033 total issues
Function CoverTab
has 39 lines of code (exceeds 25 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) => {
Function render
has 38 lines of code (exceeds 25 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)) {
Function makeEntityLoader
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function makeEntityLoader(modelName: string, additionalRels: Array<string>, errMessage: string) {
const relations = [
'aliasSet.aliases.language',
'annotation.lastRevision',
'defaultAlias',
Function mapDispatchToProps
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mapDispatchToProps(dispatch):ISBNDispatchProps {
let autoAddedISBN:dispatchResultProps|null;
function onChange(value:string, autoISBN = false) {
const isbn10rgx = new
RegExp('^(?:ISBN(?:-10)?:?●)?(?=[0-9X]{10}$|(?=(?:[0-9]+[-●]){3})[-●0-9X]{13}$)[0-9]{1,5}[-●]?[0-9]+[-●]?[0-9]+[-●]?[0-9X]$');
Function handleAddToCollection
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
async handleAddToCollection() {
const {bbids} = this.props;
const {selectedCollections} = this.state;
if (selectedCollections.length) {
try {
Function formatChange
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
static formatChange(change) {
const isChangeADate = change.key.toLowerCase().match(/\bdate\b/);
if (change.kind === 'N') {
return (
<tr className="table-success" key={change.key}>
Function renderContent
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderContent() {
return (
<Container>
<Row>
<Col lg={{offset: 2, span: 8}}>
Function ErrorPage
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ErrorPage(props) {
const {error} = props;
let {detailedMessage} = error;
if (typeof detailedMessage === 'string') {
Function fetchOptions
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
async fetchOptions(query) {
if (!query) {
return {
options: []
};
Function getChangedProps
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function getChangedProps(
orm, transacting, isNew, currentEntity, body, entityType,
newRevision, derivedProps
) {
const aliasSetPromise =
Function parseInitialState
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function parseInitialState(req, type):Promise<Record<string, any>> {
const emptyState = {
nameSection: {
disambiguation: '',
exactMatches: null,
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const hasPermissions = this.accessToken !== null;
const modalBody = this.getModalBody(hasPermissions);
const modalFooter = this.getModalFooter(hasPermissions);
Function renderNavContent
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderNavContent() {
const {homepage, hideSearch, user} = this.props;
/*
* GOTCHA: Usage of react-bootstrap FormGroup component inside
Function reducer
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function reducer(
state: State = Immutable.OrderedMap(),
action
) {
const {type, payload} = action;
Function submitReviewToCB
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function submitReviewToCB(
accessToken: string,
review: Record<string, any>
): Promise<any> {
const cbEntityType = mapEntityType[review.entityType];
Function testTiers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async function testTiers(orm, signal, editorId, tiers) {
const tierPromise = tiers.map(async (tier) => {
if (signal >= tier.threshold) {
try {
const achievementUnlock = await awardAchievement(orm, editorId, tier.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 handleCreateMultipleEntities
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export async function handleCreateMultipleEntities(
req: PassportRequest,
res: $Response
) {
const {orm}: {orm?: any} = req.app.locals;
- 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 getAssociatedEntityRevisions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export async function getAssociatedEntityRevisions(revisions, orm) {
const revisionIDs = revisions.map(({revisionId}) => revisionId);
const RevisionModels = getRevisionModels(orm);
const {Entity} = orm;
for (let i = 0; i < RevisionModels.length; i++) {
- 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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export async function processMergeOperation(orm, transacting, session, mainEntity, allEntities, relationshipSets) {
const {Edition, bookshelf} = orm;
const {mergingEntities} = session.mergeQueue;
if (!mergingEntities) {
throw new Error('Merge handler called with no merge queue, aborting');
- 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 constructPrivsChangeStatement
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function constructPrivsChangeStatement(logData: AdminLogDataT) {
const {newPrivs, oldPrivs, targetUserId, targetUser, adminId, admin} = logData;
const {privsAdded, privsRemoved} = getPrivsChanged(newPrivs, oldPrivs);
let grantStatement = '';
- 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"