Skip to content

Instantly share code, notes, and snippets.

@nertzy
Last active May 24, 2021 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nertzy/47d18940864c3348d60a6897661522fa to your computer and use it in GitHub Desktop.
Save nertzy/47d18940864c3348d60a6897661522fa to your computer and use it in GitHub Desktop.
AllCops:
DisabledByDefault: true
Style/TopLevelMethodDefinition:
Enabled: true
class One
def two
2
end
end
def one
1
end
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
gem "rubocop"
❯ rubocop --debug
For /Users/dev/projects/rubocop-bug: configuration from /Users/dev/projects/rubocop-bug/.rubocop.yml
Default configuration from /Users/dev/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/rubocop-1.15.0/config/default.yml
Inspecting 3 files
Scanning /Users/dev/projects/rubocop-bug/Gemfile
Loading cache from /Users/dev/.cache/rubocop_cache/c00b397a11a60e0fa0171c84ff7b86bed54ca9f3/6d7a3b621ca1730e04accd938619e4bdab66cfb1/9a72538d2e9b9b74fa91e1ebf6f6587f9cdb5cac
.Scanning /Users/dev/projects/rubocop-bug/broken.rb
Loading cache from /Users/dev/.cache/rubocop_cache/c00b397a11a60e0fa0171c84ff7b86bed54ca9f3/6d7a3b621ca1730e04accd938619e4bdab66cfb1/f6397e6482b48540814a82460e9e0c74f45a636e
.Scanning /Users/dev/projects/rubocop-bug/works.rb
Loading cache from /Users/dev/.cache/rubocop_cache/c00b397a11a60e0fa0171c84ff7b86bed54ca9f3/6d7a3b621ca1730e04accd938619e4bdab66cfb1/ea14c4e0525a37b192467d7a2cb78d8e2efdc75b
C
Offenses:
works.rb:1:1: C: Style/TopLevelMethodDefinition: Do not define methods at the top-level.
def one ...
^^^^^^^
3 files inspected, 1 offense detected
Finished in 0.3944059999776073 seconds
def one
1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment