Skip to content

Commit 43b0e65

Browse files
committed
Add a few more rules
1 parent 2b77e35 commit 43b0e65

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

rules/error-reporting.xml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<rule version="1">
3+
<pattern>Severity :: fromString \( "\w+" \)</pattern>
4+
<message>
5+
<id>ConstantSeverityFromString</id>
6+
<severity>style</severity>
7+
<summary>Constant severity lookups should be done via
8+
Severity::constant.</summary>
9+
</message>
10+
</rule>

rules/stl.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<rule version="1">
3+
<!-- This should ideally be checked by lib/checkstl.cpp -->
4+
<pattern> \. find \( "[^"]+?" \) == \d+ </pattern>
5+
<message>
6+
<id>UselessSTDStringFind</id>
7+
<severity>performance</severity>
8+
<summary>When looking for a string at a fixed position compare
9+
is faster.</summary>
10+
</message>
11+
</rule>

0 commit comments

Comments
 (0)