Skip to content

Commit

Permalink
#62 Fixed computation of runtime statistic "lines per second", which …
Browse files Browse the repository at this point in the history
…was a copy and paste of "files per second".
  • Loading branch information
roskakori committed Jan 5, 2022
1 parent 805b529 commit 0d7952b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ This chapter describes the changes coming with each new version of pygount.

Version 1.3.0, 2022-xx-xx

* Fixed computation of "lines per second", which was a copy and paste of
"files per second".

* Added JSON as additional output :option:`--format`, see :doc:`json` for
details (issue `#62 <https://github.com/roskakori/pygount/issues/62>`_).

Expand Down
2 changes: 1 addition & 1 deletion pygount/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def close(self):
(1e-6 * self.duration.microseconds) + self.duration.seconds + self.duration.days * 3600 * 24
)
if self.duration_in_seconds > 0:
self.lines_per_second = self.project_summary.total_file_count / self.duration_in_seconds
self.lines_per_second = self.project_summary.total_line_count / self.duration_in_seconds
self.files_per_second = self.project_summary.total_file_count / self.duration_in_seconds


Expand Down
2 changes: 2 additions & 0 deletions tests/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def test_can_collect_totals():
writer.add(source_analysis)
assert writer.project_summary.total_file_count == 2
assert writer.project_summary.total_line_count == 110
assert writer.duration_in_seconds > 0
assert writer.lines_per_second > writer.files_per_second


def test_can_write_cloc_xml():
Expand Down

0 comments on commit 0d7952b

Please sign in to comment.