gboudreau/Greyhole

View on GitHub
includes/Tasks/WriteTask.php

Summary

Maintainability
F
3 days
Test Coverage

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

    public function execute() {
        $share = $this->share;
        $full_path = $this->full_path;
        $task_id = $this->id;

Severity: Minor
Found in includes/Tasks/WriteTask.php - About 1 day 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 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute() {
        $share = $this->share;
        $full_path = $this->full_path;
        $task_id = $this->id;

Severity: Major
Found in includes/Tasks/WriteTask.php - About 4 hrs to fix

    Function gh_write_process_metafiles has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        private function gh_write_process_metafiles($num_copies_required, $existing_metafiles, $share, $full_path, $source_file, $filesize, $task_id, $keys_to_remove=NULL) {
            $landing_zone = get_share_landing_zone($share);
            list($path, $filename) = explode_full_path($full_path);
    
            // Only need to check for locking if we have something to do!
    Severity: Minor
    Found in includes/Tasks/WriteTask.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 gh_write_process_metafiles has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function gh_write_process_metafiles($num_copies_required, $existing_metafiles, $share, $full_path, $source_file, $filesize, $task_id, $keys_to_remove=NULL) {
            $landing_zone = get_share_landing_zone($share);
            list($path, $filename) = explode_full_path($full_path);
    
            // Only need to check for locking if we have something to do!
    Severity: Minor
    Found in includes/Tasks/WriteTask.php - About 1 hr to fix

      Method gh_write_process_metafiles has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function gh_write_process_metafiles($num_copies_required, $existing_metafiles, $share, $full_path, $source_file, $filesize, $task_id, $keys_to_remove=NULL) {
      Severity: Major
      Found in includes/Tasks/WriteTask.php - About 1 hr 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 $new_metafiles;
          Severity: Major
          Found in includes/Tasks/WriteTask.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 $new_metafiles;
              Severity: Major
              Found in includes/Tasks/WriteTask.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status