1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

Apply various linter fixes.

Summary: Applied various linter fixes. Also make the `.editorconfig` file a bit more specific. Unfortunately, `arc lint --apply-patches` currently modifies some test data that it shouldn't, but this should be fixed after T5105.

Test Plan: Ran `arc unit` to make sure things weren't broken.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, aurelijus

Differential Revision: https://secure.phabricator.com/D9440
This commit is contained in:
Joshua Spence 2014-06-10 11:02:42 -07:00 committed by epriestley
parent b60eaa6487
commit ff1915ecff
19 changed files with 43 additions and 43 deletions

View file

@ -11,11 +11,11 @@ insert_final_newline = true
trim_trailing_whitespace = false
insert_final_newline = false
[src/parser/__tests__/diff/*]
[src/parser/__tests__/diff/*.{git,hg,svn,u}diff]
trim_trailing_whitespace = false
insert_final_newline = false
[src/parser/__tests__/patches/*]
[src/parser/__tests__/patches/*.gitpatch]
trim_trailing_whitespace = false
insert_final_newline = false

View file

@ -68,8 +68,8 @@ final class ArcanistJSONLintLinter extends ArcanistExternalLinter {
foreach ($lines as $line) {
$matches = null;
$match = preg_match(
'/^(?:(?<path>.+): )?' .
'line (?<line>\d+), col (?<column>\d+), ' .
'/^(?:(?<path>.+): )?'.
'line (?<line>\d+), col (?<column>\d+), '.
'(?<description>.*)$/',
$line,
$matches);

View file

@ -131,8 +131,8 @@ final class ArcanistLesscLinter extends ArcanistExternalLinter {
foreach ($lines as $line) {
$matches = null;
$match = preg_match(
'/^(?P<name>\w+): (?P<description>.+) ' .
'in (?P<path>.+|-) ' .
'/^(?P<name>\w+): (?P<description>.+) '.
'in (?P<path>.+|-) '.
'on line (?P<line>\d+), column (?P<column>\d+):$/',
$line,
$matches);

View file

@ -252,7 +252,7 @@ final class ArcanistTextLinter extends ArcanistLinter {
$this->raiseLintAtOffset(
$offset,
self::LINT_BOF_WHITESPACE,
'This file contains leading whitespace at the beginning of the file. ' .
'This file contains leading whitespace at the beginning of the file. '.
'This is unnecessary and should be avoided when possible.',
$string,
'');
@ -276,7 +276,7 @@ final class ArcanistTextLinter extends ArcanistLinter {
$this->raiseLintAtOffset(
$offset,
self::LINT_EOF_WHITESPACE,
'This file contains trailing whitespace at the end of the file. This ' .
'This file contains trailing whitespace at the end of the file. This '.
'is unnecessary and should be avoided when possible.',
$string,
'');

View file

@ -1081,8 +1081,8 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$this->raiseLintAtNode(
$var,
self::LINT_REUSED_ITERATOR_REFERENCE,
'This variable was used already as a by-reference iterator ' .
'variable. Such variables survive outside the foreach loop, ' .
'This variable was used already as a by-reference iterator '.
'variable. Such variables survive outside the foreach loop, '.
'do not reuse.');
}
}

View file

@ -62,7 +62,7 @@ final class ArcanistLintConsoleRenderer extends ArcanistLintRenderer {
if ($text) {
$prefix = phutil_console_format("**>>>** Lint for __%s__:\n\n\n", $path);
return $prefix . implode("\n", $text);
return $prefix.implode("\n", $text);
} else {
return null;
}

View file

@ -279,7 +279,7 @@ final class ArcanistDiffParser {
"Expected a hunk header, like 'Index: /path/to/file.ext' (svn), ".
"'Property changes on: /path/to/file.ext' (svn properties), ".
"'commit 59bcc3ad6775562f845953cf01624225' (git show), ".
"'diff --git' (git diff), '--- filename' (unified diff), or " .
"'diff --git' (git diff), '--- filename' (unified diff), or ".
"'diff -r' (hg diff or patch).");
}

View file

@ -128,7 +128,7 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
foreach ($files as $path => $mask) {
foreach ($externals as $external) {
if (!strncmp($path . '/', $external . '/', strlen($external) + 1)) {
if (!strncmp($path.'/', $external.'/', strlen($external) + 1)) {
$files[$path] |= self::FLAG_EXTERNALS;
}
}

View file

@ -27,7 +27,7 @@ final class ArcanistRepositoryAPIStateTestCase extends ArcanistTestCase {
}
private function parseState($test) {
$dir = dirname(__FILE__) . '/state/';
$dir = dirname(__FILE__).'/state/';
$fixture = PhutilDirectoryFixture::newFromArchive($dir.'/'.$test);
$fixture_path = $fixture->getPath();

View file

@ -91,7 +91,7 @@ final class NoseTestEngine extends ArcanistBaseUnitTestEngine {
$xunit_tmp);
if ($this->getEnableCoverage() !== false) {
$cmd_line .= csprintf(' --with-coverage --cover-xml ' .
$cmd_line .= csprintf(' --with-coverage --cover-xml '.
'--cover-xml-file=%s',
$cover_tmp);
}

View file

@ -56,7 +56,7 @@ final class PhpunitResultParser extends ArcanistBaseTestResultParser {
if ('fail' == $event->status) {
$status = ArcanistUnitTestResult::RESULT_FAIL;
$user_data .= $event->message . "\n";
$user_data .= $event->message."\n";
foreach ($event->trace as $trace) {
$user_data .= sprintf("\n%s:%s", $trace->file, $trace->line);
}
@ -150,7 +150,7 @@ final class PhpunitResultParser extends ArcanistBaseTestResultParser {
$coverage .= 'N';
}
$len = strlen($this->projectRoot . DIRECTORY_SEPARATOR);
$len = strlen($this->projectRoot.DIRECTORY_SEPARATOR);
$class_path = substr($class_path, $len);
$reports[$class_path] = $coverage;
}
@ -169,16 +169,16 @@ final class PhpunitResultParser extends ArcanistBaseTestResultParser {
private function getJsonReport($json) {
if (empty($json)) {
throw new Exception('JSON report file is empty, '
. 'it probably means that phpunit failed to run tests. '
. 'Try running arc unit with --trace option and then run '
. 'generated phpunit command yourself, you might get the '
. 'answer.'
throw new Exception('JSON report file is empty, '.
'it probably means that phpunit failed to run tests. '.
'Try running arc unit with --trace option and then run '.
'generated phpunit command yourself, you might get the '.
'answer.'
);
}
$json = preg_replace('/}{\s*"/', '},{"', $json);
$json = '[' . $json . ']';
$json = '['.$json.']';
$json = json_decode($json);
if (!is_array($json)) {
throw new Exception('JSON could not be decoded');

View file

@ -261,16 +261,16 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
* based on phpunit_config option in .arcconfig
*/
private function prepareConfigFile() {
$project_root = $this->projectRoot . DIRECTORY_SEPARATOR;
$project_root = $this->projectRoot.DIRECTORY_SEPARATOR;
$config = $this->getConfigurationManager()->getConfigFromAnySource(
'phpunit_config');
if ($config) {
if (Filesystem::pathExists($project_root . $config)) {
$this->configFile = $project_root . $config;
if (Filesystem::pathExists($project_root.$config)) {
$this->configFile = $project_root.$config;
} else {
throw new Exception('PHPUnit configuration file was not ' .
'found in ' . $project_root . $config);
throw new Exception('PHPUnit configuration file was not '.
'found in '.$project_root.$config);
}
}
$bin = $this->getConfigurationManager()->getConfigFromAnySource(

View file

@ -791,7 +791,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
if ($this->stashed) {
$api = $this->getRepositoryAPI();
$api->unstashChanges();
echo pht('Restored stashed changes to the working directory.') . "\n";
echo pht('Restored stashed changes to the working directory.')."\n";
}
}

View file

@ -351,7 +351,7 @@ EOTEXT
foreach ($out as &$feature) {
unset($feature['color'], $feature['ssort'], $feature['esort']);
}
echo json_encode(ipull($out, null, 'name')) . "\n";
echo json_encode(ipull($out, null, 'name'))."\n";
} else {
$console = PhutilConsole::getConsole();
foreach ($out as $line) {

View file

@ -309,7 +309,7 @@ EOTEXT
$this->branch,
$this->onto);
if (!$this->isHistoryImmutable()) {
$message .= ' ' . pht("You may be able to 'arc amend' instead.");
$message .= ' '.pht("You may be able to 'arc amend' instead.");
}
throw new ArcanistUsageException($message);
}
@ -571,7 +571,7 @@ EOTEXT
} else if ($this->isHg) {
echo phutil_console_format(pht(
'Updating **%s**...',
$this->onto) . "\n");
$this->onto)."\n");
try {
list($out, $err) = $repository_api->execxLocal('pull');
@ -962,7 +962,7 @@ EOTEXT
if ($this->getArgument('hold')) {
echo phutil_console_format(pht(
'Holding change in **%s**: it has NOT been pushed yet.',
$this->onto). "\n");
$this->onto)."\n");
} else {
echo pht('Pushing change...'), "\n\n";

View file

@ -63,7 +63,7 @@ EOTEXT
return array(
'lintall' => array(
'help' =>
'Show all lint warnings, not just those on changed lines. When ' .
'Show all lint warnings, not just those on changed lines. When '.
'paths are specified, this is the default behavior.',
'conflicts' => array(
'only-changed' => true,
@ -71,9 +71,9 @@ EOTEXT
),
'only-changed' => array(
'help' =>
'Show lint warnings just on changed lines. When no paths are ' .
'specified, this is the default. This differs from only-new ' .
'in cases where line modifications introduce lint on other ' .
'Show lint warnings just on changed lines. When no paths are '.
'specified, this is the default. This differs from only-new '.
'in cases where line modifications introduce lint on other '.
'unmodified lines.',
'conflicts' => array(
'lintall' => true,

View file

@ -984,12 +984,12 @@ EOTEXT
$source_revision = $this->loadRevisionFromHash($hash);
if ($bundle_revision) {
$bundle_base_rev_str = $bundle_base_rev .
' \ D' . $bundle_revision['id'];
$bundle_base_rev_str = $bundle_base_rev.
' \ D'.$bundle_revision['id'];
}
if ($source_revision) {
$source_base_rev_str = $source_base_rev .
' \ D' . $source_revision['id'];
$source_base_rev_str = $source_base_rev.
' \ D'.$source_revision['id'];
}
}
$bundle_base_rev_str = nonempty($bundle_base_rev_str,