google / google/yapf

Exit code with diff and ignore

Open
#727 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

the docs state:

> If --diff is supplied, YAPF returns zero when no changes were necessary, non-zero otherwise (including program error). You can use this in a CI workflow to test that code has been YAPF-formatted.

But yapf also throws an exception and returns non-zero when it doesn't find any files. It might be nice to know if you specified a non-existent file, but yapf also returns an error code if all files are ignored due to .yapfignore or the equivalent command line argument.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the command-line handling for --diff, missing files, and files excluded by .yapfignore or its command-line equivalent. The issue does not name a file or test and does not settle the desired exit-code behavior, so clarify the expected distinction before implementing and add coverage for the agreed cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.