jameswlane/jest-express

View on GitHub

Showing 222 of 222 total issues

Function constructor has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor() {
    // Properties
    this.headers = {};
    this.headersSent = false;
    this.locals = {};
Severity: Major
Found in src/response.ts - About 2 hrs to fix

    Function constructor has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor() {
        this.request = new Request(null, { app: this });
        this.response = new Response();
        this.next = next;
        // Properties
    Severity: Major
    Found in src/express.ts - About 2 hrs to fix

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

      export class Request {
        // Properties
        public baseUrl: string;
        public body: any;
        public cookies: any;
      Severity: Minor
      Found in src/request.ts - About 2 hrs to fix

        Function constructor has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor() {
            const handler = (path: any, ...callbacks: any): void => {
              const flattened = [].concat(...callbacks); // flatten array
              if (typeof path === 'string' && flattened.every((cb: any) => typeof cb === 'function')) {
                flattened.forEach((cb: any) => cb(this.request, this.response, this.next));
        Severity: Minor
        Found in src/router.ts - About 1 hr to fix

          Function constructor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            constructor() {
              this.request = new Request(null, { app: this });
              this.response = new Response();
              this.next = next;
              // Properties
          Severity: Minor
          Found in src/express.ts - About 1 hr 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 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(url?: string | null, options?: IRequestOptions) {
              // Properties
              this.baseUrl = '';
              this.body = '';
              this.cookies = {};
          Severity: Minor
          Found in src/request.ts - About 1 hr to fix

            Function constructor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              constructor() {
                // Properties
                this.headers = {};
                this.headersSent = false;
                this.locals = {};
            Severity: Minor
            Found in src/response.ts - About 1 hr 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 setUrl has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              public setUrl(url: string, options?: IRequestOptions) {
                const parsedUrl = parse(url, true);
            
                this.path = parsedUrl.pathname || '/';
                this.hostname = parsedUrl.hostname || '';
            Severity: Minor
            Found in src/request.ts - About 1 hr 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 resetMocked has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public resetMocked() {
                // Properties
                this.baseUrl = '';
                this.body = '';
                this.cookies = {};
            Severity: Minor
            Found in src/request.ts - About 1 hr to fix

              Function resetMocked has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public resetMocked() {
                  // Properties
                  this.headers = {};
                  this.headersSent = false;
                  this.locals = {};
              Severity: Minor
              Found in src/response.ts - About 1 hr to fix

                Function resetMocked has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public resetMocked() {
                    // Properties
                    this.locals = {};
                    this.error = {};
                    this.mountpath = '';
                Severity: Minor
                Found in src/express.ts - About 1 hr to fix

                  Function setUrl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public setUrl(url: string, options?: IRequestOptions) {
                      const parsedUrl = parse(url, true);
                  
                      this.path = parsedUrl.pathname || '/';
                      this.hostname = parsedUrl.hostname || '';
                  Severity: Minor
                  Found in src/request.ts - About 1 hr to fix

                    Line length
                    Open

                    Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
                    Severity: Info
                    Found in CODE_OF_CONDUCT.md by markdownlint

                    MD013 - Line length

                    Tags: line_length

                    Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

                    This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

                    This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

                    You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

                    Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

                    Line length
                    Open

                    Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
                    Severity: Info
                    Found in CODE_OF_CONDUCT.md by markdownlint

                    MD013 - Line length

                    Tags: line_length

                    Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

                    This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

                    This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

                    You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

                    Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

                    Fenced code blocks should be surrounded by blank lines
                    Open

                    ```js
                    Severity: Info
                    Found in README.md by markdownlint

                    MD031 - Fenced code blocks should be surrounded by blank lines

                    Tags: code, blank_lines

                    Aliases: blanks-around-fences

                    This rule is triggered when fenced code blocks are either not preceded or not followed by a blank line:

                    Some text
                    ```
                    Code block
                    ```
                    
                    ```
                    Another code block
                    ```
                    Some more text

                    To fix this, ensure that all fenced code blocks have a blank line both before and after (except where the block is at the beginning or end of the document):

                    Some text
                    
                    ```
                    Code block
                    ```
                    
                    ```
                    Another code block
                    ```
                    
                    Some more text

                    Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse fenced code blocks that don't have blank lines before and after them.

                    Fenced code blocks should be surrounded by blank lines
                    Open

                    ```js
                    Severity: Info
                    Found in README.md by markdownlint

                    MD031 - Fenced code blocks should be surrounded by blank lines

                    Tags: code, blank_lines

                    Aliases: blanks-around-fences

                    This rule is triggered when fenced code blocks are either not preceded or not followed by a blank line:

                    Some text
                    ```
                    Code block
                    ```
                    
                    ```
                    Another code block
                    ```
                    Some more text

                    To fix this, ensure that all fenced code blocks have a blank line both before and after (except where the block is at the beginning or end of the document):

                    Some text
                    
                    ```
                    Code block
                    ```
                    
                    ```
                    Another code block
                    ```
                    
                    Some more text

                    Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse fenced code blocks that don't have blank lines before and after them.

                    Inline HTML
                    Open

                        <td align="center"><a href="https://github.com/G07cha"><img src="https://avatars3.githubusercontent.com/u/6943514?v=4" width="100px;" alt=""/><br /><sub><b>Konstantin Azizov</b></sub></a><br /><a href="https://github.com/jameswlane/jest-express/commits?author=G07cha" title="Documentation">📖</a></td>
                    Severity: Info
                    Found in README.md by markdownlint

                    MD033 - Inline HTML

                    Tags: html

                    Aliases: no-inline-html

                    This rule is triggered whenever raw HTML is used in a markdown document:

                    Inline HTML header

                    To fix this, use 'pure' markdown instead of including raw HTML:

                    # Markdown header

                    Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

                    Fenced code blocks should be surrounded by blank lines
                    Open

                    ```js
                    Severity: Info
                    Found in README.md by markdownlint

                    MD031 - Fenced code blocks should be surrounded by blank lines

                    Tags: code, blank_lines

                    Aliases: blanks-around-fences

                    This rule is triggered when fenced code blocks are either not preceded or not followed by a blank line:

                    Some text
                    ```
                    Code block
                    ```
                    
                    ```
                    Another code block
                    ```
                    Some more text

                    To fix this, ensure that all fenced code blocks have a blank line both before and after (except where the block is at the beginning or end of the document):

                    Some text
                    
                    ```
                    Code block
                    ```
                    
                    ```
                    Another code block
                    ```
                    
                    Some more text

                    Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse fenced code blocks that don't have blank lines before and after them.

                    Line length
                    Open

                        <td align="center"><a href="https://github.com/mattmarcello"><img src="https://avatars2.githubusercontent.com/u/4753479?v=4" width="100px;" alt=""/><br /><sub><b>mattmarcello</b></sub></a><br /><a href="https://github.com/jameswlane/jest-express/commits?author=mattmarcello" title="Code">💻</a> <a href="https://github.com/jameswlane/jest-express/commits?author=mattmarcello" title="Tests">⚠️</a></td>
                    Severity: Info
                    Found in README.md by markdownlint

                    MD013 - Line length

                    Tags: line_length

                    Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

                    This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

                    This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

                    You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

                    Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

                    Inline HTML
                    Open

                      <tr>
                    Severity: Info
                    Found in README.md by markdownlint

                    MD033 - Inline HTML

                    Tags: html

                    Aliases: no-inline-html

                    This rule is triggered whenever raw HTML is used in a markdown document:

                    Inline HTML header

                    To fix this, use 'pure' markdown instead of including raw HTML:

                    # Markdown header

                    Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

                    Severity
                    Category
                    Status
                    Source
                    Language