Commit e733cb21 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS checks: Add @enable-all-checks annotation.

It enables all checks, even those that we deem to annoying to be
enabled by default.

Also fix a bug where some disabled checks had the wrong severity.

Change-Id: Id434ad62dabafac979ee2304a85d368b9ea98fa4
Reviewed-by: default avatarFawzi Mohamed <>
parent 5ac449a7
......@@ -1172,11 +1172,17 @@ void Check::addMessage(Type type, const SourceLocation &location, const QString
void Check::scanCommentsForAnnotations()
// find all disable annotations
const QRegExp disableCommentPattern(Message::suppressionPattern());
foreach (const SourceLocation &commentLoc, _doc->engine()->comments()) {
const QString &comment = _doc->source().mid(commentLoc.begin(), commentLoc.length);
// enable all checks annotation
if (comment.contains(QLatin1String("@enable-all-checks"))) {
_enabledMessages = Message::allMessageTypes().toSet();
// find all disable annotations
int lastOffset = -1;
QList<MessageTypeAndSuppression> disabledMessageTypes;
forever {
......@@ -158,9 +158,9 @@ StaticAnalysisMessages::StaticAnalysisMessages()
tr("== and != may perform type coercion, use === or !== to avoid"));
newMsg(WarnConfusingExpressionStatement, Warning,
tr("expression statements should be assignments, calls or delete expressions only"));
newMsg(HintDeclarationsShouldBeAtStartOfFunction, Error,
newMsg(HintDeclarationsShouldBeAtStartOfFunction, Hint,
tr("var declarations should be at the start of a function"));
newMsg(HintOneStatementPerLine, Error,
newMsg(HintOneStatementPerLine, Hint,
tr("only use one statement per line"));
newMsg(ErrUnknownComponent, Error,
tr("unknown component"));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment