jeresig/pharos-images

View on GitHub

Showing 106 of 451 total issues

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

module.exports = function(app) {
    const Artwork = models("Artwork");
    const Source = models("Source");

    const cache = require("../server/middlewares/cache");
Severity: Major
Found in logic/artworks.js - About 2 hrs to fix

    File Dimension.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "use strict";
    
    const pd = require("parse-dimensions");
    const React = require("react");
    
    
    Severity: Minor
    Found in schemas/types/Dimension.js - About 2 hrs to fix

      Function loadImages has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const loadImages = (callback) => {
          models("Artwork").find({}, {}, {timeout: true}).stream()
              .on("data", function(artwork) {
                  this.pause();
      
      
      Severity: Major
      Found in migrations/1452447841025-make-image-models.js - About 2 hrs to fix

        File Artwork.jsx has 271 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/Artwork.jsx - About 2 hrs to fix

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

          module.exports = (req, res, next) => {
              const methods = {
                  getOtherURL(locale) {
                      return urls.gen(locale, req.originalUrl);
                  },
          Severity: Minor
          Found in server/middlewares/view-methods.js - About 2 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 facet has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              facet() {
                  const config = require("../../lib/config");
          
                  const defaultUnit = config.DEFAULT_UNIT;
                  const unit = config.DEFAULT_SEARCH_UNIT || config.DEFAULT_UNIT;
          Severity: Major
          Found in schemas/types/Dimension.js - About 2 hrs to fix

            Function renderImageUploadForms has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                renderImageUploadForms() {
                    return <div>
                        <h3>{this.props.gettext("Search by Image:")}</h3>
                        <p>{this.props.gettext("Upload an image to find other " +
                            "similar images.")}</p>
            Severity: Major
            Found in views/Home.jsx - About 2 hrs to fix

              Function genURL has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              const genURL = (locale, urlBase, origPath) => {
                  let suffix = "";
                  let base = urlBase;
                  let path = origPath;
              
              
              Severity: Minor
              Found in lib/urls.js - About 2 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 fromFile has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  fromFile(batch, file, callback) {
                      const Image = models("Image");
                      const Source = models("Source");
              
                      const fileName = path.basename(file);
              Severity: Major
              Found in schemas/Image.js - About 2 hrs to fix

                Function parseRecord has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const parseRecord = function(data) {
                    const record = data.toMiJ();
                
                    const result = {};
                
                
                Severity: Major
                Found in converters/nga.js - About 2 hrs to fix

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

                  module.exports = function(app) {
                      const Artwork = models("Artwork");
                  
                      return {
                          index(req, res) {
                  Severity: Major
                  Found in logic/sitemaps.js - About 2 hrs to fix

                    Function fromData has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        fromData(tmpData, req, callback) {
                            const Artwork = models("Artwork");
                            const Image = models("Image");
                    
                            const lint = this.lintData(tmpData, req);
                    Severity: Major
                    Found in schemas/Artwork.js - About 2 hrs to fix

                      Function paramFilter has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const paramFilter = (values, keepSecondary) => {
                          const all = {};
                          const primary = [];
                          const secondary = {};
                      
                      
                      Severity: Minor
                      Found in logic/shared/param-filter.js - About 2 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 YearRange.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      "use strict";
                      
                      const React = require("react");
                      const yearRange = require("yearrange");
                      
                      
                      Severity: Minor
                      Found in schemas/types/YearRange.js - About 2 hrs to fix

                        Function updateSimilarity has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            updateSimilarity(callback) {
                                /* istanbul ignore if */
                                if (config.NODE_ENV !== "test") {
                                    console.log("Updating Similarity", this._id);
                                }
                        Severity: Minor
                        Found in schemas/Artwork.js - About 1 hr to fix

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

                          module.exports = (req, res, next) => {
                              const methods = {
                                  getOtherURL(locale) {
                                      return urls.gen(locale, req.originalUrl);
                                  },
                          Severity: Minor
                          Found in server/middlewares/view-methods.js - About 1 hr to fix

                            Function facet has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                facet() {
                                    return {
                                        [this.options.name]: {
                                            title: (i18n) => this.options.title(i18n),
                            
                            
                            Severity: Minor
                            Found in schemas/types/YearRange.js - About 1 hr to fix

                              Function processArtworks has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  processArtworks(callback) {
                                      const Artwork = models("Artwork");
                                      const incomingIDs = {};
                              
                                      async.eachLimit(this.results, 1, (result, callback) => {
                              Severity: Minor
                              Found in schemas/ArtworkImport.js - About 1 hr to fix

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

                                    filter(value) {
                                        const config = require("../../lib/config");
                                
                                        const filters = [];
                                
                                
                                Severity: Minor
                                Found in schemas/types/Dimension.js - About 1 hr to fix

                                  Function init has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const init = (done) => {
                                      genData();
                                      bindStubs();
                                  
                                      async.parallel([
                                  Severity: Minor
                                  Found in tests/init.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language