BookBrainz/bookbrainz-site

View on GitHub

Showing 171 of 837 total issues

Function format has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    change, setProp, itemProp, newSetFormatter, addDeleteFormatter,
    modifyFormatter
Severity: Minor
Found in src/server/helpers/diffFormatters/set.js - About 45 mins to fix

    Function renderBasicInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        renderBasicInfo() {
            const {user, editor} = this.props;
            const {
                cachedMetabrainzName,
                metabrainzUserId,
    Severity: Minor
    Found in src/client/components/pages/parts/editor-profile.js - About 45 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 _bulkIndexEntities has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export async function _bulkIndexEntities(entities) {
        if (!entities.length) {
            return;
        }
    
    
    Severity: Minor
    Found in src/common/helpers/search.ts - About 45 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 SortNameField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function SortNameField({
        empty,
        error,
        onChange,
        storedNameValue,
    Severity: Minor
    Found in src/client/entity-editor/common/sort-name-field.tsx - About 45 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 CoverTab has a Cognitive Complexity of 8 (exceeds 5 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) => {
    Severity: Minor
    Found in src/client/unified-form/cover-tab/cover-tab.tsx - About 45 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 UnifiedForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function UnifiedForm(props:UnifiedFormProps) {
        const {allIdentifierTypes, validator, onSubmit, formValid,
            languageOptions, contentTabEmpty, coverTabValid, coverTabEmpty, detailTabValid, detailTabEmpty} = props;
        const rest = omit(props, ['contentTabEmpty', 'coverTabValid', 'coverTabEmpty', 'detailTabValid', 'formValid', 'detailTabEmpty']);
        React.useMemo(() => {
    Severity: Minor
    Found in src/client/unified-form/unified-form.tsx - About 45 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 getNextAnnotation has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        orm, transacting, currentEntity, body, revision
    Severity: Minor
    Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

      Function handleDelete has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          orm: any, req: PassportRequest, res: $Response, HeaderModel: any,
          RevisionModel: any
      Severity: Minor
      Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

        Function searchByName has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        export function searchByName(orm, name, type, size, from) {
        Severity: Minor
        Found in src/common/helpers/search.ts - About 35 mins to fix

          Function processEntitySets has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              orm: any,
              currentEntity: Record<string, unknown> | null | undefined,
              entityType: EntityTypeString,
              body: any,
              transacting: Transaction
          Severity: Minor
          Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

            Function getOrderedRevisionsForEntityPage has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            export async function getOrderedRevisionsForEntityPage(orm: any, from: number, size: number, RevisionModel, bbid: string) {
            Severity: Minor
            Found in src/server/helpers/revisions.ts - About 35 mins to fix

              Function generateEntityProps has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  entityType: string,
                  req: PassportRequest, res: $Response,
                  additionalProps: any,
                  initialStateCallback: (entity: any) => any = () => new Object()
              Severity: Minor
              Found in src/server/helpers/entityRouteUtils.tsx - About 35 mins to fix

                Function _createNote has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function _createNote(orm, content, editorID, revision, transacting) {
                Severity: Minor
                Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

                  Function handleCreateOrEditEntity has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      req: PassportRequest,
                      res: $Response,
                      entityType: EntityTypeString,
                      derivedProps: Record<string, unknown>,
                      isMergeOperation: boolean
                  Severity: Minor
                  Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

                    Function searchOption has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    export async function searchOption(orm, type:string, query:string, idKey = 'id', exactMatch = false):Promise<{
                    Severity: Minor
                    Found in src/server/helpers/utils.ts - About 35 mins to fix

                      Function fetchOrCreateMainEntity has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          orm, transacting, isNew, bbid, entityType
                      Severity: Minor
                      Found in src/server/routes/entity/entity.tsx - About 35 mins to fix

                        Function generateRel has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function generateRel(workEntity, seriesEntity, attributeSetId?, isAdded = false, isRemoved = false) {
                        Severity: Minor
                        Found in src/client/unified-form/content-tab/content-tab.tsx - About 35 mins to fix

                          Function getValidOtherEntityTypes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function getValidOtherEntityTypes(
                              relTypes: Array<RelationshipType>,
                              baseEntity: Entity
                          ) {
                              let relationshipTypes = relTypes;
                          Severity: Minor
                          Found in src/client/entity-editor/relationship-editor/relationship-editor.tsx - About 35 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 PublisherTableRow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function PublisherTableRow({showAddedAtColumn, publisher, showCheckboxes, selectedEntities, onToggleRow}) {
                              const name = getEntityLabel(publisher);
                              const number = publisher.number || '?';
                              const disambiguation = getEntityDisambiguation(publisher);
                              const publisherType = publisher.publisherType ? publisher.publisherType.label : '?';
                          Severity: Minor
                          Found in src/client/components/pages/entities/publisher-table.js - About 35 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              render() {
                                  let reviewContent;
                                  const mapEntityType = {
                                      Author: 'author',
                                      EditionGroup: 'edition-group',
                          Severity: Minor
                          Found in src/client/components/pages/entities/cb-review.js - About 35 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