mygento/minify

View on GitHub

Showing 4 of 4 total issues

Method mergeFiles has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function mergeFiles(array $srcFiles, $targetFile = false, $mustMerge = false, $beforeMergeCallback = null, $extensionsFilter = array())
    {
        $content_type = pathinfo($targetFile, PATHINFO_EXTENSION);
        if (!Mage::getStoreConfig('minify/general/enabled') || ($content_type != 'css' && $content_type != 'js')) {
            return parent::mergeFiles($srcFiles, $targetFile, $mustMerge, $beforeMergeCallback, $extensionsFilter);
Severity: Minor
Found in app/code/community/Mygento/Minify/Helper/Rewrite/Core/Data.php - About 1 hr to fix

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

        protected function shouldMinify($mustMerge, $targetFile, $srcFiles)
        {
            // check whether merger is required
            $shouldMerge = $mustMerge || !$targetFile;
            if (!$shouldMerge) {
    Severity: Minor
    Found in app/code/community/Mygento/Minify/Helper/Rewrite/Core/Data.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 mergeFiles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function mergeFiles(array $srcFiles, $targetFile = false, $mustMerge = false, $beforeMergeCallback = null, $extensionsFilter = array())
        {
            $content_type = pathinfo($targetFile, PATHINFO_EXTENSION);
            if (!Mage::getStoreConfig('minify/general/enabled') || ($content_type != 'css' && $content_type != 'js')) {
                return parent::mergeFiles($srcFiles, $targetFile, $mustMerge, $beforeMergeCallback, $extensionsFilter);
    Severity: Minor
    Found in app/code/community/Mygento/Minify/Helper/Rewrite/Core/Data.php - About 55 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

    Method mergeFiles has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function mergeFiles(array $srcFiles, $targetFile = false, $mustMerge = false, $beforeMergeCallback = null, $extensionsFilter = array())
    Severity: Minor
    Found in app/code/community/Mygento/Minify/Helper/Rewrite/Core/Data.php - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language