pages-themes / slate

Slate is a Jekyll theme for GitHub Pages
https://pages-themes.github.io/slate/
Creative Commons Zero v1.0 Universal
301 stars 975 forks source link

Add `vendor/` to excluded directories in `.rubocop.yml` #39

Closed rdipardo closed 4 years ago

rdipardo commented 4 years ago

Description

rubocop is scannng all the installed gems. As some gems are more recent than rubocop itself, a LoadError is eventually thrown when a gem tries to require the now separately bundled rubocop-performance gem.

Steps to reproduce

Sample output

$ ./script/cibuild
Configuration file: /home/rob/Downloads/git/slate/_config.yml
 Theme Config file: /home/rob/Downloads/git/slate/_config.yml
            Source: /home/rob/Downloads/git/slate
       Destination: /home/rob/Downloads/git/slate/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
                    done in 0.201 seconds.
 Auto-regeneration: disabled. Use --watch to enable.
Running ["LinkCheck", "ImageCheck", "HtmlCheck", "ScriptCheck"] on ["./_site"] on *.html...

Checking 3 external links...
Ran on 2 files!

HTML-Proofer finished successfully.
Inspecting 2856 files
..CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCWCCCWCCCCCCWCCCCCCCC.CCC...WC.CCCC.CWC.CCCCWCCWCCC..W.CC.C.....W.CC.C.CCCCWCC.WCCCCWWCCCWEWCWWWCWWCWWWWWCCCWWCCCCCW

. . . several minutes later:

2856 files inspected, 48866 offenses detected
Traceback (most recent call last):
    27: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/bin/ruby_executable_hooks:24:in `<main>'
    26: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/bin/ruby_executable_hooks:24:in `eval'
    25: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/bin/rubocop:23:in `<main>'
    24: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/bin/rubocop:23:in `load'
    23: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/bin/rubocop:12:in `<top (required)>'
    22: from /home/rob/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
    21: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/bin/rubocop:13:in `block in <top (required)>'
    20: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/cli.rb:32:in `run'
    19: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/cli.rb:86:in `execute_runner'
    18: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:39:in `run'
    17: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:67:in `inspect_files'
    16: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:75:in `each_inspected_file'
    15: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:75:in `reduce'
    14: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:75:in `each'
    13: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:78:in `block in each_inspected_file'
    12: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:100:in `process_file'
    11: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:109:in `file_offenses'
    10: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:117:in `file_offense_cache'
     9: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/runner.rb:117:in `new'
     8: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/result_cache.rb:85:in `initialize'
     7: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/result_cache.rb:137:in `file_checksum'
     6: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/config_store.rb:44:in `for'
     5: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/config_loader.rb:115:in `configuration_from_file'
     4: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/config_loader.rb:37:in `load_file'
     3: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/config_loader_resolver.rb:11:in `resolve_requires'
     2: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/config_loader_resolver.rb:11:in `each'
     1: from /home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/config_loader_resolver.rb:15:in `block in resolve_requires'
/home/rob/Downloads/git/slate/vendor/bundle/ruby/2.6.0/gems/rubocop-0.50.0/lib/rubocop/config_loader_resolver.rb:15:in `require': cannot load such file -- rubocop-performance (LoadError)

How to resolve

The script finishes properly after .rubocop.yml is edited like so:

AllCops:
  Exclude:
    - _site/**/*
    - vendor/**/*

Metrics/LineLength:
  Enabled: false

Note that Layout is now the correct namespace for the LineLength cop.

Making this change would future-proof the build script for newer versions of rubocop (in case contributors want to update the .gemspec)

Affected version

0.1.1

Relevant dependencies

Reported by bundle list:

  * html-proofer (3.10.2)
  * http_parser.rb (0.6.0)
  * jekyll (4.0.0)
  * jekyll-seo-tag (2.6.1)
  * jekyll-theme-slate (0.1.1)
  * rubocop (0.50.0)
  * w3c_validators (1.3.5)
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.