Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions code-statics/main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import os
import re


basedir = "path/to/code/src"
count = 0

def statics(filepath):
def statics(filepath): #defining statistics
global count
files = os.listdir(filepath)
for fi in files:
Expand All @@ -13,7 +14,7 @@ def statics(filepath):
statics(fi_d)
else:
name = os.path.join(filepath,fi_d)
# Only the js file is counted in this example
# Only the js file is counted in this example. notany other .
if (name[-2:] == "js"):
with open(name) as f:
for l in f:
Expand All @@ -23,4 +24,4 @@ def statics(filepath):

if __name__ == '__main__':
statics(basedir)
print count
print count