jeansaad/hotel

View on GitHub

Showing 11 of 29 total issues

File group.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const fs = require("fs");
const path = require("path");
const EventEmitter = require("events");
const url = require("url");
const once = require("once");
Severity: Minor
Found in src/daemon/group.js - About 3 hrs to fix

    Function add has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    function add(param, opts = {}) {
      mkdirp.sync(serversDir);
    
      const cwd = opts.dir || process.cwd();
      const id = opts.name ? domainify(opts.name) : getId(cwd);
    Severity: Minor
    Found in src/cli/servers.js - 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 getKeydownListener has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      public getKeydownListener(store: Store) {
        if (this.keydownListener == null) {
          this.keydownListener = (event: KeyboardEvent) => {
            const selectedMonitor = store.monitors.get(store.selectedMonitorId);
            const isSelectedMonitorRunning = selectedMonitor?.status === RUNNING
    Severity: Minor
    Found in src/app/components/Content/index.tsx - 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 add has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function add(param, opts = {}) {
      mkdirp.sync(serversDir);
    
      const cwd = opts.dir || process.cwd();
      const id = opts.name ? domainify(opts.name) : getId(cwd);
    Severity: Major
    Found in src/cli/servers.js - About 2 hrs to fix

      Function add has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        add(id, conf) {
          if (conf.target) {
            log(`Add target ${id}`);
            this._list[id] = conf;
            this._change();
      Severity: Major
      Found in src/daemon/group.js - About 2 hrs to fix

        Function handleConnect has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          handleConnect(req, socket, head) {
            if (req.headers.host) {
              const { host } = req.headers;
              const { id, hostname, port } = this.parseHost(host);
        
        
        Severity: Minor
        Found in src/daemon/group.js - 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 render has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public render() {
            const { store } = this.props
            const monitor = store.monitors.get(store.selectedMonitorId)
            return (
              <div
        Severity: Minor
        Found in src/app/components/Content/index.tsx - About 1 hr to fix

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

            handleUpgrade(req, socket, head) {
              if (req.headers.host) {
                const { host } = req.headers;
                const { id, port } = this.parseHost(host);
                const item = this.find(id);
          Severity: Minor
          Found in src/daemon/group.js - 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 getKeydownListener has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public getKeydownListener(store: Store) {
              if (this.keydownListener == null) {
                this.keydownListener = (event: KeyboardEvent) => {
                  const selectedMonitor = store.monitors.get(store.selectedMonitorId);
                  const isSelectedMonitorRunning = selectedMonitor?.status === RUNNING
          Severity: Minor
          Found in src/app/components/Content/index.tsx - About 1 hr to fix

            Function handleConnect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              handleConnect(req, socket, head) {
                if (req.headers.host) {
                  const { host } = req.headers;
                  const { id, hostname, port } = this.parseHost(host);
            
            
            Severity: Minor
            Found in src/daemon/group.js - About 1 hr to fix

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

                spawn(cmd, opts = {}) {
                  const cleanAndExit = (code = 0) => {
                    servers.rm(opts);
                    this._exit(code);
                  };
              Severity: Minor
              Found in src/cli/run.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language