jeresig/pharos-images

View on GitHub

Showing 106 of 451 total issues

File Artwork.js has 1020 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";

const tap = require("tap");

const init = require("../init");
Severity: Major
Found in tests/schemas/Artwork.js - About 2 days to fix

    File init.js has 840 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "use strict";
    
    process.env.BASE_DATA_DIR = process.cwd();
    process.env.PASTEC_URL = "localhost:4212";
    process.env.ELASTICSEARCH_URL = "http://localhost:9200";
    Severity: Major
    Found in tests/init.js - About 2 days to fix

      Function genData has 378 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const genData = () => {
          artworkData = {
              id: "1234",
              source: "test",
              lang: "en",
      Severity: Major
      Found in tests/init.js - About 1 day to fix

        Function bindStubs has 283 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const bindStubs = () => {
            sandbox = sinon.sandbox.create();
        
            sandbox.stub(Artwork, "findById", (id, callback) => {
                if (artworks[id]) {
        Severity: Major
        Found in tests/init.js - About 1 day to fix

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

          module.exports = function(app) {
              const ImageImport = models("ImageImport");
              const ArtworkImport = models("ArtworkImport");
          
              const importArtworks = (req, res) => {
          Severity: Major
          Found in logic/admin.js - About 7 hrs to fix

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

                lintData(data, req, optionalSchema) {
                    const schema = optionalSchema || Artwork;
            
                    const cleaned = {};
                    const warnings = [];
            Severity: Minor
            Found in schemas/Artwork.js - About 7 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 Artwork.js has 425 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            "use strict";
            
            const async = require("async");
            const validUrl = require("valid-url");
            const jdp = require("jsondiffpatch").create({
            Severity: Minor
            Found in schemas/Artwork.js - About 6 hrs to fix

              File ArtworkImport.js has 404 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              "use strict";
              
              const fs = require("fs");
              const path = require("path");
              
              
              Severity: Minor
              Found in tests/schemas/ArtworkImport.js - About 5 hrs to fix

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

                "use strict";
                
                const fs = require("fs");
                const path = require("path");
                
                
                Severity: Minor
                Found in schemas/Image.js - About 5 hrs to fix

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

                  module.exports = (req, res, tmplParams) => {
                      // Collect all the values from the request to construct
                      // the search URL and matches later
                      // Generate the filters and facets which will be fed in to Elasticsearch
                      // to build the query filter and aggregations
                  Severity: Major
                  Found in logic/shared/search.js - About 4 hrs to fix

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

                    module.exports = (app) => {
                        const Upload = models("Upload");
                        const UploadImage = models("UploadImage");
                    
                        const genTmpFile = () => path.join(os.tmpdir(),
                    Severity: Major
                    Found in logic/uploads.js - About 4 hrs to fix

                      File Search.jsx has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      "use strict";
                      
                      const React = require("react");
                      
                      const metadata = require("../lib/metadata");
                      Severity: Minor
                      Found in views/Search.jsx - About 4 hrs to fix

                        Function exports has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports = (app) => {
                            const Upload = models("Upload");
                            const UploadImage = models("UploadImage");
                        
                            const genTmpFile = () => path.join(os.tmpdir(),
                        Severity: Minor
                        Found in logic/uploads.js - About 4 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 ImageImport.js has 334 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        "use strict";
                        
                        const path = require("path");
                        
                        const tap = require("tap");
                        Severity: Minor
                        Found in tests/schemas/ImageImport.js - About 4 hrs to fix

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

                          "use strict";
                          
                          const fs = require("fs");
                          const path = require("path");
                          
                          
                          Severity: Minor
                          Found in tests/logic/admin.js - About 4 hrs to fix

                            Function lintData has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                lintData(data, req, optionalSchema) {
                                    const schema = optionalSchema || Artwork;
                            
                                    const cleaned = {};
                                    const warnings = [];
                            Severity: Major
                            Found in schemas/Artwork.js - About 3 hrs to fix

                              Function searchByProps has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const searchByProps = function(root, propMap) {
                                  const results = {};
                              
                                  const getByTagName = (name) => {
                                      const node = root.get(`.//${name}`);
                              Severity: Minor
                              Found in converters/fzeri.js - About 3 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

                              Function searchByProps has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const searchByProps = function(root, propMap) {
                                  const results = {};
                              
                                  const getByTagName = (name) => {
                                      const node = root.get(`.//${name}`);
                              Severity: Minor
                              Found in converters/marburg.js - About 3 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

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

                                  render() {
                                      const format = this.props.format;
                                      const gettext = this.props.gettext;
                              
                                      const state = this.props.batch.state;
                              Severity: Major
                              Found in views/ImportData.jsx - About 2 hrs to fix

                                Function filter has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    filter(value) {
                                        // NOTE(jeresig): There has got to be a better way to handle this.
                                        const start = value.start || -10000;
                                        const end = value.end || (new Date).getYear() + 1900;
                                
                                
                                Severity: Major
                                Found in schemas/types/YearRange.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language