bookbrainz/bookbrainz-site

View on GitHub

Showing 1,033 of 1,033 total issues

Function SeriesSection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function SeriesSection({
    entity,
    entityName,
    entityType,
    hideItemSelect,
Severity: Minor
Found in src/client/entity-editor/series-section/series-section.tsx - About 25 mins to fix

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'
Severity: Minor
Found in src/client/entity-editor/series-section/reducer.ts - About 25 mins to fix

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,
Severity: Minor
Found in src/server/helpers/utils.ts - About 25 mins to fix

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'));
    }
Severity: Minor
Found in src/server/helpers/middleware.ts - About 25 mins to fix

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
Severity: Minor
Found in src/server/routes/entity/process-unified-form.ts - About 25 mins to fix

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)) {
Severity: Minor
Found in src/server/routes/editor.tsx - About 25 mins to fix

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;
Severity: Minor
Found in src/client/entity-editor/identifier-editor/reducer.ts - About 25 mins to fix

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;
Severity: Minor
Found in src/client/entity-editor/validators/edition-group.ts - About 25 mins to fix

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 transformNewForm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function transformNewForm(data) {
    const aliases = entityRoutes.constructAliases(
        data.aliasEditor, data.nameSection
    );

Severity: Minor
Found in src/server/routes/entity/edition.ts - About 25 mins to fix

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;
Severity: Minor
Found in src/client/entity-editor/validators/edition.ts - About 25 mins to fix

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 MergeField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function MergeField({
    error,
    options,
    label,
    currentValue,
Severity: Minor
Found in src/client/entity-editor/common/merge-field.tsx - About 25 mins to fix

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 firstIndexOfUnbalancedParanthesis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function firstIndexOfUnbalancedParanthesis(url: string): number {
    let cnt = 0;
    for (let i = 0; i <= url.length; i++) {
        if (url[i] === '(') {
            cnt += 1;
Severity: Minor
Found in src/client/helpers/utils.tsx - About 25 mins to fix

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 handleChildEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    handleChildEvent(event) {
        event.stopPropagation();
        event.preventDefault();
        let url = null;
        const option = this.getSafeOptionValue(this.props.data);
Severity: Minor
Found in src/client/entity-editor/common/linked-entity.tsx - About 25 mins to fix

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

Severity
Category
Status
Source
Language