gboudreau/Greyhole

View on GitHub

Showing 334 of 371 total issues

Function glob_dir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function glob_dir($dir) {
        $dir = new DirectoryIterator($dir);
        foreach ($dir as $fileinfo) {
            if ($fileinfo->isDot()) {
                continue;
Severity: Minor
Found in includes/CLI/CopyCliRunner.php - 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 output has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function output() {
        $num_lines = 0;
        $cols = exec('tput cols');

        printf("Watching every %ds:%s%s\n", $this->refresh_interval, str_repeat(' ', $cols - 50), date('r'));
Severity: Minor
Found in includes/CLI/BalanceStatusCliRunner.php - 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 parse_line_hook has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function parse_line_hook($name, $value) {
        if (string_starts_with($name, CONFIG_HOOK)) {
            if (!preg_match('/hook\[([^]]+)]/', $name, $re)) {
                Log::warn("Can't parse the following config line: $name; ignoring.", Log::EVENT_CODE_CONFIG_UNPARSEABLE_LINE);
                return TRUE;
Severity: Minor
Found in includes/ConfigHelper.php - 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 migrate_9_complete_writen has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function migrate_9_complete_writen() {
        $query = "DESCRIBE tasks";
        $rows = DB::getAll($query);
        foreach ($rows as $row) {
            if ($row->Field == 'complete') {
Severity: Minor
Found in includes/DB.php - 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 confirmFsckCommand has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function confirmFsckCommand() {
    let params = getFsckParams();
    let command = "greyhole --fsck ";
    for (let k in params) {
        let v = params[k];
Severity: Minor
Found in web-app/scripts.js - 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 migrate_3_larger_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function migrate_3_larger_settings() {
        $query = "DESCRIBE settings";
        $rows = DB::getAll($query);
        foreach ($rows as $row) {
            if ($row->Field == 'value') {
Severity: Minor
Found in includes/DB.php - 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 gh_symlink has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function gh_symlink($target, $link) {
    global $use_alt_symlinks_creation;
    $success = !$use_alt_symlinks_creation && symlink($target, $link);
    if (!$success) {
        exec("ln -s " . escapeshellarg($target) . " " . escapeshellarg($link));
Severity: Minor
Found in includes/SystemHelper.php - 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 gh_is_file_locked has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function gh_is_file_locked($real_fullpath) {
    if (is_link($real_fullpath)) {
        $real_fullpath = readlink($real_fullpath);
    }
    $result = exec("lsof -n -P -l " . escapeshellarg($real_fullpath) . " 2> /dev/null");
Severity: Minor
Found in includes/SystemHelper.php - 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

Avoid too many return statements within this method.
Open

        if (self::parse_line_frozen($name, $value)) return;
Severity: Major
Found in includes/ConfigHelper.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            if (self::parse_line_drive_selection($name, $value)) return;
    Severity: Major
    Found in includes/ConfigHelper.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return TRUE;
      Severity: Major
      Found in includes/Tasks/BalanceTask.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                                return -1;
        Severity: Major
        Found in includes/SambaSpool.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return FALSE;
          Severity: Major
          Found in includes/common.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    if (self::parse_line_share_option($name, $value)) return;
            Severity: Major
            Found in includes/ConfigHelper.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return FALSE;
              Severity: Major
              Found in includes/DBSpool.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return TRUE;
                Severity: Major
                Found in includes/Tasks/BalanceTask.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return TRUE;
                  Severity: Major
                  Found in includes/Tasks/WriteTask.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return;
                    Severity: Major
                    Found in includes/Tasks/FsckTask.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return 1;
                      Severity: Major
                      Found in includes/SambaSpool.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                if (self::parse_line_pool_drive($name, $value)) return;
                        Severity: Major
                        Found in includes/ConfigHelper.php - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language