gboudreau/Greyhole

View on GitHub
includes/Tasks/RemoveTask.php

Summary

Maintainability
C
1 day
Test Coverage

Function execute has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $this->drive = $this->full_path;

        // Removing this drive here will insure it won't be used for new files while we're moving files away, and that it can later be replaced.
        StoragePool::remove_drive($this->drive);
Severity: Minor
Found in includes/Tasks/RemoveTask.php - About 4 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 execute has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute() {
        $this->drive = $this->full_path;

        // Removing this drive here will insure it won't be used for new files while we're moving files away, and that it can later be replaced.
        StoragePool::remove_drive($this->drive);
Severity: Major
Found in includes/Tasks/RemoveTask.php - About 2 hrs to fix

    Function check_going_dir has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function check_going_dir($path, $share, $going_drive) {
            $handle = @opendir($path);
            if ($handle === FALSE) {
                Log::error("Couldn't open $path to list content. Skipping...", Log::EVENT_CODE_LIST_DIR_FAILED);
                return;
    Severity: Minor
    Found in includes/Tasks/RemoveTask.php - 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

    Method check_going_dir has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected static function check_going_dir($path, $share, $going_drive) {
            $handle = @opendir($path);
            if ($handle === FALSE) {
                Log::error("Couldn't open $path to list content. Skipping...", Log::EVENT_CODE_LIST_DIR_FAILED);
                return;
    Severity: Minor
    Found in includes/Tasks/RemoveTask.php - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status