Skip to content

Commit

Permalink
Merge pull request #70 from sensiolabs/fix-failure-conditions-update-…
Browse files Browse the repository at this point in the history
…deps

Fix failure condition evaluation
  • Loading branch information
tgalopin committed Jan 29, 2018
2 parents 545d0f8 + 042f0ba commit ab62ceb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
18 changes: 10 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ cache:
directories:
- $HOME/.composer/cache/files

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
matrix:
include:
- php: 5.3
dist: precise
- php: 5.4
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
- php: hhvm

before_script:
- composer install
Expand Down
9 changes: 8 additions & 1 deletion Cli/Helper/FailConditionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ public function __construct()

public function evaluate(Analysis $analysis, $expr)
{
$analysisData = array(
'grade' => $analysis->getGrade(),
'nbViolations' => 0,
'remediationCost' => $analysis->getRemediationCost(),
);

$counts = array(
// Category
'architecture' => 0,
Expand All @@ -48,10 +54,11 @@ public function evaluate(Analysis $analysis, $expr)
foreach ($violations as $violation) {
++$counts[$violation->getCategory()];
++$counts[$violation->getSeverity()];
++$analysisData['nbViolations'];
}

$vars = array(
'analysis' => $analysis,
'analysis' => (object) $analysisData,
'counts' => (object) $counts,
);

Expand Down

0 comments on commit ab62ceb

Please sign in to comment.