Skip to content

Fix qodana issues#22

Merged
xprilion merged 2 commits into
mainfrom
dev
Apr 27, 2026
Merged

Fix qodana issues#22
xprilion merged 2 commits into
mainfrom
dev

Conversation

@xprilion
Copy link
Copy Markdown
Owner

This pull request primarily improves type hinting consistency across the codebase by adopting modern Python syntax (PEP 604), enhances resource cleanup in error handling, and updates the Qodana linter configuration for better static analysis. Below are the most important changes grouped by theme:

Type Hinting and Code Consistency:

  • Updated function signatures in backend/openmlr/db/operations.py to use the modern union type hint syntax (str | None instead of str = None) for parameters like content, url, and category. [1] [2]

Error Handling and Resource Cleanup:

  • Improved resource cleanup in backend/openmlr/tools/compute_tools.py by initializing sm to None and ensuring sm.destroy() is only called if sm was created, preventing potential UnboundLocalError during exception handling. [1] [2]

Import Management:

  • Moved the import of operations inside get_or_create_session in backend/openmlr/services/session_manager.py to avoid circular imports; removed redundant imports. [1] [2]

Testing Improvements:

  • Simplified the mock_stream function in test_cancelled_returns_none by removing unreachable code, making the test clearer.

Linter and Tooling Configuration:

  • Updated qodana.yaml to explicitly use Python 3.12 for Qodana static analysis, ensuring compatibility with new type hinting syntax and improving inspection accuracy.

@github-actions
Copy link
Copy Markdown

Qodana for Python

167 new problems were found

Inspection name Severity Problems
Unused imports 🔶 Warning 2
Invalid type hints definitions and usages 🔶 Warning 1
Redundant character escape 🔶 Warning 1
Unused local symbols ◽️ Notice 67
Accessing a protected member of a class or a module ◽️ Notice 43
Unclear exception clauses ◽️ Notice 30
Shadowing names from outer scopes ◽️ Notice 10
Method is not declared static ◽️ Notice 6
PEP 8 naming convention violation ◽️ Notice 4
Non-optimal list declaration ◽️ Notice 2
An instance attribute is defined outside init`` ◽️ Notice 1

☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@xprilion xprilion merged commit efc7996 into main Apr 27, 2026
7 checks passed
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