Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding rubocop-capybara as a required extension in configuration breaks build #346

Open
vietqhoang opened this issue Mar 2, 2023 · 2 comments

Comments

@vietqhoang
Copy link

vietqhoang commented Mar 2, 2023

Adding rubocop-capybara to the "required extensions" list in .rubocop.yml configuration file breaks the build on CodeClimate.

A snippet of the require list in the .rubocop.yml:

require:
  - rubocop-capybara
  - rubocop-rails
  - rubocop-rspec

A screenshot of the build error:

CleanShot 2023-03-01 at 18 59 29@2x

Our CodeClimate setup is using the beta channel. Running rubocop locally executes without issue.

The expectation is for the CodeClimate to run successfully.

The output log of the CodeClimate error:

/usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/feature_loader.rb:46:in `rescue in rescue in load': cannot load such file -- rubocop-capybara (LoadError)
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/feature_loader.rb:39:in `rescue in load'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/feature_loader.rb:32:in `load'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/feature_loader.rb:21:in `load'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:14:in `block (2 levels) in resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:13:in `each'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:12:in `tap'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader.rb:46:in `load_file'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader.rb:104:in `configuration_from_file'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_store.rb:68:in `for_dir'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_store.rb:58:in `for'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:117:in `combined_exclude_glob_patterns'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:85:in `find_files'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:59:in `target_files_in_dir'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:38:in `block in find'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:36:in `each'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:36:in `find'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/runner.rb:85:in `find_target_files'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:15:in `block in expanded_list'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `each'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `flat_map'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `expanded_list'
	from /usr/src/app/lib/cc/engine/rubocop.rb:47:in `files_to_inspect'
	from /usr/src/app/lib/cc/engine/rubocop.rb:27:in `block in run'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `chdir'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `run'
	from /usr/src/app/bin/codeclimate-rubocop:17:in `<main>'
/usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:155:in `require': cannot load such file -- rubocop/capybara (LoadError)
	from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:155:in `require'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/feature_loader.rb:42:in `rescue in load'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/feature_loader.rb:32:in `load'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/feature_loader.rb:21:in `load'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:14:in `block (2 levels) in resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:13:in `each'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:12:in `tap'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader.rb:46:in `load_file'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader.rb:104:in `configuration_from_file'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_store.rb:68:in `for_dir'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_store.rb:58:in `for'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:117:in `combined_exclude_glob_patterns'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:85:in `find_files'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:59:in `target_files_in_dir'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:38:in `block in find'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:36:in `each'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:36:in `find'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/runner.rb:85:in `find_target_files'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:15:in `block in expanded_list'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `each'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `flat_map'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `expanded_list'
	from /usr/src/app/lib/cc/engine/rubocop.rb:47:in `files_to_inspect'
	from /usr/src/app/lib/cc/engine/rubocop.rb:27:in `block in run'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `chdir'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `run'
	from /usr/src/app/bin/codeclimate-rubocop:17:in `<main>'
/usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:155:in `require': cannot load such file -- rubocop-capybara (LoadError)
	from /usr/local/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:155:in `require'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/feature_loader.rb:35:in `load'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/feature_loader.rb:21:in `load'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:14:in `block (2 levels) in resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:13:in `each'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:12:in `tap'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader.rb:46:in `load_file'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_loader.rb:104:in `configuration_from_file'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_store.rb:68:in `for_dir'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/config_store.rb:58:in `for'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:117:in `combined_exclude_glob_patterns'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:85:in `find_files'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:59:in `target_files_in_dir'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:38:in `block in find'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:36:in `each'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/target_finder.rb:36:in `find'
	from /usr/local/bundle/gems/rubocop-1.39.0/lib/rubocop/runner.rb:85:in `find_target_files'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:15:in `block in expanded_list'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `each'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `flat_map'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `expanded_list'
	from /usr/src/app/lib/cc/engine/rubocop.rb:47:in `files_to_inspect'
	from /usr/src/app/lib/cc/engine/rubocop.rb:27:in `block in run'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `chdir'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `run'
	from /usr/src/app/bin/codeclimate-rubocop:17:in `<main>
@vietqhoang
Copy link
Author

vietqhoang commented Mar 2, 2023

Just an aside question: are there any environment variables present during the build process which can be used to determine the environment is CodeClimate? A cursory Google search didn't yield anything.

