Showing 365 of 1,033 total issues
Function getOrderedCollectionsForEditorPage
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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()
Function handleSubmit
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleSubmit(evt) {
evt.preventDefault();
if (!this.isValid()) {
this.setState({
errorText: 'Incomplete Form'
Function formatEntityChange
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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']);
Function entityDeletePromise
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const entityDeletePromise = bookshelf.transaction(async (transacting) => {
if (!body.note || !body.note.length) {
throw new error.FormSubmissionError('A revision note is required when deleting an entity');
}
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function render(props) {
if (props.author) {
// add initial ralationship with relationshipTypeId = 8 (<Work> is written by <Author>)
relationshipTypeId = RelationshipTypes.AuthorWroteWork;
addInitialRelationship(props, relationshipTypeId, initialRelationshipIndex++, props.author);
Function renderAboutUs
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderAboutUs() {
const disableSignUp = this.props.disableSignUp ? {disabled: true} : {};
return (
<React.Fragment>
<Row>
Function handleAddToCollection
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
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'];
Function RelationshipTypeMatrixPage
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function RelationshipTypeMatrixPage() {
return (
<Card>
<Card.Header as="h2">
Relationship Types
Function handleSubmit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async handleSubmit() {
const {privs, note} = this.state;
const oldPrivs = this.props.targetUser.privs;
if (privs === oldPrivs) {
return;
Function formatAddOrDeleteRelationshipSet
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function formatAddOrDeleteRelationshipSet(entity, change) {
const changes = [];
let allRelationships;
if (change.kind === 'N') {
allRelationships = change.rhs.relationships;
Function renderDocsDropdown
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderDocsDropdown() {
const docsDropdownTitle = (
<span>
<FontAwesomeIcon icon={faFileLines}/>
{' Docs'}
Function sortSeriesItems
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function sortSeriesItems(oldIndex, newIndex):any {
return (dispatch, getState) => {
const state = getState();
const seriesItems = state.get('seriesSection').get('seriesItems');
const orderTypeValue = state.get('seriesSection').get('orderType');
Function checkIfNameExists
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function checkIfNameExists(
name: string,
entityBBID: string,
entityType: string,
action: string | null | undefined
Function displayRevisions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function displayRevisions(
req: PassportRequest, res: $Response, next: NextFunction, RevisionModel: any
) {
const size = _.isString(req.query.size) ? parseInt(req.query.size, 10) : 20;
const from = _.isString(req.query.from) ? parseInt(req.query.from, 10) : 0;
Function handleSubmit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const handleSubmit = useCallback(async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (!isValid()) {
setErrorMsg('Error: Incomplete form! Select Entity Type.');
setTimeout(() => {
Function ISBNField
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ISBNField(props:ISBNProps) {
const {value, type, onChange, autoISBN, onAutoISBNChange} = props;
const onChangeHandler = React.useCallback((event:RInputEvent) => onChange(event.target.value, autoISBN), [onChange, autoISBN]);
const onAutoISBNChangeHandler = React.useCallback((event:RInputEvent) => {
onAutoISBNChange(event.target.checked);
Function getLast30DaysEntities
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function getLast30DaysEntities(orm) {
try {
const entityModels = commonUtils.getEntityModels(orm);
const countPromises = Object.keys(entityModels).map(async (modelName) => {
const model = entityModels[modelName];
Function ReviewCard
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ReviewCard(props) {
if (!props?.reviewData || _.isEmpty(props.reviewData)) {
return null;
}
const {reviewData} = props;
Function formatEditionChange
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function formatEditionChange(change) {
if (_.isEqual(change.path, ['editionGroupBbid'])) {
return baseFormatter.formatScalarChange(change, 'EditionGroup');
}
Function addInitialRelationship
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function addInitialRelationship(props, relationshipTypeId, relationshipIndex, targetEntity) {
// Prepend 'i' here to indicate initail relationship row identifier
const rowId = `i${relationshipIndex || 0}`;
const relationship = props.relationshipTypes.find(
relationshipType => relationshipType.id === relationshipTypeId