Showing 151 of 336 total issues
Function fromData
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
fromData(tmpData, i18n, callback) {
const Record = recordModel(this.getType());
const Image = models("Image");
const {error, warnings, data} = this.lintData(tmpData, i18n);
Function addSources
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addSources(req, res, next) {
const {i18n, lang} = req;
const {isPrivate, type, converter, sources} = req.body;
let createdOrUpdated = 0;
Function renderMenu
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderMenu() {
const {create} = this.props;
const {searchValue, options, error} = this.state;
const {gettext, format} = this.context;
Function addUsers
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addUsers(req, res, next) {
const {lang, i18n} = req;
let createdOrUpdated = 0;
const failed = [];
Function exports
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = type => {
if (records[type]) {
return records[type];
}
Function exports
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = (options: Options) => {
const genURL = (lang: ?string, urlBase: string, origPath: string) => {
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 exports
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(app) {
return {
index({lang}, res) {
const sitemaps = [];
Function clusterImages
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const clusterImages = (records: Array<RecordType>) => {
const sourceRecord = records[0];
const rows = [
{
record: sourceRecord,
File RecordImport.js
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const async = require("async");
const record = require("../lib/record");
const models = require("../lib/models");
const db = require("../lib/db");
File Page.js
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// @flow
const React = require("react");
import type {Context} from "./types.js";
File SearchForm.js
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// @flow
const React = require("react");
const Select = require("./shared/Select.js");
File express_v4.x.x.js
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// NOTE(jeresig): This is a modified version of the Express flow types
// from flow-typed, modified to include the custom properties on the
// request object. Theoretically it should be possible to extend this
// according to this diff, but I can't figure it out:
// https://github.com/flowtype/flow-typed/pull/508
Function filter
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Function paramFilter
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
const paramFilter = (values, keepSecondary) => {
const all = {};
const primary = [];
const secondary = {};
const type = values.type || Object.keys(options.types)[0];
- 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 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {mode, type, globalFacets, dynamicValues} = this.props;
const {gettext, options} = this.context;
const {model} = options.types[type];
const types = Object.keys(model);
File Dimension.js
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
const pd = require("parse-dimensions");
const numRange = bucket =>
bucket.to
? `${bucket.from || 0}-${bucket.to}${bucket.unit}`
Function updateSimilarity
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateSimilarity(callback) {
this.getImages((err, images) => {
/* istanbul ignore if */
if (err) {
return callback(err);
Function facet
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
facet() {
const defaultUnit = this.defaultUnit;
const unit = this.defaultSearchUnit || this.defaultUnit;
const formatFacetBucket = bucket => {
Function importRecords
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
importRecords(callback) {
const Record = record(this.type);
const Source = models("Source");
async.eachLimit(
Function processRecords
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
processRecords(callback) {
const Record = record(this.type);
const incomingIDs = {};
const results = this.results;