diff --git a/Policies/double_file_extensions.policy.yml b/Policies/double_file_extensions.policy.yml index 5f0f25d..7a98b59 100644 --- a/Policies/double_file_extensions.policy.yml +++ b/Policies/double_file_extensions.policy.yml @@ -19,7 +19,8 @@ parameters: default: "%root/sites" exclude: default: - - sites/default/files/js + - "sites/default/files/js" + - "sites/default/files/js/optimized" filetypes: default: - php diff --git a/src/Audit/DoubleFileExtension.php b/src/Audit/DoubleFileExtension.php index 6fd7d61..4114959 100644 --- a/src/Audit/DoubleFileExtension.php +++ b/src/Audit/DoubleFileExtension.php @@ -76,7 +76,6 @@ public function audit(Sandbox $sandbox) { } $matches = array_filter(explode(PHP_EOL, $output)); - $matches = array_map(function ($line) { list($filepath, $date) = explode(' ', $line); return [ @@ -87,6 +86,10 @@ public function audit(Sandbox $sandbox) { ]; }, $matches); + $matches = array_filter($matches, function($line) { + return !strpos($line['basename'], 'js.gz') !== false; + }); + $results = [ 'found' => count($matches), 'findings' => $matches, @@ -95,8 +98,7 @@ public function audit(Sandbox $sandbox) { }, $matches))) ]; - - //TODO: Add a condiational check for Markdown format + //TODO: Add a conditional check for Markdown format $columns = ['Basename', 'Date', 'Filename']; $rows = []; foreach ($results['findings'] as $key => $file) { @@ -104,8 +106,7 @@ public function audit(Sandbox $sandbox) { } $md_table = new MarkdownTableGenerator($columns, $rows); - - $results['findings'][] = ['markdown_display' => $md_table->render()]; + $results['findings'] = ['markdown_display' => $md_table->render()]; $sandbox->setParameter('results', $results);