phug-php/watcher

View on GitHub

Showing 6 of 59 total issues

Function run has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(array $cliArguments, $interval = 1000000, $timeout = null, callable $callback = null)
    {
        $watcher = new Watcher();

        $arguments = [];
Severity: Minor
Found in src/Phug/Watcher/Cli.php - About 5 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

Method run has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run(array $cliArguments, $interval = 1000000, $timeout = null, callable $callback = null)
    {
        $watcher = new Watcher();

        $arguments = [];
Severity: Major
Found in src/Phug/Watcher/Cli.php - About 2 hrs to fix

    Method getDocumentEvents has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getDocumentEvents($browserReloadPort)
        {
            if (!$browserReloadPort) {
                return [];
            }
    Severity: Minor
    Found in src/Phug/WatcherExtension.php - About 1 hr to fix

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

          public function getDocumentEvents($browserReloadPort)
          {
              if (!$browserReloadPort) {
                  return [];
              }
      Severity: Minor
      Found in src/Phug/WatcherExtension.php - 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

      Method listen has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function listen()
          {
              $browserReloadPort = $this->browserReloadPort;
              $serverPort = intval($this->server);
              if ($serverPort) {
      Severity: Minor
      Found in src/Phug/PhugDevServer.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                return $watcher->watch($arguments, $interval, $timeout, $callback);
        Severity: Major
        Found in src/Phug/Watcher/Cli.php - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language