Showing 365 of 1,033 total issues
Function CallToAction
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CallToAction(props) {
const seedingParameters = new URLSearchParams({name: props.query});
function renderEntityLink(type) {
return (
<a href={`/${camelCase(type)}/create?${seedingParameters}`}>
Function createRootReducer
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createRootReducer() {
return (state: Immutable.Map<string, any>, action) => {
// first pass the state to our cross slice reducer to handle UF specific actions.
const intermediateState = crossSliceReducer(state, action);
return combineReducers({
Function results
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const results = this.props.results.map((result) => {
if (!result) {
return null;
}
const name = result.defaultAlias ? result.defaultAlias.name :
Function mapDispatchToProps
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mapDispatchToProps(dispatch: Dispatch<Action>): DispatchProps {
return {
onAuthorCreditChange: (selectedAuthorCredit:AuthorCredit) => {
dispatch(updateAuthorCredit(selectedAuthorCredit));
},
Function fetchOptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async fetchOptions(query) {
if (!query) {
return {
options: []
};
- 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 collectionCreateOrEditHandler
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export async function collectionCreateOrEditHandler(req, res, next) {
try {
const {UserCollection, UserCollectionCollaborator} = req.app.locals.orm;
const isNew = !res.locals.collection;
let newCollection;
- 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 editionGroupToFormState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function editionGroupToFormState(editionGroup) {
/** The front-end expects a language id rather than the language object. */
const aliases = editionGroup.aliasSet ?
editionGroup.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 crossSliceReducer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function crossSliceReducer(state:State, action:Action) {
const {type} = action;
let intermediateState = state;
const activeEntityState = {
aliasEditor: state.get('aliasEditor'),
- 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 unflatten
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function unflatten(flattenObj) {
const result = {};
let cur;
let prop;
let parts;
- 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 displayEntity
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function displayEntity(req: PassportRequest, res: $Response) {
const {orm}: {orm?: any} = req.app.locals;
const {AchievementUnlock, EditorEntityVisits} = orm;
const {locals: resLocals}: {locals: any} = res;
const {entity}: {entity: any} = resLocals;
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export async function getBrowsedRelationships(orm, locals, browsedEntityType,
getEntityInfoMethod, fetchRelated, filterRelationshipMethod) {
const {entity, relationships} = locals;
if (!relationships.length > 0) {
- 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 mapDispatchToProps
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function mapDispatchToProps(dispatch: Dispatch<Action>): DispatchProps {
return {
onAuthorCreditChange: (selectedAuthorCredit:AuthorCredit) => {
dispatch(updateAuthorCredit(selectedAuthorCredit));
},
- 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 dateObjectToISOString
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function dateObjectToISOString(value: DateObject) {
if (_.isNil(value) || isNullDate(value)) {
return null;
}
// if year is missing or not a number, return invalid date
- 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 triggerSearch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
triggerSearch(newFrom = this.state.from, newSize = this.state.size) {
const searchParams = new URLSearchParams(this.props.querySearchParams);
searchParams.set('size', newSize);
searchParams.set('from', newFrom);
const newSearchParamsString = `?${searchParams.toString()}`;
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div id="pageWithPagination">
<CollectionsTable
entityTypes={this.props.entityTypes}
Function testTiers
has 27 lines of code (exceeds 25 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);
Function renderRelationship
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderRelationship(relationship: Relationship) {
const inputsInvalid =
!relationship.source || !relationship.target ||
!isString(get(relationship, 'type.linkPhrase'));
if (inputsInvalid) {
Function fetchAccessToken
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function fetchAccessToken(
code: string,
editorId: number,
orm: Record<string, any>
) : Promise<any> {
Function handleSubmit
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleSubmit = useCallback(async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (!isValid()) {
setShowIncompleteFormError(true);
return;
Function transformISODateForDisplay
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function transformISODateForDisplay(ISODateString) {
if (_isNil(ISODateString)) {
return ISODateString;
}
const dateStringWithoutSign = ISODateString.slice(1);