Skip to content

build: update dependencies - #1139

Merged
PascalRepond merged 1 commit into
rero:stagingfrom
PascalRepond:rep-deps
Jul 27, 2026
Merged

build: update dependencies#1139
PascalRepond merged 1 commit into
rero:stagingfrom
PascalRepond:rep-deps

Conversation

@PascalRepond

Copy link
Copy Markdown
Contributor

Adapt the configuration and the code to the new ruff default rule selection.

  • Drops the D100, D200, D205 and PERF203 ignores, without any violation left in the code base.
  • Fixes the violations behind the D101, D103, D202, D400, F403, F405 and F841 ignores and drops them as well.
  • Scopes N815 to the marshmallow and serializer schemas, which mirror the camelCase fields of the JSON schemas.
  • Keeps BLE001, D401, DTZ, RUF012 and TRY002 ignored, as they cover deliberate patterns, and documents the reason of each ignore.
  • Removes dead variables in the DNB service, the documents serializer, the documents permissions and the suggestions REST module.
  • Replaces the star import of the utils tests by explicit imports.
  • Raises TypeError for an invalid argument type and catches only the netaddr errors in is_ip_in_list() and get_ips_list().
  • Raises RuntimeError in the view generating an error for test purposes.
  • Renames the loop variables shadowing a fixture or an argument in the stats permissions tests and in the fixtures CLI.

Updated dependencies (54 packages).

@PascalRepond
PascalRepond marked this pull request as ready for review July 27, 2026 07:14
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The pull request updates Ruff lint rules and per-file exceptions, refines several runtime implementations, adjusts document permissions and serialization behavior, removes redundant returns and assignments, and adds role cleanup after deletion. Tests are aligned with changed exception and authorization behavior, identifier extraction coverage is added, fixtures and imports are cleaned up, and numerous test docstrings and whitespace sections are standardized.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is related because the PR also updates dependencies, though it undersells the main Ruff and code cleanup work.
Description check ✅ Passed The description clearly matches the changeset, covering Ruff config updates, code fixes, and dependency updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 4

🤖 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 `@pyproject.toml`:
- Line 244: Resolve all A002 violations caused by enabling the “A” Ruff ruleset,
prioritizing renaming affected function parameters named file in harvest.py,
fixtures.py, and other occurrences while preserving call behavior; use narrowly
scoped lint exceptions only where renaming is impractical. Run uv run poe lint
and address any remaining violations.

In `@sonar/modules/cli/fixtures.py`:
- Around line 172-176: Update the attachment-loading loop around
db_record.add_file to resolve each record_file["path"] against directory, reject
candidates that resolve outside the fixture directory (including absolute paths
and traversal), and only open validated paths. Preserve the existing file check
and attachment behavior for paths contained within the fixture directory.

In `@sonar/modules/utils.py`:
- Around line 193-194: Update both exception-handling loops in is_ip_in_list and
get_ips_list to validate each ip_range is a string before evaluating membership
or parsing, so values such as None and integers are skipped as invalid entries.
Preserve the narrowed exception handling for parsing errors and do not restore a
blanket Exception handler.

In `@sonar/suggestions/rest.py`:
- Line 44: In the service-resolution fallback around sonar.service(resource) and
search_cls(...), replace the broad Exception handler with only the known
service-resolution or import-related exceptions. Preserve the
RECORDS_REST_ENDPOINTS fallback for those expected failures, while allowing
unexpected initialization or programming errors to propagate instead of becoming
a misleading 404.
🪄 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 Plus

Run ID: b882bacb-1c14-432b-80b5-9f75b693859c

📥 Commits

