Narazaka/shiorijk

View on GitHub

Showing 9 of 27 total issues

File shiorijk.ts has 834 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * SHIORI/2.x/3.x Protocol Parser/Builder/Container
 *
 * (C) 2014-2018 Narazaka : Licensed under The [Zlib License](https://narazaka.net/license/Zlib?2014-2018)
 */
Severity: Major
Found in lib/shiorijk.ts - About 2 days to fix

    Request has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

        export class Request extends Headers {
            /** Charset header */
            get Charset() {
                return this.get("Charset");
            }
    Severity: Minor
    Found in lib/shiorijk.ts - About 3 hrs to fix

      Function validate_method_version has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          validate_method_version(method: Method, version: Version) {
              let is_valid = false;
              switch (version) {
                  case "2.0":
                      switch (method) {
      Severity: Major
      Found in lib/shiorijk.ts - About 2 hrs to fix

        Response has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

            export class Response extends Headers {
                /**
                 * String header (GET String SHIORI/2.5)
                 * @param separator separator characters
                 * @return header values
        Severity: Minor
        Found in lib/shiorijk.ts - About 2 hrs to fix

          Function validate_method_version has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              validate_method_version(method: Method, version: Version) {
                  let is_valid = false;
                  switch (version) {
                      case "2.0":
                          switch (method) {
          Severity: Minor
          Found in lib/shiorijk.ts - About 2 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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function (config) {
              config.set({
                  mime: { "text/x-typescript": ["ts", "tsx"] }, // fix typescript serving video/mp2t mime type
                  frameworks: ["mocha"].concat(process.env.NO_DETECT ? [] : ["detectBrowsers"]),
                  files: ["test/**/*.ts"],
          Severity: Minor
          Found in karma.conf.js - About 45 mins 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 constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  constructor(data: RequestLike & Options = {}) {
                      const { request_line, headers, no_prepare } = data;
          
                      if (request_line == null) {
                          if (!no_prepare) this.request_line = new RequestLine();
          Severity: Minor
          Found in lib/shiorijk.ts - About 45 mins 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 constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  constructor(data: ResponseLike & Options = {}) {
                      const { status_line, headers, no_prepare } = data;
          
                      if (status_line == null) {
                          if (!no_prepare) this.status_line = new StatusLine();
          Severity: Minor
          Found in lib/shiorijk.ts - About 45 mins 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 abort_parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  abort_parse() {
                      if (this.parsers != null) {
                          // forin for compatibility
                          // eslint-disable-next-line guard-for-in, no-restricted-syntax
                          for (const name in this.parsers) {
          Severity: Minor
          Found in lib/shiorijk.ts - About 25 mins 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

          Severity
          Category
          Status
          Source
          Language