For the time being, in order to not roadblock my end, I was thinking to conditionally exclude rubocop-capybara using some preprocessing and adding a conditional to check for the environment variable.

@vietqhoang
Copy link
Author

Having rubocop-rspec_rails department in the require on the rubocop config breaks the Codeclimate engine.

The reason for the inclusion of the department is that starting with Rubocop Rspec major version 3 many of the departments (Cabybara, FactoryBot, etc) have been extracted out of the dependency.

See the release: https://github.com/rubocop/rubocop-rspec/releases/tag/v3.0.0

And the specific changes which extracted out Rubocop Rspec Rails: rubocop/rubocop-rspec#1830

/usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/feature_loader.rb:46:in `rescue in rescue in load': cannot load such file -- rubocop-rspec_rails (LoadError)
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/feature_loader.rb:39:in `rescue in load'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/feature_loader.rb:32:in `load'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/feature_loader.rb:21:in `load'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:14:in `block (2 levels) in resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:13:in `each'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'
	from <internal:kernel>:90:in `tap'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader.rb:53:in `load_file'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader.rb:112:in `configuration_from_file'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_store.rb:68:in `for_dir'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_store.rb:58:in `for'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:121:in `combined_exclude_glob_patterns'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:85:in `find_files'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:59:in `target_files_in_dir'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:38:in `block in find'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:36:in `each'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:36:in `find'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/runner.rb:111:in `find_target_files'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:15:in `block in expanded_list'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `each'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `flat_map'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `expanded_list'
	from /usr/src/app/lib/cc/engine/rubocop.rb:47:in `files_to_inspect'
	from /usr/src/app/lib/cc/engine/rubocop.rb:27:in `block in run'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `chdir'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `run'
	from /usr/src/app/bin/codeclimate-rubocop:17:in `<main>'
<internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:148:in `require': cannot load such file -- rubocop/rspec_rails (LoadError)
	from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:148:in `require'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/feature_loader.rb:42:in `rescue in load'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/feature_loader.rb:32:in `load'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/feature_loader.rb:21:in `load'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:14:in `block (2 levels) in resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:13:in `each'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'
	from <internal:kernel>:90:in `tap'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader.rb:53:in `load_file'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader.rb:112:in `configuration_from_file'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_store.rb:68:in `for_dir'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_store.rb:58:in `for'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:121:in `combined_exclude_glob_patterns'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:85:in `find_files'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:59:in `target_files_in_dir'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:38:in `block in find'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:36:in `each'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:36:in `find'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/runner.rb:111:in `find_target_files'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:15:in `block in expanded_list'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `each'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `flat_map'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `expanded_list'
	from /usr/src/app/lib/cc/engine/rubocop.rb:47:in `files_to_inspect'
	from /usr/src/app/lib/cc/engine/rubocop.rb:27:in `block in run'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `chdir'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `run'
	from /usr/src/app/bin/codeclimate-rubocop:17:in `<main>'
<internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:148:in `require': cannot load such file -- rubocop-rspec_rails (LoadError)
	from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:148:in `require'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/feature_loader.rb:35:in `load'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/feature_loader.rb:21:in `load'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:14:in `block (2 levels) in resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:13:in `each'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:13:in `block in resolve_requires'
	from <internal:kernel>:90:in `tap'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader_resolver.rb:12:in `resolve_requires'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader.rb:53:in `load_file'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_loader.rb:112:in `configuration_from_file'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_store.rb:68:in `for_dir'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/config_store.rb:58:in `for'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:121:in `combined_exclude_glob_patterns'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:85:in `find_files'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:59:in `target_files_in_dir'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:38:in `block in find'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:36:in `each'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/target_finder.rb:36:in `find'
	from /usr/local/bundle/gems/rubocop-1.56.3/lib/rubocop/runner.rb:111:in `find_target_files'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:15:in `block in expanded_list'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `each'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `flat_map'
	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `expanded_list'
	from /usr/src/app/lib/cc/engine/rubocop.rb:47:in `files_to_inspect'
	from /usr/src/app/lib/cc/engine/rubocop.rb:27:in `block in run'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `chdir'
	from /usr/src/app/lib/cc/engine/rubocop.rb:26:in `run'
	from /usr/src/app/bin/codeclimate-rubocop:17:in `<main>'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant