Showing 65 of 96 total issues
Avoid deeply nested control flow statements. Open
} else if (
(
res.statusCode === 301 ||
res.statusCode === 302
) &&
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for (let i3 = 0; i3 < HttpMethodsKeys.length; i3++) {
const HttpMethod = HttpMethodsKeys[i3];
if (
["GET", "POST", "PUT", "PATCH"].indexOf(HttpMethod) !== -1
- Create a ticketCreate a ticket
Function filterChoises
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public filterChoises() {
const _choices = this.generateChoises();
const choices = {
bad: {},
- Read upRead up
- Create a ticketCreate a ticket
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 deeply nested control flow statements. Open
if (
this.Settings.MaxProxySize &&
res.headers["content-length"] &&
parseInt(res.headers["content-length"], 10) > this.Settings.MaxProxySize &&
result.Data.link.indexOf(".css") === -1 &&
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (!response.answered) {
response.answered = true;
FS.readFile(CachePathHeaders, "utf-8", (e, _headers) => {
try {
if (e) {
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (_data) {
return resolve(_data);
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if (e) {
doRedirect();
} else {
response.writeHead(this.Settings.SuccessResponseCode, JSON.parse(_headers));
FS.createReadStream(CachePathBody).pipe(response);
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (
type === "base" ||
(
this.Settings &&
this.Settings.Transports &&
- Create a ticketCreate a ticket
Function generateSubtransportChoices
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public generateSubtransportChoices(choices: any, obj: any, subtransports: any): void {
const l = subtransports.length;
if (l) {
for (let x = 0; x < l; x++) {
if (
- Read upRead up
- Create a ticketCreate a ticket
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 getHostFromHeaderXRealHost
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public getHostFromHeaderXRealHost(request, params) {
if (request.headers["x-real-host"]) {
let origin;
if (request.headers["x-real-host"].indexOf("http") === -1) {
- Read upRead up
- Create a ticketCreate a ticket
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 "bad";
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return "good";
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return false;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return "normal";
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return dec;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return "normal";
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return "good";
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return null;
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return data;
- Create a ticketCreate a ticket
Function getHostFromParamsReferer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public getHostFromParamsReferer(request, params) {
if (params.Refferer) {
let origin;
if (params.Refferer.indexOf("http") === -1) {
- Read upRead up
- Create a ticketCreate a ticket
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"