bookbrainz/bookbrainz-site

View on GitHub
src/client/containers/layout.js

Summary

Maintainability
F
3 days
Test Coverage

Function renderLoggedInDropdown has 147 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    renderLoggedInDropdown() {
        const {user} = this.props;

        const createDropdownTitle = (
            <span>
Severity: Major
Found in src/client/containers/layout.js - About 5 hrs to fix

    File layout.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright (C) 2018  Theodore Fabian Rudy
     *                  2016  Daniel Hsing
     *                  2016  Ben Ockmore
     *                  2016  Sean Burke
    Severity: Minor
    Found in src/client/containers/layout.js - About 5 hrs to fix

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

          render() {
              const {
                  homepage,
                  siteRevision,
                  repositoryUrl,
      Severity: Major
      Found in src/client/containers/layout.js - About 2 hrs to fix

        Function renderNavContent has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            renderNavContent() {
                const {homepage, hideSearch, user} = this.props;
        
                /*
                 * GOTCHA: Usage of react-bootstrap FormGroup component inside
        Severity: Minor
        Found in src/client/containers/layout.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

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

                            <Nav>
                                <Nav.Item>
                                    <Nav.Link href="/statistics">
                                        <FontAwesomeIcon icon={faChartLine}/>
                                        {' Statistics '}
            Severity: Major
            Found in src/client/containers/layout.js and 1 other location - About 2 hrs to fix
            src/client/containers/layout.js on lines 351..358

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

            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

                            <Nav>
                                <Nav.Item>
                                    <Nav.Link href="/collections">
                                        <FontAwesomeIcon icon={faGripVertical}/>
                                        {' Collections '}
            Severity: Major
            Found in src/client/containers/layout.js and 1 other location - About 2 hrs to fix
            src/client/containers/layout.js on lines 359..366

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

            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

                                <NavDropdown.Item href={`/editor/${user.id}`}>
                                    <FontAwesomeIcon fixedWidth icon={faUserCircle}/>
                                    {' Profile'}
                                </NavDropdown.Item>
            Severity: Major
            Found in src/client/containers/layout.js and 3 other locations - About 1 hr to fix
            src/client/containers/layout.js on lines 286..289
            src/client/containers/layout.js on lines 290..293
            src/client/containers/layout.js on lines 294..297

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

                                <NavDropdown.Item href={`/editor/${user.id}/collections`}>
                                    <FontAwesomeIcon fixedWidth icon={faGripVertical}/>
                                    {' Collections'}
                                </NavDropdown.Item>
            Severity: Major
            Found in src/client/containers/layout.js and 3 other locations - About 1 hr to fix
            src/client/containers/layout.js on lines 282..285
            src/client/containers/layout.js on lines 286..289
            src/client/containers/layout.js on lines 290..293

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

                                <NavDropdown.Item href={`/editor/${user.id}/achievements`}>
                                    <FontAwesomeIcon fixedWidth icon={faTrophy}/>
                                    {' Achievements'}
                                </NavDropdown.Item>
            Severity: Major
            Found in src/client/containers/layout.js and 3 other locations - About 1 hr to fix
            src/client/containers/layout.js on lines 282..285
            src/client/containers/layout.js on lines 286..289
            src/client/containers/layout.js on lines 294..297

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

                                <NavDropdown.Item href={`/editor/${user.id}/revisions`}>
                                    <FontAwesomeIcon fixedWidth icon={faListUl}/>
                                    {' Revisions'}
                                </NavDropdown.Item>
            Severity: Major
            Found in src/client/containers/layout.js and 3 other locations - About 1 hr to fix
            src/client/containers/layout.js on lines 282..285
            src/client/containers/layout.js on lines 290..293
            src/client/containers/layout.js on lines 294..297

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

                            <NavDropdown.Item href="/search-admin">
                                <FontAwesomeIcon fixedWidth className="margin-right-0-3" icon={faSearchengin}/>
                                Search Admin
                            </NavDropdown.Item>
            Severity: Minor
            Found in src/client/containers/layout.js and 2 other locations - About 40 mins to fix
            src/client/containers/layout.js on lines 178..181
            src/client/containers/layout.js on lines 182..185

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

            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

                            <NavDropdown.Item href="/admin-panel">
                                <FontAwesomeIcon fixedWidth className="margin-right-0-3" icon={faUserGear}/>
                                Admin Panel
                            </NavDropdown.Item>
            Severity: Minor
            Found in src/client/containers/layout.js and 2 other locations - About 40 mins to fix
            src/client/containers/layout.js on lines 182..185
            src/client/containers/layout.js on lines 200..203

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

            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

                            <NavDropdown.Item href="/admin-logs">
                                <FontAwesomeIcon fixedWidth className="margin-right-0-3" icon={faNewspaper}/>
                                Admin Logs
                            </NavDropdown.Item>
            Severity: Minor
            Found in src/client/containers/layout.js and 2 other locations - About 40 mins to fix
            src/client/containers/layout.js on lines 178..181
            src/client/containers/layout.js on lines 200..203

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

            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

            const {Alert, Button, Form, FormControl, InputGroup, Nav, Navbar, NavDropdown} = bootstrap;
            Severity: Minor
            Found in src/client/containers/layout.js and 1 other location - About 40 mins to fix
            src/client/components/forms/deletion.js on lines 30..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 48.

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

                                <NavDropdown.Item href="/help">
                                    <FontAwesomeIcon fixedWidth icon={faQuestionCircle}/>
                                    {' Help '}
                                </NavDropdown.Item>
            Severity: Major
            Found in src/client/containers/layout.js and 4 other locations - About 35 mins to fix
            src/client/containers/layout.js on lines 117..120
            src/client/containers/layout.js on lines 121..124
            src/client/containers/layout.js on lines 125..128
            src/client/containers/layout.js on lines 298..301

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

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

                                <NavDropdown.Item href="/external-service/">
                                    <FontAwesomeIcon fixedWidth icon={faLink}/>
                                    {' External Services'}
                                </NavDropdown.Item>
            Severity: Major
            Found in src/client/containers/layout.js and 4 other locations - About 35 mins to fix
            src/client/containers/layout.js on lines 113..116
            src/client/containers/layout.js on lines 117..120
            src/client/containers/layout.js on lines 121..124
            src/client/containers/layout.js on lines 125..128

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

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

                                <NavDropdown.Item href="/identifier-types">
                                    <FontAwesomeIcon fixedWidth icon={faBarcode}/>
                                    {' Identifier Types '}
                                </NavDropdown.Item>
            Severity: Major
            Found in src/client/containers/layout.js and 4 other locations - About 35 mins to fix
            src/client/containers/layout.js on lines 113..116
            src/client/containers/layout.js on lines 117..120
            src/client/containers/layout.js on lines 121..124
            src/client/containers/layout.js on lines 298..301

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

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

                                <NavDropdown.Item href="/relationship-types">
                                    <FontAwesomeIcon fixedWidth icon={faLink}/>
                                    {' Relationship Types '}
                                </NavDropdown.Item>
            Severity: Major
            Found in src/client/containers/layout.js and 4 other locations - About 35 mins to fix
            src/client/containers/layout.js on lines 113..116
            src/client/containers/layout.js on lines 117..120
            src/client/containers/layout.js on lines 125..128
            src/client/containers/layout.js on lines 298..301

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

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

                                <NavDropdown.Item href="/faq">
                                    <FontAwesomeIcon fixedWidth icon={faClipboardQuestion}/>
                                    {' FAQs '}
                                </NavDropdown.Item>
            Severity: Major
            Found in src/client/containers/layout.js and 4 other locations - About 35 mins to fix
            src/client/containers/layout.js on lines 113..116
            src/client/containers/layout.js on lines 121..124
            src/client/containers/layout.js on lines 125..128
            src/client/containers/layout.js on lines 298..301

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

            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

            There are no issues that match your filters.

            Category
            Status