Skip to content

Support directory URLs and refine documentation#94

Merged
Kilo59 merged 7 commits intomainfrom
wily-fix
Mar 14, 2026
Merged

Support directory URLs and refine documentation#94
Kilo59 merged 7 commits intomainfrom
wily-fix

Conversation

@Kilo59
Copy link
Copy Markdown
Owner

@Kilo59 Kilo59 commented Mar 14, 2026

Summary

This PR enhances ruff-sync's URL handling capabilities and cleans up documentation for a better user experience.

✨ Key Features

  • Directory URL Support: ruff-sync now correctly resolves GitHub and GitLab /tree/ URLs (e.g., https://github.com/org/repo/tree/main/config), allowing users to point directly to configuration directories.
  • Smart Configuration Discovery: When pointing to a directory, ruff-sync automatically discovers configuration files, checking for pyproject.toml, ruff.toml, and .ruff.toml (in that order).
  • Enriched Documentation: The README.md "Curated Examples" section now enumerates multiple supported URL formats (Repo, Tree, Blob, Raw, Git SSH), making it easier for users to understand the tool's flexibility.

🛠️ Technical Improvements

  • Reduced Complexity: Refactored fetch_upstream_config by extracting discovery and git-cloning logic into dedicated internal functions, significantly improving maintainability (C901).
  • Optimized Performance: Discovery loops now use direct status code checks to avoid try-except overhead (PERF203).
  • Bug Fix: Fixed Wily complexity workflow output formatting.

🧪 Validation

  • Added 43 comprehensive tests to tests/test_url_handling.py covering the new URL formats and discovery logic.
  • Verified all linting and formatting checks pass.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Mar 14, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the Wily complexity GitHub Action to use the multiline output syntax for step outputs and bumps the project version from a dev suffix to a release version in both configuration and runtime metadata.

File-Level Changes

Change Details Files
Switch Wily complexity workflow step to use GitHub Actions multiline output syntax for the diff result.
  • Replace manual percent/newline/carriage-return escaping of the diff output with the GitHub Actions multiline output format using a here-doc style (diff<<EOF).
  • Continue exposing the computed diff via the GITHUB_OUTPUT file for subsequent steps.
.github/workflows/complexity.yaml
Promote package version from a dev pre-release to a stable release and keep runtime version constant with metadata.
  • Update project version in pyproject.toml from 0.0.5.dev2 to 0.0.5.
  • Update version constant in ruff_sync.py from 0.0.5.dev2 to 0.0.5 to stay in sync with packaging metadata.
pyproject.toml
ruff_sync.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Kilo59 Kilo59 self-assigned this Mar 14, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 14, 2026

Codecov Report

❌ Patch coverage is 86.30137% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.29%. Comparing base (42637da) to head (40ec82c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
ruff_sync.py 86.30% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #94      +/-   ##
==========================================
- Coverage   91.70%   90.29%   -1.42%     
==========================================
  Files           1        1              
  Lines         470      515      +45     
==========================================
+ Hits          431      465      +34     
- Misses         39       50      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In the workflow change, consider using a less generic heredoc delimiter than EOF (e.g., DIFF_EOF) to avoid potential collisions if the Wily diff output were ever to contain the string EOF on its own line.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the workflow change, consider using a less generic heredoc delimiter than `EOF` (e.g., `DIFF_EOF`) to avoid potential collisions if the Wily diff output were ever to contain the string `EOF` on its own line.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions
Copy link
Copy Markdown
Contributor

╒═══════════════╤═════════════════╤══════════════╤═════════════════╤════════════╕
│ File          │ Lines of Code   │ Cyclomatic   │ Maintainabili   │ Unique     │
│               │                 │ Complexity   │ ty Index        │ Operands   │
╞═══════════════╪═════════════════╪══════════════╪═════════════════╪════════════╡
│ ruff_sync.py  │ 1003 -> 1071    │ 144 -> 171   │ 25.3215 ->      │ 14 -> 14   │
│               │                 │              │ 19.8921         │            │
├───────────────┼─────────────────┼──────────────┼─────────────────┼────────────┤
│ tests/test_ur │ 218 -> 252      │ 6 -> 7       │ 67.7977 ->      │ 3 -> 3     │
│ l_handling.py │                 │              │ 65.7213         │            │
╘═══════════════╧═════════════════╧══════════════╧═════════════════╧════════════╛

@Kilo59 Kilo59 changed the title Wily fix Support directory URLs and refine documentation Mar 14, 2026
@Kilo59 Kilo59 merged commit 0d65b8a into main Mar 14, 2026
12 checks passed
@Kilo59 Kilo59 deleted the wily-fix branch March 14, 2026 16:31
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