Showing 19 of 19 total issues
Function readConfig
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
async function readConfig(listOfFileNamesOrConfigObjects, opts = {}) {
let listOfConfig = await Promise.all(listOfFileNamesOrConfigObjects.map(async function (fileNameOrObject) {
let result;
if (typeof fileNameOrObject === "string") {
let ext = Path.extname(fileNameOrObject);
- 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 readConfig
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
export async function readConfig<T>(listOfFileNamesOrConfigObjects:(string|T)[], opts:{whenNotExist?:'ignore'}={}):Promise<T>{
let listOfConfig = await Promise.all(listOfFileNamesOrConfigObjects.map(async function(fileNameOrObject){
type FileNameExtObjOrEmpty = {fileName:string, ext:string}|{empty:true}
let result:FileNameExtObjOrEmpty;
if(typeof fileNameOrObject==="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
Function serveTransforming
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serveTransforming(pathToFile, anyFileOrOptions, extOriginal, extTarget, renderizer, textType) {
let regExpExtDetect;
let regExpExtReplace;
let anyFile;
var renderOptions = null;
Function serveTransforming
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serveTransforming(
pathToFile:string,
anyFileOrOptions:null|boolean|RenderOptions,
extOriginal:string,
extTarget:string,
File mini-tools.js
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readConfig = exports.serveYaml = exports.serveJson = exports.serveJade = exports.serveStylus = exports.getTraceroute = exports.escapeRegExp = exports.serveFile = exports.serveText = exports.serveImage = exports.serveBuffer = exports.preEval = exports.serveErr = exports.globalOpts = void 0;
const Path = require("path");
const url = require("url");
Function readConfig
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function readConfig(listOfFileNamesOrConfigObjects, opts = {}) {
let listOfConfig = await Promise.all(listOfFileNamesOrConfigObjects.map(async function (fileNameOrObject) {
let result;
if (typeof fileNameOrObject === "string") {
let ext = Path.extname(fileNameOrObject);
Function listOfConfig
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
let listOfConfig = await Promise.all(listOfFileNamesOrConfigObjects.map(async function (fileNameOrObject) {
let result;
if (typeof fileNameOrObject === "string") {
let ext = Path.extname(fileNameOrObject);
let exts;
Function readConfig
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function readConfig<T>(listOfFileNamesOrConfigObjects:(string|T)[], opts:{whenNotExist?:'ignore'}={}):Promise<T>{
let listOfConfig = await Promise.all(listOfFileNamesOrConfigObjects.map(async function(fileNameOrObject){
type FileNameExtObjOrEmpty = {fileName:string, ext:string}|{empty:true}
let result:FileNameExtObjOrEmpty;
if(typeof fileNameOrObject==="string"){
Function unchainedFunction
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function unchainedFunction() {
try {
let pathname = ('path' in req /*never*/ ? req.path : url.parse(req.url).pathname);
/* istanbul ignore next */
if (traceRoute) {
Function listOfConfig
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
let listOfConfig = await Promise.all(listOfFileNamesOrConfigObjects.map(async function(fileNameOrObject){
type FileNameExtObjOrEmpty = {fileName:string, ext:string}|{empty:true}
let result:FileNameExtObjOrEmpty;
if(typeof fileNameOrObject==="string"){
let ext=Path.extname(fileNameOrObject);
Function unchainedFunction
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function unchainedFunction():Promise<void>{
try{
let pathname:string = ('path' in (req as any /*never*/) ? req.path : url.parse(req.url).pathname) as string;
/* istanbul ignore next */
if(traceRoute){
Function serveErr
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serveErr(_req, res, next) {
return async function (err) {
if (err.message === 'next') {
return next();
}
Function serveErr
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function serveErr(_req:Request,res:Response,next:NextFunction):(err:AnyErrorDuck) => Promise<void>{
return async function(err:AnyErrorDuck){
if(err.message==='next'){
return next();
}
Function serveTransforming
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function serveTransforming(pathToFile, anyFileOrOptions, extOriginal, extTarget, renderizer, textType) {
let regExpExtDetect;
let regExpExtReplace;
let anyFile;
var renderOptions = null;
- 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 serveTransforming
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function serveTransforming(
pathToFile:string,
anyFileOrOptions:null|boolean|RenderOptions,
extOriginal:string,
extTarget: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
Function serveTransforming
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function serveTransforming(pathToFile, anyFileOrOptions, extOriginal, extTarget, renderizer, textType) {
Function serveTransforming
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
pathToFile:string,
anyFileOrOptions:null|boolean|RenderOptions,
extOriginal:string,
extTarget:string,
renderizer:{render:Function, args:object},
TODO found Open
// TODO: algún día esto no va a ser necesario porque van a implementar los arreglos compactos!
- Exclude checks
TODO found Open
// TODO: algún día esto no va a ser necesario porque van a implementar los arreglos compactos!
- Exclude checks