Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Commit

Permalink
Adds pyatlan-formatter
Browse files Browse the repository at this point in the history
I observed that the pre-commit script only executes on Git-tracked files.
However, this poses an issue when we generate new modules and attempt to run
the formatter on them, as it requires tracking (staging) those files before running
`pre-commit run --all-files`. This adds unnecessary steps for users who may not be familiar with pre-commit.

To address this, I propose the addition of a simple shell script,
`./pyatlan-formatter`, which can handle formatting tasks for both tracked and untracked .
  • Loading branch information
Aryamanz29 committed May 14, 2024
1 parent 782b9ab commit 6811199
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pyatlan-formatter
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Get the filenames of changed files and untracked files
changed_files=$(git diff --name-only HEAD)
untracked_files=$(git ls-files --others --exclude-standard)

# Combine changed and untracked files
all_files="${changed_files}
${untracked_files}"

# Pass the filenames to pre-commit run --files
echo "$all_files" | tr '\n' '\0' | xargs -0 pre-commit run --files

0 comments on commit 6811199

Please sign in to comment.