1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 08:58:55 +02:00

Split ArcanistXHPASTLinter::LINT_FORMATTING_CONVENTIONS into seperate lint names

Summary:
Split ArcanistXHPASTLinter::LINT_FORMATTING_CONVENTIONS into seperate
lint names so that each linting rule can be controled sperately

Test Plan:
This shouldn't break anything, if it does we'll know soon enough.
<epriestley> Better things break loudly/obviously I think.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1495
This commit is contained in:
John Du Hart 2012-01-25 19:05:47 -08:00 committed by epriestley
parent c46dbbf61c
commit 08a1219d11

View file

@ -35,7 +35,6 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
const LINT_PHP_CLOSE_TAG = 8;
const LINT_NAMING_CONVENTIONS = 9;
const LINT_IMPLICIT_CONSTRUCTOR = 10;
const LINT_FORMATTING_CONVENTIONS = 11;
const LINT_DYNAMIC_DEFINE = 12;
const LINT_STATIC_THIS = 13;
const LINT_PREG_QUOTE_MISUSE = 14;
@ -48,6 +47,11 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
const LINT_PLUS_OPERATOR_ON_STRINGS = 21;
const LINT_DUPLICATE_KEYS_IN_ARRAY = 22;
const LINT_REUSED_ITERATORS = 23;
const LINT_BRACE_FORMATTING = 24;
const LINT_PARENTHESES_SPACING = 25;
const LINT_CONTROL_STATEMENT_SPACING = 26;
const LINT_BINARY_EXPRESSION_SPACING = 27;
const LINT_ARRAY_INDEX_SPACING = 27;
public function getLintNameMap() {
@ -62,7 +66,6 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
self::LINT_PHP_CLOSE_TAG => 'Use of Close Tag "?>"',
self::LINT_NAMING_CONVENTIONS => 'Naming Conventions',
self::LINT_IMPLICIT_CONSTRUCTOR => 'Implicit Constructor',
self::LINT_FORMATTING_CONVENTIONS => 'Formatting Conventions',
self::LINT_DYNAMIC_DEFINE => 'Dynamic define()',
self::LINT_STATIC_THIS => 'Use of $this in Static Context',
self::LINT_PREG_QUOTE_MISUSE => 'Misuse of preg_quote()',
@ -75,6 +78,11 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
self::LINT_PLUS_OPERATOR_ON_STRINGS => 'Not String Concatenation',
self::LINT_DUPLICATE_KEYS_IN_ARRAY => 'Duplicate Keys in Array',
self::LINT_REUSED_ITERATORS => 'Reuse of Iterator Variable',
self::LINT_BRACE_FORMATTING => 'Brace placement',
self::LINT_PARENTHESES_SPACING => 'Spaces Inside Parentheses',
self::LINT_CONTROL_STATEMENT_SPACING => 'Space After Control Statement',
self::LINT_BINARY_EXPRESSION_SPACING => 'Space Around Binary Operator',
self::LINT_ARRAY_INDEX_SPACING => 'Spacing Before Array Index',
);
}
@ -87,12 +95,21 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
self::LINT_TODO_COMMENT => ArcanistLintSeverity::SEVERITY_ADVICE,
self::LINT_UNABLE_TO_PARSE
=> ArcanistLintSeverity::SEVERITY_WARNING,
self::LINT_FORMATTING_CONVENTIONS
=> ArcanistLintSeverity::SEVERITY_WARNING,
self::LINT_NAMING_CONVENTIONS
=> ArcanistLintSeverity::SEVERITY_WARNING,
self::LINT_PREG_QUOTE_MISUSE
=> ArcanistLintSeverity::SEVERITY_WARNING,
self::LINT_BRACE_FORMATTING
=> ArcanistLintSeverity::SEVERITY_WARNING,
self::LINT_PARENTHESES_SPACING
=> ArcanistLintSeverity::SEVERITY_WARNING,
self::LINT_CONTROL_STATEMENT_SPACING
=> ArcanistLintSeverity::SEVERITY_WARNING,
self::LINT_BINARY_EXPRESSION_SPACING
=> ArcanistLintSeverity::SEVERITY_WARNING,
self::LINT_ARRAY_INDEX_SPACING
=> ArcanistLintSeverity::SEVERITY_WARNING,
);
}
@ -181,7 +198,7 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
$this->raiseLintAtToken(
$first,
self::LINT_FORMATTING_CONVENTIONS,
self::LINT_BRACE_FORMATTING,
'Put opening braces on the same line as control statements and '.
'declarations, with a single space before them.',
' '.$first->getValue());
@ -190,7 +207,7 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
if ($before->getValue() != ' ') {
$this->raiseLintAtToken(
$before,
self::LINT_FORMATTING_CONVENTIONS,
self::LINT_BRACE_FORMATTING,
'Put opening braces on the same line as control statements and '.
'declarations, with a single space before them.',
' ');
@ -946,7 +963,7 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
list($tokens, $string) = $warning;
$this->raiseLintAtOffset(
reset($tokens)->getOffset(),
self::LINT_FORMATTING_CONVENTIONS,
self::LINT_PARENTHESES_SPACING,
'Parentheses should hug their contents.',
$string,
'');
@ -968,7 +985,7 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
if (empty($after)) {
$this->raiseLintAtToken(
$token,
self::LINT_FORMATTING_CONVENTIONS,
self::LINT_CONTROL_STATEMENT_SPACING,
'Convention: put a space after control statements.',
$token->getValue().' ');
} else if (count($after) == 1) {
@ -991,7 +1008,7 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
if ($space->isAnyWhitespace() && $space->getValue() != ' ') {
$this->raiseLintAtToken(
$space,
self::LINT_FORMATTING_CONVENTIONS,
self::LINT_CONTROL_STATEMENT_SPACING,
'Convention: put a single space after control statements.',
' ');
}
@ -1024,7 +1041,7 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
if ($replace !== null) {
$this->raiseLintAtNode(
$operator,
self::LINT_FORMATTING_CONVENTIONS,
self::LINT_BINARY_EXPRESSION_SPACING,
'Convention: logical and arithmetic operators should be '.
'surrounded by whitespace.',
$replace);
@ -1158,7 +1175,7 @@ class ArcanistXHPASTLinter extends ArcanistLinter {
if (preg_match('/^ +$/', $trailing_text)) {
$this->raiseLintAtOffset(
$last->getOffset() + strlen($last->getValue()),
self::LINT_FORMATTING_CONVENTIONS,
self::LINT_ARRAY_INDEX_SPACING,
'Convention: no spaces before index access.',
$trailing_text,
'');