Skip to content

Commit

Permalink
TASK: Correct line number output
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Strübing committed Feb 2, 2017
1 parent 5841442 commit d5af355
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mstruebing/editorconfig-checker",
"description": "A tool to verify that your files follow the rules of your .editorconfig",
"license": "MIT",
"version": "2.2.4",
"version": "2.2.5",
"authors": [
{
"name": "Max Strübing",
Expand Down
12 changes: 6 additions & 6 deletions src/MStruebing/EditorconfigChecker/Cli/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected function checkForSpace($rules, $line, $lineNumber, $lastIndentSize, $f
/* check if the indentation size could be a valid one */
/* the * is for function comments */
if ($indentSize % $rules['indent_size'] !== 0 && $line[$indentSize] !== '*') {
$this->logger->addError('Not the right amount of spaces', $file, $lineNumber);
$this->logger->addError('Not the right amount of spaces', $file, $lineNumber + 1);
}

/* because the following example would not work I have to check it this way */
Expand All @@ -143,14 +143,14 @@ protected function checkForSpace($rules, $line, $lineNumber, $lastIndentSize, $f
/* world'); <--- this is the critial part */
/* } */
if (isset($lastIndentSize) && ($indentSize - $lastIndentSize) > $rules['indent_size']) {
$this->logger->addError('Not the right relation of spaces between lines', $file, $lineNumber);
$this->logger->addError('Not the right relation of spaces between lines', $file, $lineNumber + 1);
}

$lastIndentSize = $indentSize;
} else { /* if no matching leading spaces found check if tabs are there instead */
preg_match('/^(\t+)/', $line, $matches);
if (isset($matches[1])) {
$this->logger->addError('Wrong indentation type', $file, $lineNumber);
$this->logger->addError('Wrong indentation type', $file, $lineNumber + 1);
}
}

Expand Down Expand Up @@ -186,14 +186,14 @@ protected function checkForTab($rules, $line, $lineNumber, $lastIndentSize, $fil
/* world'); <--- this is the critial part */
/* } */
if (isset($lastIndentSize) && ($indentSize - $lastIndentSize) > 1) {
$this->logger->addError('Not the right relation of tabs between lines', $file, $lineNumber);
$this->logger->addError('Not the right relation of tabs between lines', $file, $lineNumber + 1);
}

$lastIndentSize = $indentSize;
} else { /* if no matching leading tabs found check if spaces are there instead */
preg_match('/^( +)/', $line, $matches);
if (isset($matches[1])) {
$this->logger->addError('Wrong indentation type', $file, $lineNumber);
$this->logger->addError('Wrong indentation type', $file, $lineNumber + 1);
}
}

Expand All @@ -218,7 +218,7 @@ protected function checkForTrailingWhitespace($rules, $line, $lineNumber)
preg_match('/^.*\S$/', $line, $matches);

if (isset($matches[1])) {
$this->logger->addError('Trailing whitespace', $file, $lineNumber);
$this->logger->addError('Trailing whitespace', $file, $lineNumber + 1);
}
}
}
Expand Down

0 comments on commit d5af355

Please sign in to comment.