summaryrefslogtreecommitdiff
path: root/scripts/maint/practracker/metrics.py
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-02-27 17:05:00 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2019-02-27 17:05:00 +0200
commit371ea65c080471cb6e1a57d9f78e5beaaa4212b8 (patch)
tree91626a91d646fe7d6f4c3721711f408ae58df0c8 /scripts/maint/practracker/metrics.py
parenta7684fcb57b3d28285b437f20d5eff6ce079cab5 (diff)
downloadtor-371ea65c080471cb6e1a57d9f78e5beaaa4212b8.tar.gz
tor-371ea65c080471cb6e1a57d9f78e5beaaa4212b8.zip
Improve #include counting func and move it to metrics.py.
Diffstat (limited to 'scripts/maint/practracker/metrics.py')
-rw-r--r--scripts/maint/practracker/metrics.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/maint/practracker/metrics.py b/scripts/maint/practracker/metrics.py
index 43ec3f809d..525a058405 100644
--- a/scripts/maint/practracker/metrics.py
+++ b/scripts/maint/practracker/metrics.py
@@ -8,6 +8,14 @@ def file_len(f):
pass
return i + 1
+def get_include_count(f):
+ """Get number of #include statements in the file"""
+ include_count = 0
+ for line in f:
+ if re.match(r' *# *include', line):
+ include_count += 1
+ return include_count
+
def function_lines(f):
"""
Return iterator which iterates over functions and returns (function name, function lines)