mongaku/mongaku

View on GitHub

Showing 151 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

              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

                      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

                          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

                            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

                                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

                                    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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language