Skip to content

Commit

Permalink
More consistent warning messages
Browse files Browse the repository at this point in the history
In the jabref-5.11 package we see a few, less consistent warning messages like:
```
.../jabref-5.11/src/main/java/org/jabref/gui/fieldeditors/URLUtil.java:140: warning: reached end of file while inside a 'code' block!
The command that should end the block seems to be missing!
```
i.e. warning distributed over multiple lines

and
```
.../jabref-5.11/docs/code-howtos/openoffice/code-reorganization.md:20: warning: image file name layers-v1.svg is ambiguous.
Possible candidates:
   E:/Fossies/jabref-5.11/docs/code-howtos/openoffice/layers-v1.svg
   E:/Fossies/jabref-5.11/docs/images/layers-v1.svg

```
- empty line at the end
- no single quotes around `layers-v1.svg`
- indentation by 3 instead of 2 spaces
  • Loading branch information
albert-github committed Oct 23, 2023
1 parent b61decb commit 907c56e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/codefragment.cpp
Expand Up @@ -269,7 +269,7 @@ static QCString readTextFileByName(const QCString &file)
{
if (ambig)
{
err("included file name %s is ambiguous. Possible candidates: %s\n",qPrint(file),
err("included file name '%s' is ambiguous.\nPossible candidates:\n%s\n",qPrint(file),
qPrint(showFileDefMatches(Doxygen::exampleNameLinkedMap,file))
);
}
Expand Down
12 changes: 6 additions & 6 deletions src/docnode.cpp
Expand Up @@ -1080,15 +1080,15 @@ bool DocDotFile::parse()
ok = true;
if (ambig)
{
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dot file name %s is ambiguous.\n"
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dot file name '%s' is ambiguous.\n"
"Possible candidates:\n%s",qPrint(p->name),
qPrint(showFileDefMatches(Doxygen::dotFileNameLinkedMap,p->name))
);
}
}
else
{
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dot file %s is not found "
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dot file '%s' is not found "
"in any of the paths specified via DOTFILE_DIRS!",qPrint(p->name));
}
return ok;
Expand Down Expand Up @@ -1118,15 +1118,15 @@ bool DocMscFile::parse()
ok = true;
if (ambig)
{
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included msc file name %s is ambiguous.\n"
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included msc file name '%s' is ambiguous.\n"
"Possible candidates:\n%s",qPrint(p->name),
qPrint(showFileDefMatches(Doxygen::mscFileNameLinkedMap,p->name))
);
}
}
else
{
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included msc file %s is not found "
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included msc file '%s' is not found "
"in any of the paths specified via MSCFILE_DIRS!",qPrint(p->name));
}
return ok;
Expand Down Expand Up @@ -1158,15 +1158,15 @@ bool DocDiaFile::parse()
ok = true;
if (ambig)
{
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dia file name %s is ambiguous.\n"
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dia file name '%s' is ambiguous.\n"
"Possible candidates:\n%s",qPrint(p->name),
qPrint(showFileDefMatches(Doxygen::diaFileNameLinkedMap,p->name))
);
}
}
else
{
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dia file %s is not found "
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"included dia file '%s' is not found "
"in any of the paths specified via DIAFILE_DIRS!",qPrint(p->name));
}
return ok;
Expand Down
6 changes: 3 additions & 3 deletions src/docparser.cpp
Expand Up @@ -106,7 +106,7 @@ QCString DocParser::findAndCopyImage(const QCString &fileName, DocImage::Type ty
if (ambig & doWarn)
{
QCString text;
text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName));
text.sprintf("image file name '%s' is ambiguous.\n",qPrint(fileName));
text+="Possible candidates:\n";
text+=showFileDefMatches(Doxygen::imageNameLinkedMap,fileName);
warn_doc_error(context.fileName,tokenizer.getLineNr(),"%s", qPrint(text));
Expand Down Expand Up @@ -1662,15 +1662,15 @@ void DocParser::readTextFileByName(const QCString &file,QCString &text)
text = fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES));
if (ambig)
{
warn_doc_error(context.fileName,tokenizer.getLineNr(),"included file name %s is ambiguous"
warn_doc_error(context.fileName,tokenizer.getLineNr(),"included file name '%s' is ambiguous"
"Possible candidates:\n%s",qPrint(file),
qPrint(showFileDefMatches(Doxygen::exampleNameLinkedMap,file))
);
}
}
else
{
warn_doc_error(context.fileName,tokenizer.getLineNr(),"included file %s is not found. "
warn_doc_error(context.fileName,tokenizer.getLineNr(),"included file '%s' is not found. "
"Check your EXAMPLE_PATH",qPrint(file));
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/doxygen.cpp
Expand Up @@ -547,6 +547,7 @@ static void buildFileList(const Entry *root)
{
text+="matches the following input files:\n";
text+=showFileDefMatches(Doxygen::inputNameLinkedMap,root->name);
text+="\n";
text+="Please use a more specific name by "
"including a (larger) part of the path!";
}
Expand Down Expand Up @@ -602,6 +603,7 @@ static void addIncludeFile(DefMutable *cd,FileDef *ifd,const Entry *root)
{
text+="matches the following input files:\n";
text+=showFileDefMatches(Doxygen::inputNameLinkedMap,root->includeFile);
text+="\n";
text+="Please use a more specific name by "
"including a (larger) part of the path!";
}
Expand Down
4 changes: 2 additions & 2 deletions src/scanner.l
Expand Up @@ -7081,8 +7081,8 @@ NONLopt [^\n]*
}
<DocCopyBlock><<EOF>> {
warn(yyextra->fileName,yyextra->yyLineNr,
"reached end of file while inside a '%s' block!\n"
"The command that should end the block seems to be missing!",
"reached end of file while inside a '%s' block!"
" The command that should end the block seems to be missing!",
qPrint(yyextra->docBlockName));
yyterminate();
}
Expand Down
5 changes: 4 additions & 1 deletion src/util.cpp
Expand Up @@ -3292,11 +3292,14 @@ QCString showFileDefMatches(const FileNameLinkedMap *fnMap,const QCString &n)
const FileName *fn;
if ((fn=fnMap->find(name)))
{
bool first = true;
for (const auto &fd : *fn)
{
if (path.isEmpty() || fd->getPath().right(path.length())==path)
{
result+=" "+fd->absFilePath()+"\n";
if (!first) result += "\n";
else first = false;
result+=" "+fd->absFilePath();
}
}
}
Expand Down

0 comments on commit 907c56e

Please sign in to comment.