mongaku/mongaku

View on GitHub

Showing 336 of 336 total issues

Function exports has 151 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = app => {
    const Upload = models("Upload");
    const UploadImage = models("UploadImage");
    const Source = models("Source");

Severity: Major
Found in src/logic/uploads.js - About 6 hrs to fix

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

            if (value.heightMin || value.heightMax) {
                const title = this.options.heightTitle(i18n);
                const range = numRange({
                    from: value.heightMin,
                    to: value.heightMax,
    Severity: Major
    Found in src/schemas/types/Dimension.js and 1 other location - About 5 hrs to fix
    src/schemas/types/Dimension.js on lines 132..148

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

    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 (value.widthMin || value.widthMax) {
                const title = this.options.widthTitle(i18n);
                const range = numRange({
                    from: value.widthMin,
                    to: value.widthMax,
    Severity: Major
    Found in src/schemas/types/Dimension.js and 1 other location - About 5 hrs to fix
    src/schemas/types/Dimension.js on lines 114..130

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

    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 lintData has 137 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        lintData(data, i18n, optionalSchema) {
            const schema = optionalSchema || recordModel(this.getType()).schema;
    
            const cleaned = {};
            const warnings = [];
    Severity: Major
    Found in src/schemas/Record.js - About 5 hrs to fix

      Function exports has 123 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(app: express$Application) {
          const Source = models("Source");
      
          const show = (
              {i18n, originalUrl, params, query, user}: express$Request,
      Severity: Major
      Found in src/logic/view.js - About 4 hrs to fix

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

                        <p>
                            <strong>{gettext("Images Indexed:")}</strong>{" "}
                            <strong
                                className={
                                    numImagesIndexed === numImages
        Severity: Major
        Found in src/views/SourceAdmin.js and 1 other location - About 4 hrs to fix
        src/views/SourceAdmin.js on lines 486..504

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

        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

                        <p>
                            <strong>{gettext("Record Similarity Updated:")}</strong>{" "}
                            <strong
                                className={
                                    numRecordsUpdated === numRecords
        Severity: Major
        Found in src/views/SourceAdmin.js and 1 other location - About 4 hrs to fix
        src/views/SourceAdmin.js on lines 141..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 124.

        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 create has 111 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const create = (req: express$Request, res, next) => {
                const {
                    params: {type},
                    i18n,
                    lang,
        Severity: Major
        Found in src/logic/create.js - About 4 hrs to fix

          Function edit has 110 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              const edit = (req: express$Request, res, next) => {
                  const {
                      params: {type, recordName, source},
                      i18n,
                      lang,
          Severity: Major
          Found in src/logic/edit.js - About 4 hrs to fix

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

                        <div className="details">
                            <div className="wrap">
                                <span>
                                    {format(gettext("Score: %(score)s"), {score: score})}
                                </span>
            Severity: Major
            Found in src/views/Upload.js and 1 other location - About 4 hrs to fix
            src/views/Record.js on lines 413..429

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

            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

                    <div className="details">
                        <div className="wrap">
                            <span>
                                {format(gettext("Score: %(score)s"), {score: score})}
                            </span>
            Severity: Major
            Found in src/views/Record.js and 1 other location - About 4 hrs to fix
            src/views/Upload.js on lines 87..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 121.

            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 (value.widthMin || value.widthMax) {
                        const name = this.options.widthTitle(i18n);
                        const range = numRange({
                            from: pd.convertNumber(value.widthMin, unit, expectedUnit),
                            to: pd.convertNumber(value.widthMax, unit, expectedUnit),
            Severity: Major
            Found in src/schemas/types/Dimension.js and 1 other location - About 4 hrs to fix
            src/schemas/types/Dimension.js on lines 51..59

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

            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 (value.heightMin || value.heightMax) {
                        const name = this.options.heightTitle(i18n);
                        const range = numRange({
                            from: pd.convertNumber(value.heightMin, unit, expectedUnit),
                            to: pd.convertNumber(value.heightMax, unit, expectedUnit),
            Severity: Major
            Found in src/schemas/types/Dimension.js and 1 other location - About 4 hrs to fix
            src/schemas/types/Dimension.js on lines 61..69

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

            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

            File Search.js has 335 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // @flow
            
            const React = require("react");
            
            const SearchForm = require("./SearchForm.js");
            Severity: Minor
            Found in src/views/Search.js - About 4 hrs to fix

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

                                  <div className="form-group">
                                      <label htmlFor="converter">
                                          {gettext("Data Converter")}
                                      </label>
                                      <select
              Severity: Major
              Found in src/views/AddSource.js and 1 other location - About 4 hrs to fix
              src/views/AddSources.js on lines 70..85

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

              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

                                  <div className="form-group">
                                      <label htmlFor="converter">
                                          {gettext("Data Converter")}
                                      </label>
                                      <select
              Severity: Major
              Found in src/views/AddSources.js and 1 other location - About 4 hrs to fix
              src/views/AddSource.js on lines 96..111

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

              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 fromData has 96 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  fromData(tmpData, i18n, callback) {
                      const Record = recordModel(this.getType());
                      const Image = models("Image");
              
                      const {error, warnings, data} = this.lintData(tmpData, i18n);
              Severity: Major
              Found in src/schemas/Record.js - About 3 hrs to fix

                Function addSources has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        addSources(req, res, next) {
                            const {i18n, lang} = req;
                            const {isPrivate, type, converter, sources} = req.body;
                
                            let createdOrUpdated = 0;
                Severity: Major
                Found in src/logic/admin.js - About 3 hrs to fix

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

                                      <div className="form-group">
                                          <label htmlFor="type">{gettext("Data Type")}</label>
                                          <select
                                              name="type"
                                              id="type"
                  Severity: Major
                  Found in src/views/AddSources.js and 1 other location - About 3 hrs to fix
                  src/views/AddSource.js on lines 83..95

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

                  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

                                      <div className="form-group">
                                          <label htmlFor="type">{gettext("Data Type")}</label>
                                          <select
                                              name="type"
                                              id="type"
                  Severity: Major
                  Found in src/views/AddSource.js and 1 other location - About 3 hrs to fix
                  src/views/AddSources.js on lines 57..69

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

                  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