jbielick/faktory_worker_node

View on GitHub

Showing 7 of 11 total issues

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

export class Job {
  client: Client;
  payload: JobPayload;
  /**
   * Creates a job
Severity: Minor
Found in src/job.ts - About 2 hrs to fix

    Function create has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function create(): FaktoryControl {
      const middleware: Middleware[] = [];
      const registry: Registry = {};
      let worker: Worker | undefined;
    
    
    Severity: Minor
    Found in src/faktory.ts - About 1 hr to fix

      Function stop has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async stop(): Promise<void> {
          Worker.removeSignalHandlers();
          debug("stop");
          this.quiet();
          clearInterval(this.pulse);
      Severity: Minor
      Found in src/worker.ts - About 1 hr to fix

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

          constructor(options: WorkerOptions = {}) {
            super();
            this.wid = options.wid || uuid().slice(0, 8);
            this.concurrency = options.concurrency || 20;
            this.shutdownTimeout = (options.timeout || 8) * 1000;
        Severity: Minor
        Found in src/worker.ts - About 1 hr to fix

          Function create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          export function create(): FaktoryControl {
            const middleware: Middleware[] = [];
            const registry: Registry = {};
            let worker: Worker | undefined;
          
          
          Severity: Minor
          Found in src/faktory.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 7 (exceeds 5 allowed). Consider refactoring.
          Open

            constructor(options: WorkerOptions = {}) {
              super();
              this.wid = options.wid || uuid().slice(0, 8);
              this.concurrency = options.concurrency || 20;
              this.shutdownTimeout = (options.timeout || 8) * 1000;
          Severity: Minor
          Found in src/worker.ts - About 35 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 tick has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            private async tick(): Promise<void> {
              if (this.quieted) return;
              try {
                if (this.working.size >= this.concurrency) {
                  await Promise.race(this.working.values());
          Severity: Minor
          Found in src/worker.ts - About 35 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