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.locals = {};
                  this.error = {};
                  this.mountpath = '';
              Severity: Minor
              Found in src/express.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 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

                    Lists should be surrounded by blank lines
                    Open

                     - OS: [e.g. iOS]

                    MD032 - Lists should be surrounded by blank lines

                    Tags: bullet, ul, ol, blank_lines

                    Aliases: blanks-around-lists

                    This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

                    Some text
                    * Some
                    * List
                    
                    1. Some
                    2. List
                    Some text

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

                    Some text
                    
                    * Some
                    * List
                    
                    1. Some
                    2. List
                    
                    Some text

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

                    Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

                    * This is
                    not okay
                    
                    * This is
                      okay

                    Trailing spaces
                    Open

                     
                    Severity: Info
                    Found in README.md by markdownlint

                    MD009 - Trailing spaces

                    Tags: whitespace

                    Aliases: no-trailing-spaces

                    Parameters: br_spaces (number; default: 0)

                    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

                    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

                    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

                    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="http://sheerun.net"><img src="https://avatars0.githubusercontent.com/u/292365?v=4" width="100px;" alt=""/><br /><sub><b>Adam Stankiewicz</b></sub></a><br /><a href="https://github.com/jameswlane/jest-express/issues?q=author%3Asheerun" title="Bug reports">🐛</a> <a href="https://github.com/jameswlane/jest-express/commits?author=sheerun" title="Code">💻</a> <a href="https://github.com/jameswlane/jest-express/commits?author=sheerun" title="Documentation">📖</a> <a href="https://github.com/jameswlane/jest-express/commits?author=sheerun" title="Tests">⚠️</a> <a href="#example-sheerun" title="Examples">💡</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.

                    Multiple consecutive blank lines
                    Open

                    
                    
                    Severity: Info
                    Found in ISSUE_TEMPLATE.md by markdownlint

                    MD012 - Multiple consecutive blank lines

                    Tags: whitespace, blank_lines

                    Aliases: no-multiple-blanks

                    This rule is triggered when there are multiple consecutive blank lines in the document:

                    Some text here
                    
                    
                    Some more text here

                    To fix this, delete the offending lines:

                    Some text here
                    
                    Some more text here

                    Note: this rule will not be triggered if there are multiple consecutive blank lines inside code blocks.

                    Line length
                    Open

                        <td align="center"><a href="https://www.maxholman.com"><img src="https://avatars3.githubusercontent.com/u/250517?v=4" width="100px;" alt=""/><br /><sub><b>Max Holman</b></sub></a><br /><a href="https://github.com/jameswlane/jest-express/commits?author=maxholman" title="Code">💻</a> <a href="https://github.com/jameswlane/jest-express/commits?author=maxholman" 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.

                    Dollar signs used before commands without showing output
                    Open

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

                    MD014 - Dollar signs used before commands without showing output

                    Tags: code

                    Aliases: commands-show-output

                    This rule is triggered when there are code blocks showing shell commands to be typed, and the shell commands are preceded by dollar signs ($):

                    $ ls
                    $ cat foo
                    $ less bar

                    The dollar signs are unnecessary in the above situation, and should not be included:

                    ls
                    cat foo
                    less bar

                    However, an exception is made when there is a need to distinguish between typed commands and command output, as in the following example:

                    $ ls
                    foo bar
                    $ cat foo
                    Hello world
                    $ cat bar
                    baz

                    Rationale: it is easier to copy and paste and less noisy if the dollar signs are omitted when they are not needed. See http://www.cirosantilli.com/markdown-styleguide/#dollar-signs-in-shell-code for more information.

                    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.

                    Severity
                    Category
                    Status
                    Source
                    Language