Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
print("Hello world")
print("Hello world 2")
print("Hello world 3")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Main Guard

Code executes immediately when imported as a module, potentially causing unintended side effects in larger applications. This could lead to accidental execution of code in production environments or during testing.

Suggested change
print("Hello world")
print("Hello world 2")
print("Hello world 3")
def main():
print("Hello world")
print("Hello world 2")
print("Hello world 3")
if __name__ == "__main__":
main()
Standards
  • CWE-710

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code runs on import without main guard

Code executes when imported as a module, which can cause unintended side effects in larger applications. Without a main guard, importing this file will trigger print statements, potentially disrupting logging or output in production environments.

Suggested change
print("Hello world")
print("Hello world 2")
print("Hello world 3")
def main():
print("Hello world")
print("Hello world 2")
print("Hello world 3")
if __name__ == "__main__":
main()
Standards
  • ISO-IEC-25010-Reliability-Maturity
  • SRE-Modularity
  • DbC-Interface-Contracts