Skip to content

Commit c01de65

Browse files
Add comments to explore_folder function
1 parent 6c77cc9 commit c01de65

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

code_counting/util.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ def count_lines_of_code(file):
2424

2525
def explore_folder(root, files):
2626

27+
# If root is not a folder, add it to the files list
28+
# Base case
2729
if not os.path.isdir(root):
2830
logging.debug('\tAdd {} to files list'.format(root))
2931
files.append(root)
32+
return files
3033

31-
if os.path.isdir(root):
34+
# If root is a folder, explore the folder and call itself (explore_folder function)
35+
# Recursive case
36+
elif os.path.isdir(root):
3237
logging.debug('\t{} is a dir, expanding:'.format(root))
3338
for f in os.listdir(root):
3439
logging.debug('\tExploring {}'.format(f))
3540
explore_folder(os.path.join(root, f), files)
3641

37-
return files
42+
return files

0 commit comments

Comments
 (0)