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");
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";
Function genData
has 378 lines of code (exceeds 25 allowed). Consider refactoring. Open
const genData = () => {
artworkData = {
id: "1234",
source: "test",
lang: "en",
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]) {
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) => {
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 = [];
- 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 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({
File ArtworkImport.js
has 404 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
const fs = require("fs");
const path = require("path");
File Image.js
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
const fs = require("fs");
const path = require("path");
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
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(),
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");
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(),
- 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 ImageImport.js
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
const path = require("path");
const tap = require("tap");
File admin.js
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
const fs = require("fs");
const path = require("path");
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 = [];
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}`);
- 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 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}`);
- 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 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;
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;