CrazySquirrel/UniqueTransport

View on GitHub

Showing 65 of 96 total issues

File server.ts has 1109 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
/**
 * Import interfaces
 */
import IWindow from "../../interfaces/IWindow";
Severity: Major
Found in lib/ts/server.ts - About 2 days to fix

File client.ts has 668 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
/**
 * Import interfaces
 */
import IWindow from "../../interfaces/IWindow";
Severity: Major
Found in lib/ts/client.ts - About 1 day to fix

Function Proxy has 261 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public Proxy(result, headers, request, response, depth = 5) {
    try {
      if (
          this.Settings.XAccelRedirect &&
          result.Data.link.indexOf(".css") === -1
Severity: Major
Found in lib/ts/server.ts - About 1 day to fix

File transport.ts has 441 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";

/**
 * Import interfaces
 */
Severity: Minor
Found in lib/ts/transport.ts - About 6 hrs to fix

Function Proxy has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

  public Proxy(result, headers, request, response, depth = 5) {
    try {
      if (
          this.Settings.XAccelRedirect &&
          result.Data.link.indexOf(".css") === -1
Severity: Minor
Found in lib/ts/server.ts - About 6 hrs to fix

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 doProxy has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          const doProxy = () => {
            if (this.proxyShit[result.Data.link]) {
              redirectProxy();
            } else {
              const url = URL.parse(result.Data.link);
Severity: Major
Found in lib/ts/server.ts - About 5 hrs to fix

Function Respond has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public Respond(result, headers, request, response) {
    try {
      headers["Cache-Control"] = "no-cache";
      let resp = "";
      switch (result.Params.Transport) {
Severity: Major
Found in lib/ts/server.ts - About 5 hrs to fix

Function processor has 126 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public processor(data, params, request, headers) {
    return new Promise((resolve, reject) => {
      this.decode(data, this.Settings.Password).then(
          (_data: any) => {
            if (
Severity: Major
Found in lib/ts/server.ts - About 5 hrs to fix

Function listenr has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public listenr(request, response) {
    this.AcceptEncoding = request.headers["accept-encoding"] || "";

    const headers = Object.assign({}, baseHeaders);

Severity: Major
Found in lib/ts/server.ts - About 4 hrs to fix

Function req has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                      const req = (options.port === 443 ? HTTPS : HTTP).request(options, (res) => {
                        clearTimeout(proxyConnectionTimeout);

                        res.on("error", (_err) => {
                          redirectProxy();
Severity: Major
Found in lib/ts/server.ts - About 3 hrs to fix

Function styleadvanced has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public styleadvanced(params: any = {}) {
    return new Promise((resolve, reject) => {
      const onerror = () => {
        try {
          link.href = "";
Severity: Major
Found in lib/ts/client.ts - About 3 hrs to fix

Function emit has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public emit(params: any = {}) {
    params.Event = params.Event || "";
    params.Data = params.Data || {};
    params.Debug = params.Debug || false;

Severity: Major
Found in lib/ts/client.ts - About 3 hrs to fix

Function generateChoises has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  public generateChoises() {
    const choices = {
      bad: {},
      good: {},
      normal: {},
Severity: Minor
Found in lib/ts/client.ts - About 3 hrs to fix

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 Respond has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  public Respond(result, headers, request, response) {
    try {
      headers["Cache-Control"] = "no-cache";
      let resp = "";
      switch (result.Params.Transport) {
Severity: Minor
Found in lib/ts/server.ts - About 3 hrs to fix

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

Server has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Server extends Transport {

  /**
   * Get choice ID
   * @param choiceType
Severity: Minor
Found in lib/ts/server.ts - About 2 hrs to fix

Function styleextend has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public styleextend(params: any = {}) {
    return new Promise((resolve, reject) => {
      const onerror = () => {
        try {
          link.href = "";
Severity: Major
Found in lib/ts/client.ts - About 2 hrs to fix

Function onload has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      const onload = () => {
        if (
            link.sheet &&
            link.sheet.cssRules.length > 0
        ) {
Severity: Major
Found in lib/ts/client.ts - About 2 hrs to fix

Function download has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public download(data, headers, request, depth = 3) {
    return new Promise((resolve, reject) => {
      const url = URL.parse(data.link);

      url.port = url.port || url.protocol === "https:" ? 443 : 80;
Severity: Major
Found in lib/ts/server.ts - About 2 hrs to fix

Function style has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public style(params: any = {}) {
    return new Promise((resolve, reject) => {
      const onerror = () => {
        try {
          link.href = "";
Severity: Major
Found in lib/ts/client.ts - About 2 hrs to fix

Function encodeSync has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public encodeSync(data: any, password: string) {
    if (
        this.cryptoModule === "" ||
        this.cryptoModule === "base64salt"
    ) {
Severity: Minor
Found in lib/ts/server.ts - About 2 hrs to fix
Severity
Category
Status
Source
Language