Showing 38 of 38 total issues
JSONAPISerializer
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export default abstract class JSONAPISerializer extends Serializer {
/**
* The default content type to use for any responses rendered by this serializer.
*
File json-api-test.ts
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* tslint:disable:completed-docs no-empty no-invalid-this member-access */
import { isArray } from 'lodash';
import {
setupUnitTest,
JSONAPISerializer,
Model
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export default class Model extends DenaliObject {
/**
* Marks the Model as an abstract base model, so ORM adapters can know not to
* create tables or other supporting infrastructure.
Function run
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(argv: any) {
let files = (<string[] | void>argv.files) || [];
if (files.length === 0) {
files.push('test/**/*.js');
} else {
Function baseMiddleware
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function baseMiddleware(router: Router, application: Application): void {
let config = application.config;
/**
Function run
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async run(argv: any) {
let files = (<string[] | void>argv.files) || [];
if (files.length === 0) {
files.push('test/**/*.js');
} else {
- 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 runTests
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected runTests(files: string[], project: Project, outputDir: string, argv: any) {
let avaPath = path.join(process.cwd(), 'node_modules', '.bin', 'ava');
files = files.map((pattern) => path.join(outputDir, pattern));
let args = files.concat([ '--concurrency', argv.concurrency ]);
if (argv.debug) {
Function _augmentWithSchemaAccessors
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static _augmentWithSchemaAccessors() {
if ((<any>this.prototype)[augmentedWithAccessors]) {
return;
}
(<any>this.prototype)[augmentedWithAccessors] = true;
Function baseMiddleware
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export default function baseMiddleware(router: Router, application: Application): void {
let config = application.config;
/**
- 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 lookup
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
lookup<T>(specifier: string, options: { raw?: true, loose?: boolean } = {}): T | false {
// Raw lookups skip caching and singleton behavior
if (options.raw) {
let entry = this.lookupRaw<T>(specifier);
if (entry === false && !options.loose) {
- 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 run
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(argv: any) {
let knex = tryRequire('knex');
if (!knex) {
await spinner.start('Installing knex (required for migrations)');
let yarnExists = await commandExists('yarn');
Function run
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(argv: any) {
debug('running server command');
if (argv.production) {
argv.skipBuild = true;
argv.environment = 'production';
Function constructor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(options: MockMessageOptions = {}) {
super();
this.method = options.method || this.method;
Function resource
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
resource(resourceName: string, options: ResourceOptions = {}): void {
let plural = pluralize(resourceName);
let collection = `/${ plural }`;
let resource = `${ collection }/:id`;
let relationship = `${ resource }/relationships/:relation`;
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async render(status: number, body?: any, options?: RenderOptions): Promise<void> {
if (typeof status !== 'number') {
options = body;
body = status;
status = 200;
Function installAddon
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async installAddon(addonName: string) {
debug(`attempting to install ${ addonName }`);
// Find the package info first to confirm it exists and is a denali addon
let pkgManager = await commandExists('yarn') ? 'yarn' : 'npm';
debug(`package manager is: ${ pkgManager }`);
Function run
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async run(argv: any) {
debug('running server command');
if (argv.production) {
argv.skipBuild = true;
argv.environment = 'production';
- 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 constructor
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
constructor(options: MockMessageOptions = {}) {
super();
this.method = options.method || this.method;
- 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 run
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(argv: any) {
ui.info(`Loading ${ argv.environment } environment. Type '.help' for details`);
let project = new Project({
environment: argv.environment,
printSlowTrees: argv.printSlowTrees
Function namespace
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
namespace(namespace: string, fn: (wrapper: RouterDSL) => void): void {
let router = this;
if (namespace.endsWith('/')) {
namespace = namespace.slice(0, namespace.length - 1);
}