Skip to content

feat: pre-commit hook to detect absolute paths in files#147

Merged
kelly-sovacool merged 18 commits intomainfrom
precommit-hooks
Feb 26, 2026
Merged

feat: pre-commit hook to detect absolute paths in files#147
kelly-sovacool merged 18 commits intomainfrom
precommit-hooks

Conversation

@kelly-sovacool
Copy link
Member

@kelly-sovacool kelly-sovacool commented Feb 25, 2026

Changes

Followed this guide for creating the hook https://stefaniemolin.com/articles/devx/pre-commit/hook-creation-guide/

New CLI interface for pre-commit hooks:

ccbr-hooks [command]

New hook: Detect absolute file paths

ccbr-hook detect-absolute-paths [files]

Any instances of absolute paths (i.e. paths starting with "/") in the given files will be detected and printed to the console, and an error will be raised at the end if any are found.

Usage with pre-commit

Add this to your .pre-commit-config.yaml file:

- repo: https://github.com/CCBR/Tools
  rev: v0.5.0
  hooks:
    - id: detect-absolute-paths

Ignoring specific lines

You can ignore specific lines by including the string "abs-path:ignore" in the line, e.g.:

some_path = "/absolute/path/to/file" # abs-path:ignore

Issues

NA

PR Checklist

(Strikethrough any points that are not applicable.)

  • This comment contains a description of changes with justifications, with any relevant issues linked.
  • Write unit tests for any new features, bug fixes, or other code changes.
  • Update docs if there are any API changes.
  • Update CHANGELOG.md with a short description of any user-facing changes and reference the PR number. Guidelines: https://keepachangelog.com/en/1.1.0/

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@22f84bf). Learn more about missing BASE report.
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #147   +/-   ##
=======================================
  Coverage        ?   72.35%           
=======================================
  Files           ?       27           
  Lines           ?     1841           
  Branches        ?        0           
=======================================
  Hits            ?     1332           
  Misses          ?      509           
  Partials        ?        0           

☔ 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.

@kelly-sovacool kelly-sovacool marked this pull request as ready for review February 26, 2026 20:13
@kelly-sovacool kelly-sovacool merged commit 5623a7a into main Feb 26, 2026
8 checks passed
@kelly-sovacool kelly-sovacool deleted the precommit-hooks branch February 26, 2026 20:13
@github-actions github-actions bot restored the precommit-hooks branch February 26, 2026 20:13
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