Add a few more rules

This commit is contained in:
Raphael Geissert 2011-02-02 20:08:03 -06:00
parent 2b77e3591e
commit 43b0e655bb
2 changed files with 21 additions and 0 deletions

10
rules/error-reporting.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<rule version="1">
<pattern>Severity :: fromString \( "\w+" \)</pattern>
<message>
<id>ConstantSeverityFromString</id>
<severity>style</severity>
<summary>Constant severity lookups should be done via
Severity::constant.</summary>
</message>
</rule>

11
rules/stl.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<rule version="1">
<!-- This should ideally be checked by lib/checkstl.cpp -->
<pattern> \. find \( "[^"]+?" \) == \d+ </pattern>
<message>
<id>UselessSTDStringFind</id>
<severity>performance</severity>
<summary>When looking for a string at a fixed position compare
is faster.</summary>
</message>
</rule>