jeresig/pharos-images

View on GitHub
views/Admin.jsx

Summary

Maintainability
D
2 days
Test Coverage

Function renderUploadImagesForm has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    renderUploadImagesForm() {
        return <div className="panel panel-default">
            <div className="panel-heading">
                <h3 className="panel-title">
                    {this.props.gettext("Upload Images")}
Severity: Minor
Found in views/Admin.jsx - About 1 hr to fix

    Function renderDataImport has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        renderDataImport(batch) {
            const results = batch.getFilteredResults();
            let columns;
    
            if (batch.state === "error") {
    Severity: Minor
    Found in views/Admin.jsx - About 1 hr to fix

      Function renderUploadDataFormContents has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          renderUploadDataFormContents() {
              const files = this.props.source.getExpectedFiles();
              const imagesImported = this.props.imageImport.some((batch) =>
                  batch.state === "completed");
      
      
      Severity: Minor
      Found in views/Admin.jsx - About 1 hr to fix

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

                return <tr key={batch._id}>
                    <td><a href={this.props.URL(batch)}>{batch.fileName}</a></td>
                    <td>{this.props.relativeDate(batch.modified)}</td>
                    {columns}
                </tr>;
        Severity: Major
        Found in views/Admin.jsx and 1 other location - About 3 hrs to fix
        views/Admin.jsx on lines 116..120

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

        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

                return <tr key={batch._id}>
                    <td><a href={this.props.URL(batch)}>{batch.fileName}</a></td>
                    <td>{this.props.relativeDate(batch.modified)}</td>
                    {columns}
                </tr>;
        Severity: Major
        Found in views/Admin.jsx and 1 other location - About 3 hrs to fix
        views/Admin.jsx on lines 225..229

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

        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

                if (batch.state === "error") {
                    columns = <td colSpan="4">
                        {this.props.format(this.props.gettext("Error: %(error)s"),
                            {error: this.props.batchError(batch)})}
                    </td>;
        Severity: Major
        Found in views/Admin.jsx and 1 other location - About 1 hr to fix
        views/Admin.jsx on lines 200..223

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

        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

                if (batch.state === "error") {
                    columns = <td colSpan="7">
                        {this.props.format(this.props.gettext("Error: %(error)s"),
                            {error: this.props.batchError(batch)})}
                    </td>;
        Severity: Major
        Found in views/Admin.jsx and 1 other location - About 1 hr to fix
        views/Admin.jsx on lines 102..114

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

        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 <form action={this.props.URL(
                        `/source/${this.props.source._id}/upload-data`)}
                    method="POST" encType="multipart/form-data"
                >
                    <input type="hidden" name="lang" value={this.props.lang}/>
        Severity: Major
        Found in views/Admin.jsx and 1 other location - About 1 hr to fix
        views/Admin.jsx on lines 41..72

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

                        <form action={this.props.URL(
                                `/source/${this.props.source._id}/upload-images`)}
                            method="POST" encType="multipart/form-data"
                        >
                            <input type="hidden" name="lang" value={this.props.lang}/>
        Severity: Major
        Found in views/Admin.jsx and 1 other location - About 1 hr to fix
        views/Admin.jsx on lines 148..169

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

                const title = this.props.format(
                    this.props.gettext("%(name)s Admin Area"),
                    {name: this.props.fullName(this.props.source)});
        Severity: Minor
        Found in views/Admin.jsx and 1 other location - About 50 mins to fix
        views/Search.jsx on lines 69..72

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

        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

                    <div className="panel-heading">
                        <h3 className="panel-title">
                            {this.props.gettext("Upload Images")}
                        </h3>
                    </div>
        Severity: Major
        Found in views/Admin.jsx and 3 other locations - About 50 mins to fix
        views/Admin.jsx on lines 125..129
        views/Home.jsx on lines 71..75
        views/Home.jsx on lines 99..103

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

        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

                    <div className="panel-heading">
                        <h3 className="panel-title">
                            {this.props.gettext("Upload Metadata")}
                        </h3>
                    </div>
        Severity: Major
        Found in views/Admin.jsx and 3 other locations - About 50 mins to fix
        views/Admin.jsx on lines 35..39
        views/Home.jsx on lines 71..75
        views/Home.jsx on lines 99..103

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

        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