Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion .deepsource.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ version = 1
name = "python"

[analyzers.meta]
runtime_version = "3.x.x"
runtime_version = "3.x.x"

[[transformers]]
name = "ruff"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ This repository demonstrates sample issues in Python code raised by DeepSource.
### Documentation

[https://deepsource.io/docs/analyzer/python.html](https://deepsource.io/docs/analyzer/python.html)
// test
1 change: 1 addition & 0 deletions demo_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class BaseNumberGenerator:
"""Declare a method -- `get_number`."""

def __init__(self):
breakpoint()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

`breakpoint()` can halt runtime and block request handling


breakpoint() in __init__ executes whenever BaseNumberGenerator is instantiated. In non-interactive environments it can hang process flow or fail unpredictably, causing availability issues in production.

Remove breakpoint() from runtime code. Use conditional logging or guarded debug hooks behind an explicit development-only flag

self.limits = (1, 10)

def get_number(self, min_max):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Method doesn't use the class instance and could be converted into a static method


The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Method doesn't use the class instance and could be converted into a static method


The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.

Expand Down
2 changes: 1 addition & 1 deletion hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BaseNumberGenerator:
def __init__(self):
self.limits = (1, 10)

def get_number(self, min_max):
def get_number(self, min_max, max_min):
raise NotImplemented

def smethod():
Expand Down
Loading