bookbrainz/bookbrainz-site

View on GitHub

Showing 365 of 1,033 total issues

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