Skip to content

Conversation

@mattbrictson
Copy link
Contributor

Setting gemfile: false in .overcommit.yml is supposed to disable Bundler. However, a recently-introduced bug causes false to be interpreted as the name of the gemfile. Bundler looks for a gemfile named "false", which fails, leading overcommit's hooks to crash.

This PR fixes the bug by adjusting the regex used to parse the gemfile: line in the config. Now, false is no longer interpreted as a gemfile name.

I added an integration test to verify the fix.

Fixes #862

@sds sds added the bug label Feb 16, 2025
@sds sds merged commit 3db733e into sds:main Feb 16, 2025
15 checks passed
@sds
Copy link
Owner

sds commented Feb 16, 2025

Thank you.

sds pushed a commit that referenced this pull request Feb 19, 2025
…t.yml (#865)

Related to #863 and [this
comment](#862 (comment)):

> Having a similar problem since we had this line in our
`.overcommit.yml`:
> 
> ```yaml
> gemfile: Gemfile # enforce bundled version of overcommit
> ```
>
> And now overcommit doesn't strip out the inline comment, resulting in
this weird looking error message:
>
> ```
> Problem loading 'Gemfile # enforce bundled version of overcommit':
/path/to/project/Gemfile # enforce bundled version of overcommit not
found
> ```

I think adding support for comments in the `gemfile:` regexp is likely
overkill and may still not be enough when the next person tries to use
yet another YAML feature in that line, but perhaps this little warning
would help someone else avoid tripping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gemfile:false option no longer behaves as expected in YAML config

2 participants