mongaku/mongaku

View on GitHub

Showing 336 of 336 total issues

File Select.js has 1252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow

const React = require("react");

import type {Context} from "../types.js";
Severity: Major
Found in src/views/shared/Select.js - About 3 days to fix

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

    module.exports = function(app) {
        const ImageImport = models("ImageImport");
        const RecordImport = models("RecordImport");
    
        const {auth, canEdit} = require("./shared/auth");
    Severity: Major
    Found in src/logic/source-admin.js - About 2 days to fix

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

      module.exports = function(app) {
          const {auth, isAdmin} = require("./shared/auth");
      
          return {
              admin(req, res) {
      Severity: Major
      Found in src/logic/admin.js - About 1 day to fix

        File Record.js has 695 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // @flow
        /* global PhotoSwipe, PhotoSwipeUI_Default */
        
        const React = require("react");
        
        
        Severity: Major
        Found in src/views/Record.js - About 1 day to fix

          File Record.js has 655 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          const async = require("async");
          const jdp = require("jsondiffpatch").create({
              objectHash: obj => obj._id,
          });
          
          
          Severity: Major
          Found in src/schemas/Record.js - About 1 day to fix

            File SourceAdmin.js has 581 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // @flow
            
            const React = require("react");
            
            import type {Context} from "./types.js";
            Severity: Major
            Found in src/views/SourceAdmin.js - About 1 day to fix

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

              class Admin extends React.Component<Props> {
                  context: Context;
              
                  static contextTypes = childContextTypes;
              
              
              Severity: Major
              Found in src/views/AddSources.js and 3 other locations - About 1 day to fix
              src/views/AddSource.js on lines 125..156
              src/views/AddUser.js on lines 79..110
              src/views/AddUsers.js on lines 76..107

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

              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

              class Admin extends React.Component<Props> {
                  context: Context;
              
                  static contextTypes = childContextTypes;
              
              
              Severity: Major
              Found in src/views/AddSource.js and 3 other locations - About 1 day to fix
              src/views/AddSources.js on lines 99..130
              src/views/AddUser.js on lines 79..110
              src/views/AddUsers.js on lines 76..107

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

              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

              class Admin extends React.Component<Props> {
                  context: Context;
              
                  static contextTypes = childContextTypes;
              
              
              Severity: Major
              Found in src/views/AddUsers.js and 3 other locations - About 1 day to fix
              src/views/AddSource.js on lines 125..156
              src/views/AddSources.js on lines 99..130
              src/views/AddUser.js on lines 79..110

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

              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

              class Admin extends React.Component<Props> {
                  context: Context;
              
                  static contextTypes = childContextTypes;
              
              
              Severity: Major
              Found in src/views/AddUser.js and 3 other locations - About 1 day to fix
              src/views/AddSource.js on lines 125..156
              src/views/AddSources.js on lines 99..130
              src/views/AddUsers.js on lines 76..107

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

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

              module.exports = function(app: express$Application) {
                  const Image = models("Image");
              
                  const {auth, canEdit} = require("./shared/auth");
              
              
              Severity: Major
              Found in src/logic/edit.js - About 1 day to fix

                File Image.js has 537 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                const fs = require("fs");
                const path = require("path");
                
                const farmhash = require("farmhash");
                const imageinfo = require("imageinfo");
                Severity: Major
                Found in src/schemas/Image.js - About 1 day to fix

                  File EditRecord.js has 525 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // @flow
                  
                  const React = require("react");
                  
                  const FixedStringEdit = require("./types/edit/FixedString.js");
                  Severity: Major
                  Found in src/views/EditRecord.js - About 1 day to fix

                    Function lintData has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                    Open

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

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

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

                    module.exports = function(app: express$Application) {
                        const Image = models("Image");
                        const Source = models("Source");
                    
                        const {auth, canEdit} = require("./shared/auth");
                    Severity: Major
                    Found in src/logic/create.js - About 1 day to fix

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

                              <div className="form-group col-xs-6 col-sm-12 col-lg-6">
                                  <label
                                      htmlFor={`${searchName}.heightMin`}
                                      className="control-label"
                                  >
                      Severity: Major
                      Found in src/views/types/filter/Dimension.js and 1 other location - About 7 hrs to fix
                      src/views/types/filter/Dimension.js on lines 29..50

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

                      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 col-xs-6 col-sm-12 col-lg-6">
                                  <label htmlFor={`${searchName}.widthMin`} className="control-label">
                                      {widthTitle}
                                  </label>
                                  <div className="form-inline">
                      Severity: Major
                      Found in src/views/types/filter/Dimension.js and 1 other location - About 7 hrs to fix
                      src/views/types/filter/Dimension.js on lines 51..75

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

                      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 clusterImages has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const clusterImages = (records: Array<RecordType>) => {
                          const sourceRecord = records[0];
                          const rows = [
                              {
                                  record: sourceRecord,
                      Severity: Minor
                      Found in src/views/Record.js - About 6 hrs to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      File source-admin.js has 439 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      const fs = require("fs");
                      
                      const async = require("async");
                      const formidable = require("formidable");
                      const jdp = require("jsondiffpatch");
                      Severity: Minor
                      Found in src/logic/source-admin.js - About 6 hrs to fix

                        File admin.js has 424 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        const fs = require("fs");
                        const path = require("path");
                        const {Readable} = require("stream");
                        
                        const async = require("async");
                        Severity: Minor
                        Found in src/logic/admin.js - About 6 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language