fail on mdout error
bookmaker sent mdout errors to stdout, but did not return failure, fooling skia-commit-bot into thinking that the md files should be updated. Continue to report all mdout errors in a file, but fail once the errors are reported. TBR=rmistry@google.com Bug: skia:6898 Change-Id: Ic342dd9a6e4aeea29626b52efe7d2c4e53da155e Reviewed-on: https://skia-review.googlesource.com/113701 Commit-Queue: Cary Clark <caryclark@skia.org> Reviewed-by: Cary Clark <caryclark@skia.org>
This commit is contained in:
parent
947326638a
commit
566414ef70
@ -2130,11 +2130,11 @@ private:
|
|||||||
|
|
||||||
string addReferences(const char* start, const char* end, BmhParser::Resolvable );
|
string addReferences(const char* start, const char* end, BmhParser::Resolvable );
|
||||||
bool buildRefFromFile(const char* fileName, const char* outDir);
|
bool buildRefFromFile(const char* fileName, const char* outDir);
|
||||||
bool checkParamReturnBody(const Definition* def) const;
|
bool checkParamReturnBody(const Definition* def);
|
||||||
void childrenOut(const Definition* def, const char* contentStart);
|
void childrenOut(const Definition* def, const char* contentStart);
|
||||||
const Definition* csParent() const;
|
const Definition* csParent() const;
|
||||||
const Definition* findParamType();
|
const Definition* findParamType();
|
||||||
const Definition* isDefined(const TextParser& parser, const string& ref, bool report) const;
|
const Definition* isDefined(const TextParser& parser, const string& ref, bool report);
|
||||||
string linkName(const Definition* ) const;
|
string linkName(const Definition* ) const;
|
||||||
string linkRef(const string& leadingSpaces, const Definition*, const string& ref,
|
string linkRef(const string& leadingSpaces, const Definition*, const string& ref,
|
||||||
BmhParser::Resolvable ) const;
|
BmhParser::Resolvable ) const;
|
||||||
@ -2159,6 +2159,7 @@ private:
|
|||||||
fRoot = nullptr;
|
fRoot = nullptr;
|
||||||
fLastParam = nullptr;
|
fLastParam = nullptr;
|
||||||
fTableState = TableState::kNone;
|
fTableState = TableState::kNone;
|
||||||
|
fAddRefFailed = false;
|
||||||
fHasFiddle = false;
|
fHasFiddle = false;
|
||||||
fInDescription = false;
|
fInDescription = false;
|
||||||
fInList = false;
|
fInList = false;
|
||||||
@ -2195,6 +2196,7 @@ private:
|
|||||||
const RootDefinition* fRoot;
|
const RootDefinition* fRoot;
|
||||||
const Definition* fLastParam;
|
const Definition* fLastParam;
|
||||||
TableState fTableState;
|
TableState fTableState;
|
||||||
|
bool fAddRefFailed;
|
||||||
bool fHasFiddle;
|
bool fHasFiddle;
|
||||||
bool fInDescription; // FIXME: for now, ignore unfound camelCase in description since it may
|
bool fInDescription; // FIXME: for now, ignore unfound camelCase in description since it may
|
||||||
// be defined in example which at present cannot be linked to
|
// be defined in example which at present cannot be linked to
|
||||||
|
@ -103,6 +103,7 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
|
|||||||
if (!t.eof() && '(' == t.peek() && t.strnchr(')', t.fEnd)) {
|
if (!t.eof() && '(' == t.peek() && t.strnchr(')', t.fEnd)) {
|
||||||
if (!t.skipToEndBracket(')')) {
|
if (!t.skipToEndBracket(')')) {
|
||||||
t.reportError("missing close paren");
|
t.reportError("missing close paren");
|
||||||
|
fAddRefFailed = true;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
t.next();
|
t.next();
|
||||||
@ -125,6 +126,7 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
|
|||||||
}
|
}
|
||||||
if (suffix > '9') {
|
if (suffix > '9') {
|
||||||
t.reportError("too many alts");
|
t.reportError("too many alts");
|
||||||
|
fAddRefFailed = true;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (!foundMatch) {
|
if (!foundMatch) {
|
||||||
@ -132,6 +134,7 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
|
|||||||
BmhParser::Resolvable::kOut != resolvable))) {
|
BmhParser::Resolvable::kOut != resolvable))) {
|
||||||
if (!result.size()) {
|
if (!result.size()) {
|
||||||
t.reportError("missing method");
|
t.reportError("missing method");
|
||||||
|
fAddRefFailed = true;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -148,6 +151,7 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
|
|||||||
if (!t.eof() && '(' == t.peek()) {
|
if (!t.eof() && '(' == t.peek()) {
|
||||||
if (!t.skipToEndBracket(')')) {
|
if (!t.skipToEndBracket(')')) {
|
||||||
t.reportError("missing close paren");
|
t.reportError("missing close paren");
|
||||||
|
fAddRefFailed = true;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
t.next();
|
t.next();
|
||||||
@ -168,12 +172,14 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
|
|||||||
ref != "Skip" && ref != "Skips") {
|
ref != "Skip" && ref != "Skips") {
|
||||||
if (BmhParser::Resolvable::kOut != resolvable) {
|
if (BmhParser::Resolvable::kOut != resolvable) {
|
||||||
t.reportError("missed Sk prefixed");
|
t.reportError("missed Sk prefixed");
|
||||||
|
fAddRefFailed = true;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (!ref.compare(0, 2, "SK")) {
|
if (!ref.compare(0, 2, "SK")) {
|
||||||
if (BmhParser::Resolvable::kOut != resolvable) {
|
if (BmhParser::Resolvable::kOut != resolvable) {
|
||||||
t.reportError("missed SK prefixed");
|
t.reportError("missed SK prefixed");
|
||||||
|
fAddRefFailed = true;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -205,6 +211,7 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
|
|||||||
}
|
}
|
||||||
if (BmhParser::Resolvable::kOut != resolvable) {
|
if (BmhParser::Resolvable::kOut != resolvable) {
|
||||||
t.reportError("missed camelCase");
|
t.reportError("missed camelCase");
|
||||||
|
fAddRefFailed = true;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,6 +260,7 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
|
|||||||
if (!test) {
|
if (!test) {
|
||||||
if (BmhParser::Resolvable::kOut != resolvable) {
|
if (BmhParser::Resolvable::kOut != resolvable) {
|
||||||
t.reportError("undefined reference");
|
t.reportError("undefined reference");
|
||||||
|
fAddRefFailed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!t.eof());
|
} while (!t.eof());
|
||||||
@ -337,6 +345,7 @@ bool MdOut::buildRefFromFile(const char* name, const char* outDir) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!topicDef->isRoot()) {
|
if (!topicDef->isRoot()) {
|
||||||
|
fAddRefFailed = true;
|
||||||
return this->reportError<bool>("expected root topic");
|
return this->reportError<bool>("expected root topic");
|
||||||
}
|
}
|
||||||
fRoot = topicDef->asRoot();
|
fRoot = topicDef->asRoot();
|
||||||
@ -391,10 +400,10 @@ bool MdOut::buildRefFromFile(const char* name, const char* outDir) {
|
|||||||
remove(filename.c_str());
|
remove(filename.c_str());
|
||||||
fOut = nullptr;
|
fOut = nullptr;
|
||||||
}
|
}
|
||||||
return true;
|
return !fAddRefFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MdOut::checkParamReturnBody(const Definition* def) const {
|
bool MdOut::checkParamReturnBody(const Definition* def) {
|
||||||
TextParser paramBody(def);
|
TextParser paramBody(def);
|
||||||
const char* descriptionStart = paramBody.fChar;
|
const char* descriptionStart = paramBody.fChar;
|
||||||
if (!islower(descriptionStart[0]) && !isdigit(descriptionStart[0])) {
|
if (!islower(descriptionStart[0]) && !isdigit(descriptionStart[0])) {
|
||||||
@ -404,11 +413,13 @@ bool MdOut::checkParamReturnBody(const Definition* def) const {
|
|||||||
string errorStr = MarkType::kReturn == def->fMarkType ? "return" : "param";
|
string errorStr = MarkType::kReturn == def->fMarkType ? "return" : "param";
|
||||||
errorStr += " description must start with lower case";
|
errorStr += " description must start with lower case";
|
||||||
paramBody.reportError(errorStr.c_str());
|
paramBody.reportError(errorStr.c_str());
|
||||||
|
fAddRefFailed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ('.' == paramBody.fEnd[-1]) {
|
if ('.' == paramBody.fEnd[-1]) {
|
||||||
paramBody.reportError("make param description a phrase; should not end with period");
|
paramBody.reportError("make param description a phrase; should not end with period");
|
||||||
|
fAddRefFailed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -483,7 +494,7 @@ const Definition* MdOut::findParamType() {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Definition* MdOut::isDefined(const TextParser& parser, const string& ref, bool report) const {
|
const Definition* MdOut::isDefined(const TextParser& parser, const string& ref, bool report) {
|
||||||
auto rootIter = fBmhParser.fClassMap.find(ref);
|
auto rootIter = fBmhParser.fClassMap.find(ref);
|
||||||
if (rootIter != fBmhParser.fClassMap.end()) {
|
if (rootIter != fBmhParser.fClassMap.end()) {
|
||||||
return &rootIter->second;
|
return &rootIter->second;
|
||||||
@ -598,11 +609,13 @@ const Definition* MdOut::isDefined(const TextParser& parser, const string& ref,
|
|||||||
// for now, just try to make sure that it's there and error if not
|
// for now, just try to make sure that it's there and error if not
|
||||||
if ('.' != parser.backup(ref.c_str())) {
|
if ('.' != parser.backup(ref.c_str())) {
|
||||||
parser.reportError("fX member undefined");
|
parser.reportError("fX member undefined");
|
||||||
|
fAddRefFailed = true;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (report) {
|
if (report) {
|
||||||
parser.reportError("SK undefined");
|
parser.reportError("SK undefined");
|
||||||
|
fAddRefFailed = true;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -632,6 +645,7 @@ const Definition* MdOut::isDefined(const TextParser& parser, const string& ref,
|
|||||||
}
|
}
|
||||||
if (report) {
|
if (report) {
|
||||||
parser.reportError("_ undefined");
|
parser.reportError("_ undefined");
|
||||||
|
fAddRefFailed = true;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -1097,6 +1111,7 @@ void MdOut::markTypeOut(Definition* def) {
|
|||||||
case MarkType::kPhraseRef:
|
case MarkType::kPhraseRef:
|
||||||
if (fBmhParser.fPhraseMap.end() == fBmhParser.fPhraseMap.find(def->fName)) {
|
if (fBmhParser.fPhraseMap.end() == fBmhParser.fPhraseMap.find(def->fName)) {
|
||||||
def->reportError<void>("missing phrase definition");
|
def->reportError<void>("missing phrase definition");
|
||||||
|
fAddRefFailed = true;
|
||||||
} else {
|
} else {
|
||||||
if (fColumn && ' ' >= def->fStart[0]) {
|
if (fColumn && ' ' >= def->fStart[0]) {
|
||||||
this->writeSpace();
|
this->writeSpace();
|
||||||
|
Loading…
Reference in New Issue
Block a user