codeclimate/codeclimate-bundler-audit

support finding the Gemfile.lock in a subdirectory

travi opened this issue · 6 comments

While I understand it is not common for the Gemfile to be anywhere but in the root of the repository, I have a project where it is under the test/ directory. In its current state, this audit is unable to find it and I get the following error:

/usr/src/app/lib/cc/engine/bundler_audit/analyzer.rb:16:in `run': No Gemfile.lock found. (CC::Engine::BundlerAudit::Analyzer::GemfileLockNotFound)
    from /usr/src/app/bin/bundler-audit:7:in `<main>'

Would it be possible to either scan subdirectories or enable a configuration so that the containing directory could be provided?

Hi @travi , this is definitely something we have on the roadmap for this engine, but isn't possible at this time. I'll leave this issue open with the enhancement and help-wanted labels and report back if someone's able to implement it. Thanks.

jclif commented

This would definitely be beneficial to our project as well, which is making use of the monolithic approach to source control.

Hey @jclif,

As of #40 we now support an alternate path to a Gemfile.lock file:

engines:
  bundler-audit:
    enabled: true
    path: test/Gemfile.lock

I'm going to close this issue for now, but let us know if you run into any issues!

travi commented

@dblandin i'm still seeing the following error after updating my config:

/usr/src/app/lib/cc/engine/bundler_audit/analyzer.rb:18:in `run': No Gemfile.lock found. (CC::Engine::BundlerAudit::Analyzer::GemfileLockNotFound)
	from /usr/src/app/bin/bundler-audit:9:in `<main>'

has this update not been deployed yet?

@travi Sorry about that!

I forgot the nested config key in my last example. The correct addition should be:

engines:
  bundler-audit:
    enabled: true
    config:
      path: test/Gemfile.lock
travi commented

looks like that took care of it. thanks!