node-celery-ts/node-celery-ts

View on GitHub

Showing 6 of 31 total issues

File task.ts has 275 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// BSD 3-Clause License
//
// Copyright (c) 2021, node-celery-ts contributors
// All rights reserved.
//
Severity: Minor
Found in src/task.ts - About 2 hrs to fix

    Function applyAsync has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public applyAsync({
            args,
            compression = Packer.Compressor.Identity,
            eta,
            expires,
    Severity: Minor
    Found in src/task.ts - About 1 hr to fix

      Function addHostUserAndPass has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const addHostUserAndPass = (uri: UriJs.Parts, parsing: Uri): Uri => {
          const withUser = addHostAndUser(uri, parsing);
      
          if (isNullOrUndefined(withUser.authority)) {
              return withUser;
      Severity: Minor
      Found in src/uri.ts - About 1 hr to fix

        Function createUri has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public createUri(): string {
                let uri = "redis";
        
                if (typeof this.options.tls !== "undefined") {
                    uri += "s";
        Severity: Minor
        Found in src/redis/options.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 addQuery has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const addQuery = (uri: UriJs.Parts, parsing: Uri): Uri => {
            const REGEX: RegExp = // tslint:disable:max-line-length
                /^[A-Za-z\d*-._+%]+=[A-Za-z\d*-._+%]*(?:&[A-Za-z\d*-._+%]+=[A-Za-z\d*-._+%+]*)*$/;
        
            if (isNullOrUndefined(uri.query)) {
        Severity: Minor
        Found in src/uri.ts - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

              return [10, matches[DECIMAL_INDEX]];
          Severity: Major
          Found in src/utility.ts - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language