- Remove unused thiserror dependency from Cargo.toml - Remove unused imports (Text, Tabs, Widget, Event, KeyCode, KeyEventKind) from tui/mod.rs - Remove unused imports (File, Write) from export/mod.rs - Remove unused pub use ComplexityDistribution from core/analyzer.rs
95 lines
2.1 KiB
Python
95 lines
2.1 KiB
Python
# Python sample file with technical debt comments
|
|
|
|
def calculate_average(numbers):
|
|
# TODO: Handle empty list case
|
|
return sum(numbers) / len(numbers)
|
|
|
|
|
|
def process_user(user_data):
|
|
# FIXME: This may raise KeyError for missing fields
|
|
name = user_data['name']
|
|
email = user_data['email']
|
|
return {'name': name, 'email': email}
|
|
|
|
|
|
def fetch_data_from_api(endpoint):
|
|
# HACK: Skip SSL verification for testing
|
|
import requests
|
|
response = requests.get(endpoint, verify=False)
|
|
# TODO: Add retry logic
|
|
return response.json()
|
|
|
|
|
|
class DatabaseConnection:
|
|
def __init__(self, connection_string):
|
|
# FIXME: Connection string should be encrypted
|
|
self.connection_string = connection_string
|
|
|
|
def connect(self):
|
|
# BUG: Connection timeout not implemented
|
|
print("Connecting to database...")
|
|
|
|
def disconnect(self):
|
|
# NOTE: Pool cleanup happens automatically
|
|
print("Disconnecting...")
|
|
|
|
|
|
def temp_workaround():
|
|
# TEMP: Quick fix for production issue
|
|
return None
|
|
|
|
|
|
def old_implementation():
|
|
# REFACTOR: Use list comprehension instead
|
|
result = []
|
|
for i in range(10):
|
|
result.append(i * 2)
|
|
return result
|
|
|
|
|
|
def validate_input(data):
|
|
# XXX: Critical security vulnerability!
|
|
# This eval is dangerous
|
|
return eval(data) # nosec
|
|
|
|
|
|
def complex_function():
|
|
# TODO: This function is too long, split it up
|
|
# TODO: Add type hints
|
|
# TODO: Add docstring
|
|
x = 1
|
|
y = 2
|
|
z = 3
|
|
a = 4
|
|
b = 5
|
|
return x + y + z + a + b
|
|
|
|
|
|
class LegacyClass:
|
|
"""This class needs refactoring."""
|
|
def __init__(self):
|
|
self._internal_state = None
|
|
# FIXME: Memory leak risk
|
|
|
|
def _old_method(self):
|
|
# NOTE: This is deprecated
|
|
pass
|
|
|
|
def new_method(self):
|
|
"""Modern replacement for _old_method."""
|
|
pass
|
|
|
|
|
|
# TODO: Add exception handling
|
|
# TODO: Write docstrings for all public methods
|
|
# TODO: Add unit tests
|
|
|
|
def main():
|
|
data = [1, 2, 3, 4, 5]
|
|
avg = calculate_average(data)
|
|
print(f"Average: {avg}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|