Skip to content

Commit

Permalink
properly handle dependencies in setLinterConfigurationValue
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentinas Bartusevičius committed Dec 5, 2018
1 parent 61fc0aa commit 04542e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 1.3.2

### Fixed
- properly handle dependencies in `setLinterConfigurationValue`

## 1.2.0

### Added
Expand Down
8 changes: 7 additions & 1 deletion src/Lint/Linter/PhpCsFixerLinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class PhpCsFixerLinter extends \ArcanistExternalLinter
{
const U_DIFF_FLAG = '--diff-format=udiff';

/**
* @var array
*/
Expand Down Expand Up @@ -47,7 +49,7 @@ public function __construct(LinterConfiguration $configuration = null)
version_compare($this->getVersion(), '2.8.0', '>=')
&& $this->configuration->isUnifiedDiffFormat()
) {
$this->defaultFlags[] = '--diff-format=udiff';
$this->defaultFlags[] = self::U_DIFF_FLAG;
$unifiedDiffFormat = true;
}

Expand Down Expand Up @@ -138,6 +140,10 @@ public function setLinterConfigurationValue($key, $value)
return;
case 'unified_diff_format':
$this->configuration->setUnifiedDiffFormat($value);
$this->lintMessageBuilder = new LintMessageBuilder($value);
if ($value === false && in_array(self::U_DIFF_FLAG, $this->defaultFlags, true)) {
unset($this->defaultFlags[array_search(self::U_DIFF_FLAG, $this->defaultFlags)]);
}
return;
}

Expand Down

0 comments on commit 04542e7

Please sign in to comment.