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

Lazy load metadata_json_lint #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Jan 24, 2023

It should not be required to load the whole library just to define the rake task. This prevents pulling in many libraries when a user runs rake -T or an unrelated rake task.

It should not be required to load the whole library just to define the
rake task. This prevents pulling in many libraries when a user runs rake
-T or an unrelated rake task.
@codecov
Copy link

codecov bot commented Jan 24, 2023

Codecov Report

Base: 50.23% // Head: 50.47% // Increases project coverage by +0.23% 🎉

Coverage data is based on head (e65068d) compared to base (e089948).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #123      +/-   ##
==========================================
+ Coverage   50.23%   50.47%   +0.23%     
==========================================
  Files           5        5              
  Lines         211      210       -1     
==========================================
  Hits          106      106              
+ Misses        105      104       -1     
Impacted Files Coverage Δ
lib/metadata-json-lint/rake_task.rb 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ekohl
Copy link
Member Author

ekohl commented Jan 24, 2023

The test now fails with:

$ be rake -T 
rake aborted!
NameError: uninitialized constant MetadataJsonLint

MetadataJsonLint.options.strict_license = false
^^^^^^^^^^^^^^^^
/home/ekohl/dev/metadata-json-lint/tests/rake_global_options/Rakefile:3:in `<top (required)>'
/home/ekohl/.gem/ruby/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/cli/exec.rb:58:in `load'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/cli/exec.rb:23:in `run'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/cli.rb:486:in `exec'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/cli.rb:31:in `dispatch'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/cli.rb:25:in `start'
/usr/share/gems/gems/bundler-2.3.26/libexec/bundle:48:in `block in <top (required)>'
/usr/share/gems/gems/bundler-2.3.26/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
/usr/share/gems/gems/bundler-2.3.26/libexec/bundle:36:in `<top (required)>'
/home/ekohl/bin/bundle:23:in `load'
/home/ekohl/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)

So I guess this is incompatible. Perhaps I should utilize autoload like I did in voxpupuli/puppet-syntax#134 instead.

@ekohl
Copy link
Member Author

ekohl commented Jan 24, 2023

#124 may be a better idea.

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

Successfully merging this pull request may close these issues.

1 participant