asottile / setup-cfg-fmt

apply a consistent format to `setup.cfg` files
MIT License
153 stars 18 forks source link

Return 0 to avoid errors with setup-cfg-fmt in Makefile #202

Closed tobiasmcvey closed 1 year ago

tobiasmcvey commented 1 year ago

Hi!

I am using setup-cfg-fmt in a makefile. When I run make format it returns an error.

The makefile command

format:
    setup-cfg-fmt setup.cfg

Output from terminal when I run make format

setup-cfg-fmt setup.cfg
Rewriting setup.cfg
make: *** [format] Error 1

The script works as expected and updates setup.cfg.

I cannot see any error in your script, but maybe it is because the script returns the variable retv set to 1 if it completes successfully, and Make expects programs return 0 if there aren't any errors.

Can you make a small change to the script and set the variable retv to 0 if it runs successfully? Another option is to not return retv if it isn't used.

asottile commented 1 year ago

the nonzero exit code is to indicate changes have occurred. you're free to ignore the exit code