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: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
Christian Kamm
2011-10-28 15:56:56 +02:00
parent 5ac449a708
commit e733cb2155
2 changed files with 10 additions and 4 deletions

View File

@@ -1172,11 +1172,17 @@ void Check::addMessage(Type type, const SourceLocation &location, const QString
void Check::scanCommentsForAnnotations()
{
m_disabledMessageTypesByLine.clear();
// 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 {