mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +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 re
|
||||
|
||||
if __name__ == "__main__":
|
||||
filestats = []
|
||||
for fn in os.listdir():
|
||||
if fn.endswith(".rs"):
|
||||
s = open(fn).read()
|
||||
s = re.sub(r'(?m)///.*$', '', s) # remove comments
|
||||
unsafe = s.count("unsafe")
|
||||
free = s.count("free(")
|
||||
gotoblocks = s.count("current_block =")
|
||||
|
||||
Reference in New Issue
Block a user