Showing 151 of 336 total issues
Function fromFile
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
fromFile(batch, file, callback) {
const Image = models("Image");
const Source = models("Source");
const filePath = file.path || file;
Function TypeFilter
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
const TypeFilter = ({
name,
value,
allValues,
typeSchema,
- 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 exports
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (
lang: string,
options: Options,
translations: {
[message: string]: ?Array<string>,
- 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 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
const os = require("os");
const fs = require("fs");
const path = require("path");
const glob = require("glob");
Function filter
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
filter(value) {
const filters = [];
if (value.widthMin) {
filters.push({
Function exports
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
module.exports = (fields, {originalUrl, i18n, user}, callback) => {
// 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
- 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 updateSimilarity
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateSimilarity(callback) {
// Skip small images
if (!this.canIndex()) {
return process.nextTick(callback);
}
Function exports
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (
lang: string,
options: Options,
translations: {
[message: string]: ?Array<string>,
Function routes
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
routes() {
const source = (req, res, next) => {
const {
params: {source},
} = req;
Function exports
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (req, res, next, tmplParams) => {
const {i18n, query, params} = req;
const fields = Object.assign({}, query, params);
const {type} = params;
Function uploadData
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
uploadData(req, res, next) {
const {source, i18n, lang} = req;
const form = new formidable.IncomingForm();
form.encoding = "utf-8";
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {facet} = this.props;
const {gettext, format} = this.context;
let {buckets} = facet;
let extra = null;
Function show
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
show({params, i18n, user}, res) {
// TODO: Update similar matches if new image data has
// since come in since it was last updated.
const _id = `uploads/${params.upload}`;
Upload.findById(_id, (err, upload) => {
Function advance
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
advance(callback) {
this.find(
{
state: {
$nin: ["completed", "error"],
Function render
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {success, error} = this.props;
const {gettext, URL} = this.context;
return (
Function processZipFile
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
processZipFile(callback) {
const zipFile = fs.createReadStream(this.zipFile);
let zipError;
const files = [];
const extractDir = path.join(
Function serializeValue
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const serializeValue = (i18n: i18nObject, blacklist: Array<string> = []) => (
value: any,
key: string,
object: Object,
) => {
- 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 getExpectedType
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const getExpectedType = (options, value) => {
if (Array.isArray(options.type)) {
return Array.isArray(value) ? false : "array";
}
- 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 loadImages
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadImages(loadSimilarRecords, callback) {
async.parallel(
[
callback => {
this.getImages((err, images) => {
Function handleInput
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleInput(searchValue: string) {
const {loadOptions, options} = this.props;
this.setState({
searchValue,