Skip to content

Commit

Permalink
fix: skip files without extension
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxianpeng committed Jan 6, 2025
1 parent 4a1cf06 commit 75fc98d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ gitstats.egg-info
gitstory.egg-info
build/
gitstats-report
test-report
3 changes: 2 additions & 1 deletion gitstats/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def collect(self, dir):

filename = fullpath.split("/")[-1] # strip directories
if filename.find(".") == -1 or filename.rfind(".") == 0:
ext = ""
continue # skip files without extension
else:
ext = filename[(filename.rfind(".") + 1) :]
if len(ext) > conf["max_ext_length"]:
Expand Down Expand Up @@ -1404,6 +1404,7 @@ def create(self, data, path):
f.write(
'<table class="sortable" id="ext"><tr><th>Extension</th><th>Files (%)</th><th>Lines (%)</th><th>Lines/file</th></tr>'
)

for ext in sorted(data.extensions.keys()):
files = data.extensions[ext]["files"]
lines = data.extensions[ext]["lines"]
Expand Down

0 comments on commit 75fc98d

Please sign in to comment.