Showing 26 of 26 total issues
Function exports
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function () {
return function (req, res, next) {
const config = req.superstatic;
const trailingSlashBehavior = config.trailingSlash;
Function test
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Redirect.prototype.test = function (url) {
let qs = "";
if (url.indexOf("?") >= 0) {
const parts = url.split("?");
url = parts[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 provider
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function provider(options: any) {
const etagCache: Record<string, { timestamp: Date; value: string }> = {};
const cwd = options.cwd || process.cwd();
let publicPaths: string[] = options.public || ["."];
if (!Array.isArray(publicPaths)) {
Function test
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Redirect.prototype.test = function (url) {
let qs = "";
if (url.indexOf("?") >= 0) {
const parts = url.split("?");
url = parts[0];
Function superstatic
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const superstatic = function (spec = {}) {
if (!spec.stack) {
spec.stack = "default";
}
Function exports
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function () {
return function (req, res, next) {
const config = _.get(req, "superstatic.redirects");
if (!config) {
return next();
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (filename) {
if (_.isFunction(filename)) {
return filename;
}
- 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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function () {
return function (req, res, next) {
const config = _.get(req, "superstatic.redirects");
if (!config) {
return next();
Function handleFileStream
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Responder.prototype.handleFileStream = function (file, result) {
const self = this;
this.streamedFile = file;
this.res.statusCode = file.status || 200;
Function exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (spec) {
let defaultErrorContent = undefined;
if (spec.errorPage) {
defaultErrorContent = fs.readFileSync(spec.errorPage, "utf8");
}
Function exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (filename) {
if (_.isFunction(filename)) {
return filename;
}
Function superstatic
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const superstatic = function (spec = {}) {
if (!spec.stack) {
spec.stack = "default";
}
- 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 getI18nLanguages
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getI18nLanguages(headers: Record<string, string>): string[] {
const overrideValue = cookieValue(
headers.cookie,
"firebase-language-override",
);
Function getI18nLanguages
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function getI18nLanguages(headers: Record<string, string>): string[] {
const overrideValue = cookieValue(
headers.cookie,
"firebase-language-override",
);
- 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 handleFileStream
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Responder.prototype.handleFileStream = function (file, result) {
const self = this;
this.streamedFile = file;
this.res.statusCode = file.status || 200;
- 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 _handle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Responder.prototype._handle = function (item) {
if (_.isArray(item)) {
return this.handleStack(item);
} else if (_.isString(item)) {
return this.handleFile({ file: item });
- 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 normalizedConfigHeaders
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const normalizedConfigHeaders = function (spec, config) {
const out = config || [];
if (_.isArray(config)) {
const _isAllowed = function (headerToSet) {
return _.includes(spec.allowedHeaders, headerToSet.key.toLowerCase());
- 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 cookieValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function cookieValue(cookieString: string, key: string): string {
if (!cookieString) {
return "";
}
const cookies = cookieString.split(";").map((c) => c.trim());
- 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
Avoid too many return
statements within this function. Open
return this.handleMiddleware(item);
Avoid too many return
statements within this function. Open
return this.handleRewrite(item);