josephj/assetla

View on GitHub

Showing 8 of 8 total issues

Method execute has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute() {
        // Check options
        $options = $this->getOptions();
        $this->origin_config_path = $options['config']->value;
        $this->output_config_path = $options['output']->value;
Severity: Minor
Found in src/command/DeployCommand.php - About 1 hr to fix

    Method iterate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function iterate($name, $type) {
            $file = $this->assetla->combine($name, $type, true, true);
            // Get MIME Type
            $extension = end(explode('.', $file));
            if ($extension === 'js') {
    Severity: Minor
    Found in src/command/DeployCommand.php - About 1 hr to fix

      Method save has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function save($target_dir = null) {
              // Decide output directory.
              if ( ! isset($target_dir)) { // via argument
                  if (isset($this->config->output_path)) { // via config
                      $target_dir = $this->config->output_path;
      Severity: Minor
      Found in src/AssetlaFile.php - About 1 hr to fix

        Function save has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function save($target_dir = null) {
                // Decide output directory.
                if ( ! isset($target_dir)) { // via argument
                    if (isset($this->config->output_path)) { // via config
                        $target_dir = $this->config->output_path;
        Severity: Minor
        Found in src/AssetlaFile.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

        Function iterate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function iterate($name, $type) {
                $file = $this->assetla->combine($name, $type, true, true);
                // Get MIME Type
                $extension = end(explode('.', $file));
                if ($extension === 'js') {
        Severity: Minor
        Found in src/command/DeployCommand.php - About 45 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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function execute() {
                // Check options
                $options = $this->getOptions();
                $this->origin_config_path = $options['config']->value;
                $this->output_config_path = $options['output']->value;
        Severity: Minor
        Found in src/command/DeployCommand.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 get_tags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function get_tags($module, $type, $combined = false) {
                if ($type === 'css') {
                    $template = '<link rel="stylesheet" href="%s">';
                } elseif ($type === 'js') {
                    $template = '<script src="%s"></script>';
        Severity: Minor
        Found in src/Assetla.php - About 25 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 combine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function combine($module, $type, $is_minify = false, $has_stamp = false) {
                $files = $this->config['modules'][$module][$type];
                if (!$is_minify) {
                    $save_path = $this->config['output_path'] . "/$module.$type";
                } else {
        Severity: Minor
        Found in src/Assetla.php - About 25 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

        Severity
        Category
        Status
        Source
        Language