Reviewing files that changed from the base of the PR and between 9240402 and bee513c.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (50)
  • pyproject.toml
  • sonar/heg/cli/harvest.py
  • sonar/heg/serializers/schemas/medline.py
  • sonar/modules/babel_extractors.py
  • sonar/modules/cli/fixtures.py
  • sonar/modules/documents/cli/oai.py
  • sonar/modules/documents/dnb.py
  • sonar/modules/documents/dojson/sru/model.py
  • sonar/modules/documents/permissions.py
  • sonar/modules/documents/serializers/json.py
  • sonar/modules/documents/urn.py
  • sonar/modules/organisations/api.py
  • sonar/modules/permissions.py
  • sonar/modules/swisscovery/rest.py
  • sonar/modules/users/api.py
  • sonar/modules/users/extensions/remove_roles.py
  • sonar/modules/utils.py
  • sonar/resources/projects/service.py
  • sonar/suggestions/rest.py
  • sonar/theme/views.py
  • tests/api/collections/test_collections_documents_facets.py
  • tests/api/collections/test_collections_files_permissions.py
  • tests/api/deposits/test_deposits_files_permissions.py
  • tests/api/documents/test_documents_ark.py
  • tests/api/documents/test_documents_files_permissions.py
  • tests/api/documents/test_documents_permissions.py
  • tests/api/documents/test_documents_query.py
  • tests/api/organisations/test_organisations_files_permissions.py
  • tests/api/stats/test_stats_permissions.py
  • tests/api/subdivisions/test_subdivisions_documents_facets.py
  • tests/conftest.py
  • tests/ui/collections/test_collections_view_permissions.py
  • tests/ui/deposits/test_deposits_view_permissions.py
  • tests/ui/documents/cli/test_documents_cli_ark.py
  • tests/ui/documents/schemas/test_sru_schema.py
  • tests/ui/documents/test_dc_schema.py
  • tests/ui/documents/test_documents_dumpers.py
  • tests/ui/documents/test_documents_receivers.py
  • tests/ui/documents/test_documents_view_permissions.py
  • tests/ui/documents/test_documents_views.py
  • tests/ui/organisations/test_organisations_view_permissions.py
  • tests/ui/projects/test_projects_api.py
  • tests/ui/shibboleth_authenticator/test_shibboleth_auth.py
  • tests/ui/test_permissions.py
  • tests/ui/test_utils.py
  • tests/ui/test_views.py
  • tests/ui/users/test_users_cli.py
  • tests/unit/documents/serializers/test_google_scholar_schema.py
  • tests/unit/documents/serializers/test_schemaorg_schema.py
  • tests/unit/resources/test_resources_api.py
💤 Files with no reviewable changes (22)
  • tests/ui/documents/test_documents_view_permissions.py
  • tests/ui/documents/test_documents_receivers.py
  • sonar/modules/documents/dnb.py
  • sonar/modules/users/extensions/remove_roles.py
  • tests/ui/deposits/test_deposits_view_permissions.py
  • tests/ui/documents/schemas/test_sru_schema.py
  • tests/ui/documents/test_documents_dumpers.py
  • sonar/modules/users/api.py
  • tests/api/documents/test_documents_ark.py
  • tests/api/organisations/test_organisations_files_permissions.py
  • tests/ui/documents/cli/test_documents_cli_ark.py
  • tests/ui/organisations/test_organisations_view_permissions.py
  • sonar/modules/documents/serializers/json.py
  • tests/api/documents/test_documents_permissions.py
  • tests/ui/collections/test_collections_view_permissions.py
  • tests/api/documents/test_documents_files_permissions.py
  • tests/api/collections/test_collections_files_permissions.py
  • sonar/modules/organisations/api.py
  • sonar/heg/serializers/schemas/medline.py
  • tests/api/deposits/test_deposits_files_permissions.py
  • sonar/modules/documents/dojson/sru/model.py
  • tests/ui/projects/test_projects_api.py

Comment thread pyproject.toml
Comment thread sonar/modules/cli/fixtures.py
Comment thread sonar/modules/utils.py
Comment thread sonar/suggestions/rest.py Outdated
Adapt the configuration and the code to the new ruff default rule selection.

* Drops the `D100`, `D200`, `D205` and `PERF203` ignores, without any
  violation left in the code base.
* Fixes the violations behind the `D101`, `D103`, `D202`, `D400`, `F403`,
  `F405` and `F841` ignores and drops them as well.
* Scopes `N815` to the marshmallow and serializer schemas, which mirror the
  camelCase fields of the JSON schemas.
* Keeps `BLE001`, `D401`, `DTZ`, `RUF012` and `TRY002` ignored, as they cover
  deliberate patterns, and documents the reason of each ignore.
* Removes dead variables in the DNB service, the documents serializer, the
  documents permissions and the suggestions REST module.
* Replaces the star import of the utils tests by explicit imports.
* Raises `TypeError` for an invalid argument type and catches only the
  netaddr errors in `is_ip_in_list()` and `get_ips_list()`.
* Raises `RuntimeError` in the view generating an error for test purposes.
* Renames the loop variables shadowing a fixture or an argument in the stats
  permissions tests and in the fixtures CLI.

Updated dependencies (54 packages).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-by: Pascal Repond <pascal.repond@rero.ch>
@PascalRepond
PascalRepond merged commit 1d1f2dd into rero:staging Jul 27, 2026
3 checks passed
@PascalRepond
PascalRepond deleted the rep-deps branch July 27, 2026 07:43
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