protected $trees = array();
- const LINT_PHP_SYNTAX_ERROR = 1;
- const LINT_UNABLE_TO_PARSE = 2;
- const LINT_VARIABLE_VARIABLE = 3;
- const LINT_EXTRACT_USE = 4;
- const LINT_UNDECLARED_VARIABLE = 5;
- const LINT_PHP_SHORT_TAG = 6;
- const LINT_PHP_ECHO_TAG = 7;
- 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;
- const LINT_PHP_OPEN_TAG = 15;
- const LINT_TODO_COMMENT = 16;
- const LINT_EXIT_EXPRESSION = 17;
- const LINT_COMMENT_STYLE = 18;
- const LINT_CLASS_FILENAME_MISMATCH = 19;
- const LINT_TAUTOLOGICAL_EXPRESSION = 20;
- const LINT_PLUS_OPERATOR_ON_STRINGS = 21;
- const LINT_DUPLICATE_KEYS_IN_ARRAY = 22;
- const LINT_REUSED_ITERATORS = 23;
+ const LINT_PHP_SYNTAX_ERROR = 1;
+ const LINT_UNABLE_TO_PARSE = 2;
+ const LINT_VARIABLE_VARIABLE = 3;
+ const LINT_EXTRACT_USE = 4;
+ const LINT_UNDECLARED_VARIABLE = 5;
+ const LINT_PHP_SHORT_TAG = 6;
+ const LINT_PHP_ECHO_TAG = 7;
+ const LINT_PHP_CLOSE_TAG = 8;
+ const LINT_NAMING_CONVENTIONS = 9;
+ const LINT_IMPLICIT_CONSTRUCTOR = 10;
+ const LINT_DYNAMIC_DEFINE = 12;
+ const LINT_STATIC_THIS = 13;
+ const LINT_PREG_QUOTE_MISUSE = 14;
+ const LINT_PHP_OPEN_TAG = 15;
+ const LINT_TODO_COMMENT = 16;
+ const LINT_EXIT_EXPRESSION = 17;
+ const LINT_COMMENT_STYLE = 18;
+ const LINT_CLASS_FILENAME_MISMATCH = 19;
+ const LINT_TAUTOLOGICAL_EXPRESSION = 20;
+ 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() {
return array(
- self::LINT_PHP_SYNTAX_ERROR => 'PHP Syntax Error!',
- self::LINT_UNABLE_TO_PARSE => 'Unable to Parse',
- self::LINT_VARIABLE_VARIABLE => 'Use of Variable Variable',
- self::LINT_EXTRACT_USE => 'Use of extract()',
- self::LINT_UNDECLARED_VARIABLE => 'Use of Undeclared Variable',
- self::LINT_PHP_SHORT_TAG => 'Use of Short Tag "<?"',
- self::LINT_PHP_ECHO_TAG => 'Use of Echo Tag "<?="',
- 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()',
- self::LINT_PHP_OPEN_TAG => 'Expected Open Tag',
- self::LINT_TODO_COMMENT => 'TODO Comment',
- self::LINT_EXIT_EXPRESSION => 'Exit Used as Expression',
- self::LINT_COMMENT_STYLE => 'Comment Style',
- self::LINT_CLASS_FILENAME_MISMATCH => 'Class-Filename Mismatch',
- self::LINT_TAUTOLOGICAL_EXPRESSION => 'Tautological Expression',
- 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_PHP_SYNTAX_ERROR => 'PHP Syntax Error!',
+ self::LINT_UNABLE_TO_PARSE => 'Unable to Parse',
+ self::LINT_VARIABLE_VARIABLE => 'Use of Variable Variable',
+ self::LINT_EXTRACT_USE => 'Use of extract()',
+ self::LINT_UNDECLARED_VARIABLE => 'Use of Undeclared Variable',
+ self::LINT_PHP_SHORT_TAG => 'Use of Short Tag "<?"',
+ self::LINT_PHP_ECHO_TAG => 'Use of Echo Tag "<?="',
+ self::LINT_PHP_CLOSE_TAG => 'Use of Close Tag "?>"',
+ self::LINT_NAMING_CONVENTIONS => 'Naming Conventions',
+ self::LINT_IMPLICIT_CONSTRUCTOR => 'Implicit Constructor',
+ 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()',
+ self::LINT_PHP_OPEN_TAG => 'Expected Open Tag',
+ self::LINT_TODO_COMMENT => 'TODO Comment',
+ self::LINT_EXIT_EXPRESSION => 'Exit Used as Expression',
+ self::LINT_COMMENT_STYLE => 'Comment Style',
+ self::LINT_CLASS_FILENAME_MISMATCH => 'Class-Filename Mismatch',
+ self::LINT_TAUTOLOGICAL_EXPRESSION => 'Tautological Expression',
+ 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',
);
}
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,
+
);
}
$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());
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.',
' ');
list($tokens, $string) = $warning;
$this->raiseLintAtOffset(
reset($tokens)->getOffset(),
- self::LINT_FORMATTING_CONVENTIONS,
+ self::LINT_PARENTHESES_SPACING,
'Parentheses should hug their contents.',
$string,
'');
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) {
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.',
' ');
}
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);
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,
'');