Replace pylint and isort with ruff linter#1251
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughReplaces Pylint and isort with Ruff for linting and formatting across CI, project config, and developer docs. It also modernizes type annotations in source and model modules, removes pylint directives, and updates tests to use stricter exception and value assertions. ChangesRuff Migration and Type Annotation Modernization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/client/test_client_tenant_token.py (1)
130-135: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winThe “no api key” test is currently asserting the wrong failure path.
This test now triggers a missing-argument
TypeError(noapi_key_uid) instead of exercising the intended missing-api-key validation ingenerate_tenant_token.Proposed fix
-def test_generate_tenant_token_with_no_api_key(client): +def test_generate_tenant_token_with_no_api_key(get_private_key): """Tests create a tenant token with no api key.""" client = meilisearch.Client(BASE_URL) - with pytest.raises(TypeError): - client.generate_tenant_token(search_rules=["*"]) + with pytest.raises(ValueError): + client.generate_tenant_token(api_key_uid=get_private_key.uid, search_rules=["*"])🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/client/test_client_tenant_token.py` around lines 130 - 135, The test test_generate_tenant_token_with_no_api_key is missing the required api_key_uid parameter when calling client.generate_tenant_token(), which causes a TypeError for the missing argument instead of testing the intended missing-api-key validation. Add the api_key_uid parameter to the generate_tenant_token() call with a valid test value (like a non-empty string) so the function executes far enough to reach and validate the missing API key condition in the client that was initialized without an API key.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/index/test_index_search_meilisearch.py`:
- Line 12: The assertions at lines 12, 446, and 459 are comparing a string
directly to the response dict (e.g., assert "hitsPerPage" != response), which
doesn't properly validate key absence and allows incorrect passes. Replace these
assertions with membership checks using the `not in` operator to verify that the
key is not present in the response dict. For example, change the comparison
pattern to check if the string key is not in the response dictionary.
In `@tox.ini`:
- Line 2: The envlist configuration is missing Ruff for linting, causing the
default tox run to skip lint checks even though documentation describes linting
as part of tox execution. Either add a Ruff environment configuration section to
tox.ini (defining how to run ruff checks) and include it in the envlist on line
2, or update the project documentation to accurately reflect that the default
tox run only performs type checking and testing without linting.
---
Outside diff comments:
In `@tests/client/test_client_tenant_token.py`:
- Around line 130-135: The test test_generate_tenant_token_with_no_api_key is
missing the required api_key_uid parameter when calling
client.generate_tenant_token(), which causes a TypeError for the missing
argument instead of testing the intended missing-api-key validation. Add the
api_key_uid parameter to the generate_tenant_token() call with a valid test
value (like a non-empty string) so the function executes far enough to reach and
validate the missing API key condition in the client that was initialized
without an API key.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bb75ce00-d167-44cd-a038-065f4d10b206
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (49)
.github/workflows/tests.ymlCONTRIBUTING.mdmeilisearch/__init__.pymeilisearch/_httprequests.pymeilisearch/_utils.pymeilisearch/client.pymeilisearch/config.pymeilisearch/errors.pymeilisearch/index.pymeilisearch/models/document.pymeilisearch/models/embedders.pymeilisearch/models/index.pymeilisearch/models/key.pymeilisearch/models/task.pymeilisearch/models/webhook.pymeilisearch/task.pypyproject.tomltests/__init__.pytests/client/test_chat_completions.pytests/client/test_client.pytests/client/test_client_dumps.pytests/client/test_client_exports.pytests/client/test_client_key_meilisearch.pytests/client/test_client_swap_meilisearch.pytests/client/test_client_task_meilisearch.pytests/client/test_client_tenant_token.pytests/client/test_clinet_snapshots.pytests/client/test_multimodal.pytests/client/test_version.pytests/conftest.pytests/errors/test_api_error_meilisearch.pytests/errors/test_communication_error_meilisearch.pytests/errors/test_timeout_error_meilisearch.pytests/index/test_index.pytests/index/test_index_document_meilisearch.pytests/index/test_index_facet_search_meilisearch.pytests/index/test_index_search_meilisearch.pytests/index/test_index_task_meilisearch.pytests/index/test_index_wait_for_task.pytests/models/test_document.pytests/settings/test_settings.pytests/settings/test_settings_displayed_attributes_meilisearch.pytests/settings/test_settings_embedders.pytests/settings/test_settings_filterable_attributes_meilisearch.pytests/settings/test_settings_localized_attributes_meilisearch.pytests/settings/test_settings_searchable_attributes_meilisearch.pytests/settings/test_settings_sortable_attributes_meilisearch.pytests/settings/test_settings_typo_tolerance_meilisearch.pytox.ini
💤 Files with no reviewable changes (14)
- tests/errors/test_communication_error_meilisearch.py
- tests/settings/test_settings_sortable_attributes_meilisearch.py
- tests/settings/test_settings_displayed_attributes_meilisearch.py
- tests/client/test_clinet_snapshots.py
- tests/client/test_client_dumps.py
- tests/client/test_client_swap_meilisearch.py
- tests/index/test_index_facet_search_meilisearch.py
- tests/models/test_document.py
- tests/settings/test_settings_searchable_attributes_meilisearch.py
- tests/client/test_version.py
- tests/client/test_client.py
- tests/errors/test_api_error_meilisearch.py
- tests/settings/test_settings_filterable_attributes_meilisearch.py
- tests/index/test_index_wait_for_task.py
…n` operator - These assertions always passed without actually checking anything - Use `not in` so they properly verify the key is absent from the response
sanders41
left a comment
There was a problem hiding this comment.
In general this looks good to me. I just have a question about linting in CI because the output looks off to me (detailed in the review).
Use `--output-format=full` so ruff check prints complete diagnostics with source context, making linter failures easier to debug in CI logs.
Description
Replace Pylint and isort with Ruff for linting.
pylintcomments and references from the codebasepylintfromtox.ini.Ruffinstead of Pylint and isortCONTRIBUTING.mdTests
% uv run --python=3.10 pytest -qPR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Summary by CodeRabbit