bookbrainz/bookbrainz-site

View on GitHub

Showing 1,033 of 1,033 total issues

Function handleSubmit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    handleSubmit(event) {
        const {note} = this.state;
        event.preventDefault();

        if (!note || !note.length) {
Severity: Minor
Found in src/client/components/forms/deletion.js - About 1 hr to fix

    Function saveEntitiesAndFinishRevision has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export async function saveEntitiesAndFinishRevision(
        orm, transacting, isNew: boolean, newRevision: any, mainEntity: any,
        updatedEntities: any[], editorID: number, note: string
    ) {
        const parentRevisionIDs = _.compact(_.uniq(updatedEntities.map(
    Severity: Minor
    Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

      Function refreshAccessToken has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function refreshAccessToken(
          editorId: number,
          refreshToken: string,
          orm: Record<string, any>
      ): Promise<any> {
      Severity: Minor
      Found in src/server/helpers/critiquebrainz.ts - About 1 hr to fix

        Function transformNewForm has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function transformNewForm(data) {
            const aliases = entityRoutes.constructAliases(
                data.aliasEditor, data.nameSection
            );
        
        
        Severity: Minor
        Found in src/server/routes/entity/author.ts - About 1 hr to fix

          Function submit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function submit(
              submissionUrl: string,
              isUnifiedForm = false
          ): SubmitResult {
              return (dispatch, getState) => {
          Severity: Minor
          Found in src/client/entity-editor/submission-section/actions.ts - About 1 hr to fix

            Function validateCollectionParams has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function validateCollectionParams(req, res, next) {
                const {collaborators = [], name, entityType} = req.body;
                const {orm} = req.app.locals;
                const {Editor} = orm;
            
            
            Severity: Minor
            Found in src/server/helpers/middleware.ts - About 1 hr to fix

              Function loadSeriesItems has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function loadSeriesItems(req: $Request, res: $Response, next: NextFunction) {
                  try {
                      const {entity} = res.locals;
                      if (entity.dataId) {
                          const {relationships} = entity;
              Severity: Minor
              Found in src/server/helpers/middleware.ts - About 1 hr to fix

                Function submitSingleEntity has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function submitSingleEntity(submissionUrl:string, entityType:EntityTypeString, callback:(newEntity)=>void, initialState = {}):SubmitResult {
                    return async (dispatch, getState) => {
                        const rootState = getState();
                        dispatch(setSubmitted(true));
                        const JSONState = rootState.toJS();
                Severity: Minor
                Found in src/client/entity-editor/submission-section/actions.ts - About 1 hr to fix

                  Function validateBBIDsForCollectionAdd has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function validateBBIDsForCollectionAdd(req, res, next) {
                      const {Entity} = req.app.locals.orm;
                      const {bbids = []} = req.body;
                      if (!bbids.length) {
                          return next(new error.BadRequestError('BBIDs array is empty'));
                  Severity: Minor
                  Found in src/server/helpers/middleware.ts - About 1 hr to fix

                    Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        render() {
                            return (
                                <Row>
                                    <Col lg={{offset: 3, span: 6}}>
                                        <form
                    Severity: Minor
                    Found in src/client/components/pages/parts/admin-panel-search-field.tsx - About 1 hr to fix

                      Function saveEntitiesAndFinishRevision has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          orm, transacting, isNew: boolean, newRevision: any, mainEntity: any,
                          updatedEntities: any[], editorID: number, note: string
                      Severity: Major
                      Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

                        Function getChangedProps has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            orm, transacting, isNew, currentEntity, body, entityType,
                            newRevision, derivedProps
                        Severity: Major
                        Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

                          Similar blocks of code found in 3 locations. Consider refactoring.
                          Open

                          function formatNewLanguageSet(change) {
                              function transformer(rhs) {
                                  return rhs.languages.map((language) => language.name);
                              }
                          
                          
                          Severity: Major
                          Found in src/server/helpers/diffFormatters/languageSet.js and 2 other locations - About 1 hr to fix
                          src/server/helpers/diffFormatters/publisherSet.js on lines 22..30
                          src/server/helpers/diffFormatters/releaseEventSet.js on lines 22..30

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 3 locations. Consider refactoring.
                          Open

                          function formatNewPublisherSet(change) {
                              function transformer(rhs) {
                                  return rhs.publishers.map((publisher) => publisher.bbid);
                              }
                          
                          
                          Severity: Major
                          Found in src/server/helpers/diffFormatters/publisherSet.js and 2 other locations - About 1 hr to fix
                          src/server/helpers/diffFormatters/languageSet.js on lines 23..31
                          src/server/helpers/diffFormatters/releaseEventSet.js on lines 22..30

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                          const server = app.listen(app.get('port'), () => {
                              debug(`Express server listening on port ${server.address().port}`);
                          });
                          Severity: Major
                          Found in src/api/app.js and 1 other location - About 1 hr to fix
                          src/server/app.js on lines 175..177

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                          const server = app.listen(app.get('port'), () => {
                              debug(`Express server listening on port ${server.address().port}`);
                          });
                          Severity: Major
                          Found in src/server/app.js and 1 other location - About 1 hr to fix
                          src/api/app.js on lines 75..77

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 3 locations. Consider refactoring.
                          Open

                          function formatNewReleaseEventSet(change) {
                              function transformer(rhs) {
                                  return rhs.releaseEvents.map((releaseEvent) => releaseEvent.date);
                              }
                          
                          
                          Severity: Major
                          Found in src/server/helpers/diffFormatters/releaseEventSet.js and 2 other locations - About 1 hr to fix
                          src/server/helpers/diffFormatters/languageSet.js on lines 23..31
                          src/server/helpers/diffFormatters/publisherSet.js on lines 22..30

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 8 locations. Consider refactoring.
                          Open

                                              <Button onClick={() => { indexEntity('Work'); }}>
                                                  <FontAwesomeIcon
                                                      icon={ENTITY_TYPE_ICONS.Work}
                                                      size="2x"
                                                  />
                          Severity: Major
                          Found in src/client/components/pages/searchAdmin.tsx and 7 other locations - About 1 hr to fix
                          src/client/components/pages/searchAdmin.tsx on lines 51..56
                          src/client/components/pages/searchAdmin.tsx on lines 64..69
                          src/client/components/pages/searchAdmin.tsx on lines 70..75
                          src/client/components/pages/searchAdmin.tsx on lines 76..81
                          src/client/components/pages/searchAdmin.tsx on lines 82..87
                          src/client/components/pages/searchAdmin.tsx on lines 88..93
                          src/client/components/pages/searchAdmin.tsx on lines 94..99

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                          export function debouncedUpdateWidth(value: number | null | undefined): Action {
                              return {
                                  meta: {debounce: 'keystroke'},
                                  payload: value,
                                  type: UPDATE_WIDTH
                          Severity: Major
                          Found in src/client/entity-editor/edition-section/actions.ts and 3 other locations - About 1 hr to fix
                          src/client/entity-editor/edition-section/actions.ts on lines 210..216
                          src/client/entity-editor/edition-section/actions.ts on lines 226..232
                          src/client/entity-editor/edition-section/actions.ts on lines 258..264

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 4 locations. Consider refactoring.
                          Open

                          export function debouncedUpdateHeight(value: number | null | undefined): Action {
                              return {
                                  meta: {debounce: 'keystroke'},
                                  payload: value,
                                  type: UPDATE_HEIGHT
                          Severity: Major
                          Found in src/client/entity-editor/edition-section/actions.ts and 3 other locations - About 1 hr to fix
                          src/client/entity-editor/edition-section/actions.ts on lines 210..216
                          src/client/entity-editor/edition-section/actions.ts on lines 226..232
                          src/client/entity-editor/edition-section/actions.ts on lines 242..248

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 55.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language