mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 05:12:41 +01:00
Generated code> make it harder to mark code as generated
Summary: It's now harder to accidentally mark code as generated. Test Plan: Tested with this diff in my sandbox; only file "D" was shown, the others were marked as generated: diff --git a/A b/A index e69de29..780b46c 100644 --- a/A +++ b/A @@ -0,0 +1,2 @@ +@generated +Tue Jun 7 16:41:17 PDT 2011 diff --git a/B b/B index e69de29..b55fe21 100644 --- a/B +++ b/B @@ -0,0 +1,3 @@ +/** + * @generated by ed + */ diff --git a/C b/C index e69de29..e0f808a 100644 --- a/C +++ b/C @@ -0,0 +1,3 @@ +/** + * {@generated <<jonx>lol>} + */ diff --git a/D b/D index e69de29..89e8829 100644 --- a/D +++ b/D @@ -0,0 +1,2 @@ +string = STDIN.readlines +string.include?('@generated') Reviewed By: jungejason Reviewers: jungejason CC: aran, edward, jungejason Differential Revision: 408
This commit is contained in:
parent
6deddbfc70
commit
e15da75687
1 changed files with 24 additions and 1 deletions
|
@ -540,7 +540,30 @@ class DifferentialChangesetParser {
|
|||
ipull($this->intra, 1),
|
||||
$new_corpus);
|
||||
|
||||
$generated = (strpos($new_corpus_block, '@'.'generated') !== false);
|
||||
|
||||
/**
|
||||
* Generated code should be marked with ' @generated', '{@generated', or
|
||||
* the block must begin with '@generated'.
|
||||
*
|
||||
* Any other instances of '@generated' will be ignored.
|
||||
*/
|
||||
$generated = false;
|
||||
$pos = strpos($new_corpus_block, '@generated');
|
||||
if ($pos === 0) {
|
||||
$generated = true;
|
||||
} else {
|
||||
$prefix_char = substr($new_corpus_block, $pos - 1, 1);
|
||||
switch ($prefix_char) {
|
||||
case ' ':
|
||||
case '{':
|
||||
$generated = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
$generated = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->specialAttributes[self::ATTR_GENERATED] = $generated;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue