mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
top_evil_rs.py: remove comments before counting
For example, constants.rs is completely safe now, but has "free()" in the comments.
This commit is contained in:
committed by
Floris Bruynooghe
parent
0cffbaf1e9
commit
3eaab07b0b
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
filestats = []
|
filestats = []
|
||||||
for fn in os.listdir():
|
for fn in os.listdir():
|
||||||
if fn.endswith(".rs"):
|
if fn.endswith(".rs"):
|
||||||
s = open(fn).read()
|
s = open(fn).read()
|
||||||
|
s = re.sub(r'(?m)///.*$', '', s) # remove comments
|
||||||
unsafe = s.count("unsafe")
|
unsafe = s.count("unsafe")
|
||||||
free = s.count("free(")
|
free = s.count("free(")
|
||||||
gotoblocks = s.count("current_block =")
|
gotoblocks = s.count("current_block =")
|
||||||
|
|||||||
Reference in New Issue
Block a user