Skip to content

feat: extend ruff checking and fix found issues - #195

Merged
nijel merged 42 commits into
masterfrom
ruff
Feb 5, 2026
Merged

feat: extend ruff checking and fix found issues#195
nijel merged 42 commits into
masterfrom
ruff

Conversation

@nijel

@nijel nijel commented Feb 5, 2026

Copy link
Copy Markdown
Member

No description provided.

Comment thread examples/addfile.py Dismissed
Comment thread setup.py Dismissed
@nijel
nijel enabled auto-merge (rebase) February 5, 2026 08:38
@nijel
nijel disabled auto-merge February 5, 2026 08:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request extends ruff linting configuration and applies automatic fixes across the codebase to improve code quality and consistency. The changes include adding comprehensive ruff rules in pyproject.toml, converting unittest assertions to plain assert statements, adding type hints to function signatures, updating docstrings to single-line format, and modernizing file I/O operations using pathlib.

Changes:

  • Added comprehensive ruff linting configuration with selective rule ignoring
  • Converted unittest-style assertions (assertEqual, assertTrue, assertRaises) to pytest-style assertions throughout test files
  • Added return type hints (-> None) to functions across test files, source files, and examples
  • Modernized file operations using pathlib instead of open() with context managers
  • Updated docstrings from multi-line to single-line format where appropriate

Reviewed changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pyproject.toml Added comprehensive ruff linting configuration with rules and per-file ignores
test/test_worker.py Added type hints and converted assertions to pytest style
test/test_unicode_surrogates.py Added type hints and converted assertions to pytest style
test/test_smsd.py Migrated from unittest.SkipTest to pytest.skip, added type hints, modernized file I/O
test/test_sms.py Added type hints and converted assertions to pytest style
test/test_errors.py Added NoReturn type hint, converted to pytest.raises, removed exception instantiation
test/test_dummy.py Added type hints, converted assertions, modernized file I/O with pathlib
test/test_data.py Added type hints and converted assertions to pytest style
test/test_config.py Added type hints, converted assertions, modernized file I/O with pathlib
test/test_backup.py Added type hints and converted assertions to pytest style
test/test_asyncworker.py Added type hints, converted to pytest.raises, improved async termination logic
setup.py Added type hints, added noqa comments for security warnings, improved code structure
gammu/worker.py Added type hints and simplified docstrings to single-line format
gammu/smsd.py Simplified module docstring to single-line format
gammu/exception.py Simplified module docstring and added noqa comment
gammu/data.py Alphabetically sorted all exports
gammu/asyncworker.py Added copyright header, type hints, improved termination with asyncio.to_thread
gammu/init.py Simplified module docstring to single-line format
examples/*.py Added type hints, improved docstrings, refactored code for better maintainability
Comments suppressed due to low confidence (1)

setup.py:51

  • The check_pkconfig method can return None implicitly when no exception is caught and no explicit return is executed, but the type hint indicates it returns bool | None. The function should have an explicit return None statement at the end for clarity, or the logic should be restructured to ensure all paths return a boolean value explicitly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/test_sms.py
Comment thread examples/savesmspercontact.py Outdated
Comment thread setup.py
Comment thread test/test_asyncworker.py
Comment thread examples/savesmspercontact.py Outdated
Comment thread test/test_errors.py
def error_function():
raise gammu.exception.ERR_WRONGCRC()
def error_function() -> NoReturn:
raise gammu.exception.ERR_WRONGCRC

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

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

The change from raise gammu.exception.ERR_WRONGCRC() to raise gammu.exception.ERR_WRONGCRC removes the function call parentheses. This changes the behavior - if ERR_WRONGCRC is a class, it should be instantiated with parentheses. Please verify that ERR_WRONGCRC is intended to be raised as-is without instantiation.

Copilot uses AI. Check for mistakes.
Comment thread examples/service_numbers.py Outdated
@nijel
nijel enabled auto-merge (rebase) February 5, 2026 08:52
@nijel
nijel merged commit aeaca84 into master Feb 5, 2026
44 checks passed
@nijel
nijel deleted the ruff branch February 5, 2026 08:55
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.

3 participants