1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2025-01-30 16:38:20 +01:00

(stable) Promote 2017 Week 14

This commit is contained in:
epriestley 2017-11-07 15:44:02 -08:00
commit 622862e047
6 changed files with 62 additions and 21 deletions

View file

@ -148,36 +148,35 @@ final class ArcanistConsoleLintRenderer extends ArcanistLintRenderer {
$old_impact--;
$new_impact--;
if ($old_impact < 0 || $new_impact < 0) {
throw new Exception(
pht(
'Modified prefix line range has become negative '.
'(old = %d, new = %d).',
$old_impact,
$new_impact));
// We can end up here if a patch removes a line which occurs before
// another identical line.
if ($old_impact <= 0 || $new_impact <= 0) {
break;
}
} while (true);
// If the lines at the end of the changed line range are actually the
// same, shrink the range. This happens when a patch just removes a
// line.
do {
$old_suffix = idx($old_lines, $start + $old_impact - 2, null);
$new_suffix = idx($new_lines, $start + $new_impact - 2, null);
if ($old_impact > 0 && $new_impact > 0) {
do {
$old_suffix = idx($old_lines, $start + $old_impact - 2, null);
$new_suffix = idx($new_lines, $start + $new_impact - 2, null);
if ($old_suffix !== $new_suffix) {
break;
}
if ($old_suffix !== $new_suffix) {
break;
}
$old_impact--;
$new_impact--;
$old_impact--;
$new_impact--;
// We can end up here if a patch removes a line which occurs after
// another identical line.
if ($old_impact <= 0 || $new_impact <= 0) {
break;
}
} while (true);
// We can end up here if a patch removes a line which occurs after
// another identical line.
if ($old_impact <= 0 || $new_impact <= 0) {
break;
}
} while (true);
}
} else {

View file

@ -142,6 +142,20 @@ EOTEXT;
'replacement' => "\nX\nY\n",
),
'rmmulti' => array(
'line' => 2,
'char' => 1,
'original' => "\n",
'replacement' => '',
),
'rmmulti2' => array(
'line' => 1,
'char' => 2,
'original' => "\n",
'replacement' => '',
),
);
$defaults = array(

View file

@ -0,0 +1,10 @@
>>> Lint for path/to/example.c:
Warning (WARN123) Lint Warning
Consider this.
1 A
2 ~
>>> - 3 ~
4 B

View file

@ -0,0 +1,4 @@
A
B

View file

@ -0,0 +1,10 @@
>>> Lint for path/to/example.c:
Warning (WARN123) Lint Warning
Consider this.
1 A
>>> - 2 ~
3 ~
4 B

View file

@ -0,0 +1,4 @@
A
B