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");
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");
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();
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");
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);
},
- Read upRead up
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;
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>
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;
- Read upRead up
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);
Function parseRecord
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const parseRecord = function(data) {
const record = data.toMiJ();
const result = {};
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) {
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);
Function paramFilter
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const paramFilter = (values, keepSecondary) => {
const all = {};
const primary = [];
const secondary = {};
- Read upRead up
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");
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);
}
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);
},
Function facet
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
facet() {
return {
[this.options.name]: {
title: (i18n) => this.options.title(i18n),
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) => {
Function filter
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
filter(value) {
const config = require("../../lib/config");
const filters = [];
Function init
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
const init = (done) => {
genData();
bindStubs();
async.parallel([