Skip to content

Move DIRECTORY.md to its own section in pr_file_map.py - #15353

Merged
cclauss merged 2 commits into
TheAlgorithms:masterfrom
priya-sundaram-dev:directory-md-bottom-section
Sep 15, 2026
Merged

cclauss merged 2 commits into
TheAlgorithms:masterfrom
priya-sundaram-dev:directory-md-bottom-section

Conversation

@priya-sundaram-dev

Copy link
Copy Markdown
Contributor

Describe your change

Per @cclauss's request in #15081, this reworks scripts/pr_file_map.py so that DIRECTORY.md no longer distracts busy maintainers.

DIRECTORY.md is auto-generated, so nearly every open PR modifies it. That meant it was always the single most "contested" file and dominated the possible merge conflicts list, drowning out the real source-file collisions maintainers actually need to coordinate.

Changes

  • DIRECTORY.md gets its own section at the very bottom of the report, out of the contested/existing lists. Because a conflict caused only by this file is trivially resolved with accept both in the GitHub UI, that bottom section splits the PRs into:
    • PRs whose only overlap is DIRECTORY.md — safe to accept both, no rebase needed; and
    • PRs that also overlap on other files — these need a genuine review or rebase, with the specific conflicting files listed per PR.
  • The "possible merge conflicts" count/list now excludes DIRECTORY.md, so it reflects only real source-file hot spots.
  • The Script: line is now relative to the git root (scripts/pr_file_map.py) instead of an absolute, machine-specific path like /Users/cclauss/TheAlgorithms/Python/scripts/pr_file_map.py.
  • Refactored the render into small helpers (split_directory_conflicts, render_file_section, render_directory_section) to keep main() under the McCabe/branch limits.

ruff check and ruff format --check are green, and I unit-tested the rendering against mocked gh data to confirm the categorization and the relative path.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues, then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

DIRECTORY.md is auto-generated and touched by nearly every open PR, so it
dominated the 'possible merge conflicts' list and distracted maintainers.
Pull it out into a dedicated section at the very bottom of the report that
separates PRs whose only overlap is DIRECTORY.md (safe to 'accept both' in
the GitHub UI) from PRs that also collide on real source files.

Also render the Script path relative to the git root instead of an absolute
machine-specific path.
@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Sep 15, 2026

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Love this!! Thx.

@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Sep 15, 2026
@cclauss
cclauss merged commit 00d9ebb into TheAlgorithms:master Sep 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants