refactor: remove dead code in cli and xlsx
cli.py: drop redundant 'if issue_hours is None' branch before 'if not issue_hours'. The branch is not formally dead (client returns None when no time entries found, client.py), but it is a semantic duplicate: both branches print the same message and return 0, and None is falsy, so a single 'not issue_hours' check covers None, empty list and keeps behavior identical. test_cli_returns_zero_on_no_entries stays green unchanged. xlsx.py: drop unreachable 'if ws is None' fallback. Workbook() (write_only=False) always creates one worksheet in __init__, so wb.active is never None; set the title directly. Closes #63
This commit is contained in:
@@ -422,10 +422,6 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|||||||
logging.exception("Unexpected error")
|
logging.exception("Unexpected error")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if issue_hours is None:
|
|
||||||
print("ℹ️ No time entries found in the given period.", file=sys.stderr)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if not issue_hours:
|
if not issue_hours:
|
||||||
print("ℹ️ No time entries found in the given period.", file=sys.stderr)
|
print("ℹ️ No time entries found in the given period.", file=sys.stderr)
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -39,10 +39,7 @@ class XLSXFormatter(Formatter):
|
|||||||
def format(self, rows: List[ReportRow]) -> Workbook:
|
def format(self, rows: List[ReportRow]) -> Workbook:
|
||||||
wb = Workbook()
|
wb = Workbook()
|
||||||
ws = wb.active
|
ws = wb.active
|
||||||
if ws is None:
|
ws.title = "Report"
|
||||||
ws = wb.create_sheet("Report")
|
|
||||||
else:
|
|
||||||
ws.title = "Report"
|
|
||||||
|
|
||||||
headers = [
|
headers = [
|
||||||
"Project",
|
"Project",
|
||||||
|
|||||||
Reference in New Issue
Block a user