nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: roskakori/pygount
Pull request #85 (2022-01-05 14:59:12)

#62 Fixed computation of runtime statistic "lines per second".
See #62.


Patch:
diff --git a/docs/changes.rst b/docs/changes.rst
index 938ef25..4b13863 100644
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -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>`_).
 
diff --git a/pygount/write.py b/pygount/write.py
index 7d30556..9c41763 100644
--- a/pygount/write.py
+++ b/pygount/write.py
@@ -51,7 +51,7 @@ class BaseWriter:
             (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
 
 


Test patch:
diff --git a/tests/test_write.py b/tests/test_write.py
index 8e4011f..eeaa78c 100644
--- a/tests/test_write.py
+++ b/tests/test_write.py
@@ -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():