bookbrainz/bookbrainz-site

View on GitHub

Showing 1,033 of 1,033 total issues

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

function mapDispatchToProps(dispatch, {submissionUrl}) {
    return {
        onSubmit: (event:React.FormEvent) => {
            event.preventDefault();
            dispatch(submit(submissionUrl));
Severity: Major
Found in src/client/entity-editor/entity-merge.tsx and 1 other location - About 1 hr to fix
src/client/entity-editor/entity-editor.tsx on lines 130..137

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 62.

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

function mapDispatchToProps(dispatch, {submissionUrl}) {
    return {
        onSubmit: (event:React.FormEvent) => {
            event.preventDefault();
            dispatch(submit(submissionUrl));
Severity: Major
Found in src/client/entity-editor/entity-editor.tsx and 1 other location - About 1 hr to fix
src/client/entity-editor/entity-merge.tsx on lines 163..170

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 62.

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 2 locations. Consider refactoring.
Open

                            <Button
                                className="btn btn-sm margin-left-d10"
                                value={relType.id}
                                variant="link"
                                onClick={handleClick}
src/client/components/pages/parts/identifier-types-tree.tsx on lines 61..68

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 62.

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 2 locations. Consider refactoring.
Open

        res.send(target({
            markup,
            page: 'revisions',
            props: escapeProps(props),
            script: '/js/editor/editor.js',
Severity: Major
Found in src/server/routes/editor.tsx and 1 other location - About 1 hr to fix
src/server/routes/editor.tsx on lines 683..689

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 62.

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 2 locations. Consider refactoring.
Open

                                                <Button
                                                    href="#"
                                                    role="button"
                                                    variant="danger"
                                                    onClick={handleRemoveParent}
Severity: Major
Found in src/client/components/forms/type-editor/identifier-type.tsx and 1 other location - About 1 hr to fix
src/client/components/forms/type-editor/identifier-type.tsx on lines 324..332

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 62.

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 2 locations. Consider refactoring.
Open

            aliases: _.get(entity, 'aliasSet.aliases', []).map((alias) => ({
                language: _.get(alias, 'language.isoCode3', null),
                name: _.get(alias, 'name', null),
                primary: _.get(alias, 'primary', null),
                sortName: _.get(alias, 'sortName', null)
Severity: Major
Found in src/api/helpers/formatEntityData.ts and 1 other location - About 1 hr to fix
src/api/helpers/formatEntityData.ts on lines 39..44

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 62.

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 2 locations. Consider refactoring.
Open

        res.send(target({
            markup,
            page: 'collections',
            props: escapeProps(props),
            script: '/js/editor/editor.js',
Severity: Major
Found in src/server/routes/editor.tsx and 1 other location - About 1 hr to fix
src/server/routes/editor.tsx on lines 401..407

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 62.

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 2 locations. Consider refactoring.
Open

                            <Button
                                className="btn btn-sm margin-left-d10"
                                value={idenType.id}
                                variant="link"
                                onClick={handleClick}
Severity: Major
Found in src/client/components/pages/parts/identifier-types-tree.tsx and 1 other location - About 1 hr to fix
src/client/components/pages/parts/relationship-types-tree.tsx on lines 66..73

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 62.

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 2 locations. Consider refactoring.
Open

                                                <Button
                                                    href="#"
                                                    role="button"
                                                    variant="warning"
                                                    onClick={handleEditParent}
Severity: Major
Found in src/client/components/forms/type-editor/identifier-type.tsx and 1 other location - About 1 hr to fix
src/client/components/forms/type-editor/identifier-type.tsx on lines 333..341

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 62.

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 2 locations. Consider refactoring.
Open

    return {
        language: _.get(entity, 'defaultAlias.language.isoCode3', null),
        name: _.get(entity, 'defaultAlias.name', null),
        primary: _.get(entity, 'defaultAlias.primary', null),
        sortName: _.get(entity, 'defaultAlias.sortName', null)
Severity: Major
Found in src/api/helpers/formatEntityData.ts and 1 other location - About 1 hr to fix
src/api/helpers/formatEntityData.ts on lines 336..341

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 62.

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 2 locations. Consider refactoring.
Open

export function ContentTab({works, onChange, onModalClose, onModalOpen, onSeriesChange, series,
     onAddSeriesItem, onSubmitWork, resetSeries, bulkAddSeriesItems, ...rest}:ContentTabProps) {
    const [isChecked, setIsChecked] = React.useState(true);
    const [copyToSeries, setCopyToSeries] = React.useState(false);
    const toggleCheck = React.useCallback(() => {
Severity: Major
Found in src/client/unified-form/content-tab/content-tab.tsx and 1 other location - About 1 hr to fix
src/client/entity-editor/author-credit-editor/author-credit-row.tsx on lines 82..159

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 62.

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 2 locations. Consider refactoring.
Open

function AuthorCreditRow({
    index,
    author,
    joinPhrase,
    name,
src/client/unified-form/content-tab/content-tab.tsx on lines 50..225

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 62.

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

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

    async handleSubmit() {
        const {privs, note} = this.state;
        const oldPrivs = this.props.targetUser.privs;
        if (privs === oldPrivs) {
            return;
Severity: Minor
Found in src/client/components/pages/parts/privs-edit-modal.js - About 1 hr to fix

    Function formatAddOrDeleteRelationshipSet has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function formatAddOrDeleteRelationshipSet(entity, change) {
        const changes = [];
        let allRelationships;
        if (change.kind === 'N') {
            allRelationships = change.rhs.relationships;
    Severity: Minor
    Found in src/server/helpers/diffFormatters/entity.js - About 1 hr to fix

      Function renderDocsDropdown has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          renderDocsDropdown() {
              const docsDropdownTitle = (
                  <span>
                      <FontAwesomeIcon icon={faFileLines}/>
                      {'  Docs'}
      Severity: Minor
      Found in src/client/containers/layout.js - About 1 hr to fix

        Function sortSeriesItems has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function sortSeriesItems(oldIndex, newIndex):any {
            return (dispatch, getState) => {
                const state = getState();
                const seriesItems = state.get('seriesSection').get('seriesItems');
                const orderTypeValue = state.get('seriesSection').get('orderType');
        Severity: Minor
        Found in src/client/entity-editor/series-section/actions.ts - About 1 hr to fix

          Function checkIfNameExists has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function checkIfNameExists(
              name: string,
              entityBBID: string,
              entityType: string,
              action: string | null | undefined
          Severity: Minor
          Found in src/client/entity-editor/name-section/actions.ts - About 1 hr to fix

            Function displayRevisions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function displayRevisions(
                req: PassportRequest, res: $Response, next: NextFunction, RevisionModel: any
            ) {
                const size = _.isString(req.query.size) ? parseInt(req.query.size, 10) : 20;
                const from = _.isString(req.query.from) ? parseInt(req.query.from, 10) : 0;
            Severity: Minor
            Found in src/server/routes/entity/entity.tsx - About 1 hr to fix

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

                  const handleSubmit = useCallback(async (event: FormEvent<HTMLFormElement>) => {
                      event.preventDefault();
                      if (!isValid()) {
                          setErrorMsg('Error: Incomplete form! Select Entity Type.');
                          setTimeout(() => {
              Severity: Minor
              Found in src/client/components/forms/type-editor/identifier-type.tsx - About 1 hr to fix

                Function ISBNField has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function ISBNField(props:ISBNProps) {
                    const {value, type, onChange, autoISBN, onAutoISBNChange} = props;
                    const onChangeHandler = React.useCallback((event:RInputEvent) => onChange(event.target.value, autoISBN), [onChange, autoISBN]);
                    const onAutoISBNChangeHandler = React.useCallback((event:RInputEvent) => {
                        onAutoISBNChange(event.target.checked);
                Severity: Minor
                Found in src/client/unified-form/cover-tab/isbn-field.tsx - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language