Skip to content

fix: main annotated as NoReturn but returns None - #108

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:codequality/bobber-main-annotated-as-noreturn-but-returns
Open

andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:codequality/bobber-main-annotated-as-noreturn-but-returns

Conversation

@andrewwhitecdw

Copy link
Copy Markdown

This PR addresses the following issue in bobber/bobber.py: main annotated as NoReturn but returns None.

Changes

  • bobber/bobber.py: main annotated as NoReturn but returns None.

Details

--- a/bobber/bobber.py
+++ b/bobber/bobber.py
@@ -1,1 +1,1 @@
-def main() -> NoReturn:
+def main() -> None:

Tests

  • tests/test_bobber_annotations.py
--- /dev/null
+++ b/tests/test_bobber_annotations.py
@@ -0,0 +1,15 @@
+import ast
+import unittest
+
+
+class TestReturnAnnotations(unittest.TestCase):
+    def _get_return_annotation(self, func_name):
+        with open('bobber/bobber.py') as f:
+            tree = ast.parse(f.read())
+        for node in ast.walk(tree):
+            if isinstance(node, ast.FunctionDef) and node.name == func_name:
+                return node.returns
+        self.fail(f'{func_name} not found')
+
+    def test_main_returns_none(self):
+        self.assertEqual(ast.unparse(self._get_return_annotation('main')), 'None')

Contributor guidelines

Per this repo's CONTRIBUTING.md:

  • All commits are signed off (Signed-off-by trailer, DCO).

Signed-off-by: Andrew White <andrewh@cdw.com>
Signed-off-by: andrewwhitecdw <andrewwhitecdw@users.noreply.github.com>
@andrewwhitecdw
andrewwhitecdw force-pushed the codequality/bobber-main-annotated-as-noreturn-but-returns branch from 50fda46 to 5901ccd Compare August 18, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant