Git Product home page Git Product logo

guard-rubocop's Introduction

RuboCop Logo


Ruby Style Guide Gem Version CircleCI Status Actions Status Test Coverage Maintainability Discord

Role models are important.
-- Officer Alex J. Murphy / RoboCop

RuboCop is a Ruby static code analyzer (a.k.a. linter) and code formatter. Out of the box it will enforce many of the guidelines outlined in the community Ruby Style Guide. Apart from reporting the problems discovered in your code, RuboCop can also automatically fix many of them for you.

RuboCop is extremely flexible and most aspects of its behavior can be tweaked via various configuration options.


Patreon OpenCollective OpenCollective Tidelift

Working on RuboCop is often fun, but it also requires a great deal of time and energy.

Please consider financially supporting its ongoing development.

Installation

RuboCop's installation is pretty standard:

$ gem install rubocop

If you'd rather install RuboCop using bundler, add a line for it in your Gemfile (but set the require option to false, as it is a standalone tool):

gem 'rubocop', require: false

RuboCop is stable between minor versions, both in terms of API and cop configuration. We aim to ease the maintenance of RuboCop extensions and the upgrades between RuboCop releases. All big changes are reserved for major releases. To prevent an unwanted RuboCop update you might want to use a conservative version lock in your Gemfile:

gem 'rubocop', '~> 1.63', require: false

See our versioning policy for further details.

Quickstart

Just type rubocop in a Ruby project's folder and watch the magic happen.

$ cd my/cool/ruby/project
$ rubocop

You can also use this magic in your favorite editor with RuboCop's built-in LSP server.

Documentation

You can read a lot more about RuboCop in its official docs.

Compatibility

RuboCop officially supports the following runtime Ruby implementations:

  • MRI 2.7+
  • JRuby 9.4+

Targets Ruby 2.0+ code analysis.

See the compatibility documentation for further details.

Readme Badge

If you use RuboCop in your project, you can include one of these badges in your readme to let people know that your code is written following the community Ruby Style Guide.

Ruby Style Guide

Ruby Style Guide

Here are the Markdown snippets for the two badges:

[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)

[![Ruby Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://rubystyle.guide)

Team

Here's a list of RuboCop's core developers:

See the team page for more details.

Logo

RuboCop's logo was created by Dimiter Petrov. You can find the logo in various formats here.

The logo is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Contributors

Here's a list of all the people who have contributed to the development of RuboCop.

I'm extremely grateful to each and every one of them!

If you'd like to contribute to RuboCop, please take the time to go through our short contribution guidelines.

Converting more of the Ruby Style Guide into RuboCop cops is our top priority right now. Writing a new cop is a great way to dive into RuboCop!

Of course, bug reports and suggestions for improvements are always welcome. GitHub pull requests are even better! :-)

Funding

While RuboCop is free software and will always be, the project would benefit immensely from some funding. Raising a monthly budget of a couple of thousand dollars would make it possible to pay people to work on certain complex features, fund other development related stuff (e.g. hardware, conference trips) and so on. Raising a monthly budget of over $5000 would open the possibility of someone working full-time on the project which would speed up the pace of development significantly.

We welcome both individual and corporate sponsors! We also offer a wide array of funding channels to account for your preferences (although currently Open Collective is our preferred funding platform).

If you're working in a company that's making significant use of RuboCop we'd appreciate it if you suggest to your company to become a RuboCop sponsor.

You can support the development of RuboCop via GitHub Sponsors, Patreon, PayPal, Open Collective and Tidelift .

Note: If doing a sponsorship in the form of donation is problematic for your company from an accounting standpoint, we'd recommend the use of Tidelift, where you can get a support-like subscription instead.

Open Collective Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Open Collective Sponsors

Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]

Changelog

RuboCop's changelog is available here.

Copyright

Copyright (c) 2012-2024 Bozhidar Batsov. See LICENSE.txt for further details.

guard-rubocop's People

Contributors

bbatsov avatar desheikh avatar hakanensari avatar ic avatar koic avatar robindaugherty avatar ydah avatar yujinakayama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

guard-rubocop's Issues

Globally looks for .rubocop_todo.yml regardless of configuration

Given this Guard definition in my Guardfile:

guard :rubocop do
  watch(%r{^lib/crypt_ident/.*?[^/]+\.rb$})
end

I expect only files in or below the lib/crypt_ident directory to be inspected. Yet it goes off into my tmp/gemset directory as well. Why? How can this be fixed?

[1] guard(main)> rubocop
00:43:18 - INFO - Run RuboCop
00:43:18 - INFO - Inspecting Ruby code style of all files
/Users/jeffdickey/src/ruby/crypt_ident/tmp/gemset/gems/axiom-types-0.1.1/.rubocop.yml - AllCops/Excludes was renamed to AllCops/Exclude
/Users/jeffdickey/src/ruby/crypt_ident/tmp/gemset/gems/axiom-types-0.1.1/.rubocop.yml - AllCops/Includes was renamed to AllCops/Include
tmp/gemset/gems/dry-container-0.6.0/.rubocop.yml: Style/FileName has the wrong namespace - should be Naming
tmp/gemset/gems/dry-logic-0.4.2/.rubocop.yml: Style/FileName has the wrong namespace - should be Naming
tmp/gemset/gems/inch-0.8.0/.rubocop_todo.yml: Lint/SpaceBeforeFirstArg has the wrong namespace - should be Layout
tmp/gemset/gems/inch-0.8.0/.rubocop_todo.yml: Style/AccessorMethodName has the wrong namespace - should be Naming
tmp/gemset/gems/inch-0.8.0/.rubocop_todo.yml: Style/EmptyLines has the wrong namespace - should be Layout
tmp/gemset/gems/inch-0.8.0/.rubocop_todo.yml: Style/LeadingCommentSpace has the wrong namespace - should be Layout
tmp/gemset/gems/inch-0.8.0/.rubocop_todo.yml: Style/PredicateName has the wrong namespace - should be Naming
tmp/gemset/gems/inch-0.8.0/.rubocop_todo.yml: Style/SpaceInsideHashLiteralBraces has the wrong namespace - should be Layout
tmp/gemset/gems/inch-0.8.0/.rubocop_todo.yml: Style/TrailingBlankLines has the wrong namespace - should be Layout
Error: The `Style/TrailingComma` cop no longer exists. Please use `Style/TrailingCommaInArguments`, `Style/TrailingCommaInArrayLiteral`, and/or `Style/TrailingCommaInHashLiteral` instead.
(obsolete configuration found in tmp/gemset/gems/inch-0.8.0/.rubocop_todo.yml, please update it)
The `Style/SingleSpaceBeforeFirstArg` cop has been renamed to `Layout/SpaceBeforeFirstArg`.
(obsolete configuration found in tmp/gemset/gems/inch-0.8.0/.rubocop_todo.yml, please update it)
00:43:19 - ERROR - The following exception occurred while running guard-rubocop: /Users/jeffdickey/.rbenv/versions/2.5.3/lib/ruby/2.5.0/json/common.rb:156:in `parse' 765: unexpected token at '' (JSON::ParserError)
[1] guard(main)> 

Rubocop + Houndci config walkthrough

First, thank you so much for all you do!

I wrote a walkthrough for conveniently setting up Rubocop + HoundCi + Guard: houndci/hound#480

I just thought you might find something useful there or if you have any comments, because I was considering creating a gem to automate setting up new projects, since there are so many things people can get wrong.

I'm just curious if you have any thoughts.

(Feel free to close this issue)

Add :cli option

Add :cli option to pass arbitary CLI options to RuboCop like:

guard :rubocop, cli: '--format progress' do
  # ...
end

Rubocop doesn't show the cop name in guard-rubocop but it does on the CLI

Compare:

$ bundle exec rubocop
Inspecting 14 files
............W.

Offenses:

spec/my_spec.rb:42:1: W: Lint/MissingCopEnableDirective: Re-enable Lint/HandleExceptions cop with # rubocop:enable after disabling it.
        # rescue SystemExit # rubocop:disable Lint/HandleExceptions
^
spec/my_spec.rb:43:26: C: Layout/TrailingWhitespace: Trailing whitespace detected.
        rescue SystemExit
                         ^

14 files inspected, 2 offenses detected

with

$ bundle exec guard
08:02:31 - INFO - Guard::RSpec is running
08:02:31 - INFO - Inspecting Ruby code style of all files
Inspecting 14 files
............W.

Offenses:

spec/my_spec.rb:42:1: W: Re-enable Lint/HandleExceptions cop with # rubocop:enable after disabling it.
        # rescue SystemExit # rubocop:disable Lint/HandleExceptions
^
spec/my_spec.rb:43:26: C: Trailing whitespace detected.
        rescue SystemExit
                         ^

When running guard-rubocop, the name of the cop that matches the lint error isn't written. But it is when running rubocop directly. I have no options set on my guard:

guard :rubocop do
  watch('Gemfile')
  watch('Rakefile')
  watch(/.+\.rb$/)
  watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
end

Up .gemspec || Don't lock rubocop?

Not a big deal, but some boring warning lines every time because rubocop is on 0.40.x and gem 0.20.
Guard ok, but why bother with rubocop version? My 2 cents hehe.
Thank you for the gem!

Support for ruby 2.6+

When trying to upgrade to ruby 2.6, I encounter the following error immediately upon boot up of guard.

Error: Unknown Ruby version 2.6 found in `.ruby-version`.
Supported versions: 2.2, 2.3, 2.4, 2.5
18:14:16 - ERROR - The following exception occurred while running guard-rubocop: /home/jason/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/json-1.8.6/lib/json/common.rb:155:in `initialize' A JSON text must at least contain two octets! (JSON::ParserError)

This seems to come from a change in how JSON.parse handles empty values.

CLI option '--format fuubar' causes error

From the command line when I run rubocop --format fuubar, I see the the fuubar formatter.

When I use that formatter in my guardfile:

guard :rubocop, cli: '--format fuubar' do
  watch(%r{.+\.rb$})
  watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end

I receive the following error:

No formatter for "fuubar"
/Users/jaredmoody/.gem/ruby/2.1.1/gems/rubocop-0.18.1/lib/rubocop/formatter/formatter_set.rb:56:in `builtin_formatter_class'
/Users/jaredmoody/.gem/ruby/2.1.1/gems/rubocop-0.18.1/lib/rubocop/formatter/formatter_set.rb:34:in `add_formatter'
/Users/jaredmoody/.gem/ruby/2.1.1/gems/rubocop-0.18.1/lib/rubocop/file_inspector.rb:104:in `block in formatter_set'
/Users/jaredmoody/.gem/ruby/2.1.1/gems/rubocop-0.18.1/lib/rubocop/file_inspector.rb:103:in `each'
/Users/jaredmoody/.gem/ruby/2.1.1/gems/rubocop-0.18.1/lib/rubocop/file_inspector.rb:103:in `formatter_set'
/Users/jaredmoody/.gem/ruby/2.1.1/gems/rubocop-0.18.1/lib/rubocop/file_inspector.rb:19:in `process_files'
/Users/jaredmoody/.gem/ruby/2.1.1/gems/rubocop-0.18.1/lib/rubocop/cli.rb:31:in `run'
/Users/jaredmoody/.gem/ruby/2.1.1/gems/rubocop-0.18.1/bin/rubocop:14:in `block in <top (required)>'
/Users/jaredmoody/.rubies/ruby-2.1.1/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/Users/jaredmoody/.gem/ruby/2.1.1/gems/rubocop-0.18.1/bin/rubocop:13:in `<top (required)>'
/Users/jaredmoody/.gem/ruby/2.1.1/bin/rubocop:23:in `load'
/Users/jaredmoody/.gem/ruby/2.1.1/bin/rubocop:23:in `<main>'
16:22:20 - ERROR - The following exception occurred while running guard-rubocop: /Users/jaredmoody/.rubies/ruby-2.1.1/lib/ruby/2.1.0/json/common.rb:155:in `initialize' A JSON text must at least contain two octets! (JSON::ParserError)

Issues with .rubocop_todo.yml

I'm having a couple issues now that I've generated a .rubocop_todo.yml file for my project:

  1. Warnings are generated from guard that are not on the command line:

    Warning: unrecognized cop Lint/AmbiguousRegexpLiteral found in /Users/jaredmoody/Sites/my_project/.rubocop_todo.yml
    Warning: unrecognized cop Lint/AmbiguousRegexpLiteral found in /Users/jaredmoody/Sites/my_project/.rubocop.yml
    
  2. Offenses contained in the .rubocop_todo.yml are properly ignored on the command line, but displayed in guard.

I do have the inherit_from: .rubocop_todo.yml line in my .rubocop.yml file and from the warning, it looks like it is getting picked up properly. Is there something special I need to do to make this work the same as on the command line?

Thanks!

Can not handle guard default ignore?

In guard document, it declare that guard default setting ignore following folders.

ignore
...
This comes in handy when you have large amounts of non-source data in you project. By default .rbx, .bundle, .DS_Store, .git, .hg ,.svn, bundle, log, tmp, vendor/bundle are ignored.

But it seems guard-rubocop cannot ignore part of them, at least vendor/bundle.

tune@CentOS  git clone https://github.com/yujinakayama/guard-rubocop.git
Cloning into 'guard-rubocop'...
remote: Counting objects: 496, done.
remote: Compressing objects: 100% (240/240), done.
remote: Total 496 (delta 219), reused 481 (delta 205)
Receiving objects: 100% (496/496), 60.77 KiB, done.
Resolving deltas: 100% (219/219), done.

tune@CentOS  cd guard-rubocop 
tune@CentOS  bundle install --path=vendor/bundle
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake (10.1.0) 
Installing ast (1.1.0) 
...
Installing ruby_gntp (0.3.4) 
Installing simplecov-rcov (0.2.3) 
Your bundle is complete!
It was installed into ./vendor/bundle

tune@CentOS  bundle exec guard
17:06:02 - WARN - Guard::RSpec DEPRECATION WARNING: The :keep_failed option is deprecated. Please set new :failed_mode option value to :keep instead. https://github.com/guard/guard-rspec#list-of-available-options
17:06:02 - INFO - Guard is using GNTP to send notifications.
17:06:02 - INFO - Guard is using TerminalTitle to send notifications.
17:06:02 - INFO - Guard::RSpec is running
17:06:02 - INFO - Running all specs
................................................................................

Finished in 0.09299 seconds
80 examples, 0 failures
Coverage report generated for RSpec to /home/tune/guard-rubocop/spec/coverage. 120 / 120 LOC (100.0%) covered.
17:06:02 - ERROR - Error sending notification with gntp: Connection refused - connect(2)

17:06:02 - INFO - Inspecting Ruby code style of all files
Inspecting 2029 files
....CCCCCCCCCCCCCCCCCWCCCWCCC...

Always outputs to STDOUT even if --out specified

Hi,

I recently discovered a bug in the runner which results in output being piped to $stdout even if the --out option is specified in the cli. Here are the steps to replicate:

  • Clone example project: git clone [email protected]:aeberlin/guard_example.git
  • Open up the project directory and replace RUBOCOP_OPTS in Guardfile with the text below:
RUBOCOP_OPTS = {
  all_on_start: false,
  cli: '--format RuboCop::Formatter::ClangStyleFormatter --out tmp/rubocop_results.log',
  notification: false
}
  • Run rake and allow to load, then touch lib/guard_example/foo.rb

Notice how output for the default formatter is redirected to $stdout in addition to the results for ProgressFormatter being written to tmp/progress_results.log.

For comparison, run a few of the statements below from bash and review the results.

rubocop --format RuboCop::Formatter::ProgressFormatter --out tmp/progress_results.log lib/guard_example/foo.rb
rubocop --out tmp/default_results.log --format RuboCop::Formatter::ClangStyleFormatter --out tmp/clang_results.log lib/guard_example/foo.rb

As you can see, the default formatter is properly omitted in the first example and then properly retained in the second example, with the specified formatter results always written to the designated path.

If you try to forcibly redirect output for the default formatter to another file, using the configuration below, you can also see that the results are still piped to $stdout.

RUBOCOP_OPTS = {
  all_on_start: false,
  cli: '--out tmp/default_results.log --format RuboCop::Formatter::ClangStyleFormatter --out tmp/progress_results.log',
  notification: true
}

Any thoughts?

Thanks, cheers!

Output differs from running Rubocop standalone

I get different outputs from guard-rubocop and standalone rubocop. In the example below, guard-rubocop reports 1 offenses but rubocop standalone reports 8. How could that be? Is it possible that guard-rubocop runs an older version of rubocop?

guard-rubocop reports the following errors:

10:03:08 - INFO - Inspecting Ruby code style: spec/requests/admin/orders_spec.rb
Inspecting 1 file
C

Offenses:

spec/requests/admin/orders_spec.rb:116:40: C: Style/SpaceInsideHashLiteralBraces: Space inside } missing.
        let(:parameters) { { year: year} }
                                       ^

1 file inspected, 1 offense detected

rubocop reports the following errors:

$ rubocop spec/requests/admin/orders_spec.rb 
Inspecting 1 file
C

Offenses:

spec/requests/admin/orders_spec.rb:84:13: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
            let(:delivery_week_2) { create_delivery(end_of_week(year, week)) }
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:90:13: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
            let(:delivery_week_2) { create_delivery(middle_of_week) }
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:107:9: C: RSpec/EmptyLineAfterSubject: Add empty line after subject.
        subject { response }
        ^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:109:9: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
        let(:parameters) { { week: week } }
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:114:9: C: RSpec/EmptyLineAfterSubject: Add empty line after subject.
        subject { response }
        ^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:116:9: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
        let(:parameters) { { year: year} }
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/requests/admin/orders_spec.rb:116:40: C: Style/SpaceInsideHashLiteralBraces: Space inside } missing.
        let(:parameters) { { year: year} }
                                       ^
spec/requests/admin/orders_spec.rb:127:9: C: RSpec/EmptyLineAfterFinalLet: Add an empty line after the last let block.
        let(:parameters) { {} }
        ^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 8 offenses detected

Are you interested in a maintainer?

I know there haven't been changes on this gem in quite a while. The compatibility for this gem could be significantly improved (current rubocop, current guard).

Are you interested in someone taking over maintenance of this gem?

Move to rubocop-hq?

I've recently created https://github.com/rubocop-hq to serve as the new home of RuboCop and related projects. I'd love to see guard-rubocop live under the same organization as RuboCop itself.

You're an owner there, so if you like the idea you can just handle the move yourself.

cli option doesn't accept space

Hello,

When having a guard with the cli option, it doesn't take spaces into account. Here's an example of what I expected:

guard :rubocop, cli: ['-f html', '-o ./tmp/rubocop_guard.html'] do
  watch(/.+\.rb$/)
end

The output from Guard with the configuration from above:

No formatter for " html"

Then, what I had to do to make it work (removed the space between each option (-f, -o) and their values:

guard :rubocop, cli: ['-fhtml', '-o./tmp/rubocop_guard.html'] do
  watch(/.+\.rb$/)
end

Would it be possible to have the expected behavior instead of the current one?

Thank you very much for your work on Guard-Rubocop, it is great. Have a good day

Unable to find gem 'guard-robocop'

Hi,

My gemfile is

$ cat Gemfile
source 'https://rubygems.org'

gem 'berkshelf'

group :development do
  gem 'test-kitchen'
  gem 'kitchen-vagrant'
  gem 'kitchen-ec2'
  gem 'guard'
  gem 'guard-kitchen'
  gem 'foodcritic'
  gem 'guard-foodcritic'
  gem 'guard-robocop'

However, it cannot find your gem

$ bundle install
Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Could not find gem 'guard-robocop (>= 0) ruby' in the gems available on this machine.

Corrupted terminal

I've found that rubocop-guard is breaking my ZSH terminal (but it is happening in Bash as well), especially after some error was printed to STDOUT. I had to exit from guard and run stty sane to reset the terminal every time when this happen. This issue is bothering me for 2 months, but I was suspecting guard-rspec which I am using as well.

After some research I knew that is some ANSI escaping issue and that it is happening somewhere around Guard::UI or Guard::Compat::UI. Today I first tried to disable the guard-rubocop and the problem went away, then I discovered the PR #19 which promotes upgrade to "new" Guard::Compat API and I give it a try. When I applied patch in #19 the problem went away as well.

Before patch:

1 fsevent_watch 2016-10-09 01-38-00

guard-rubocop (1.2.0)
guard (> 2.0)
rubocop (
> 0.20)

After patch:

1 fsevent_watch 2016-10-09 01-39-17

guard-rubocop (1.2.0-patched)
guard (> 2.0)
guard-compat (
> 1.1)
rubocop (~> 0.20)

System info

$ uname -a
Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
$ zsh --version
zsh --version
zsh 5.2 (x86_64-apple-darwin15.4.0)

Run when .rubocop.yml or .rubocop_todo.yml is saved.

How can I get guard-rubocop to run when I save .rubocop.yml or .rubocop_todo.yml ?

It is very unproductive to add rubocop and guard-rubocop to an old rails app that has many files that need to be fixed and has many rules that are broken.

Does not handle ignore?

My Guardfile includes the following:

guard :rubocop do
  ignore(%r{^db})

  watch(%r{.+\.rb$})
  watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end

But if I execute: change db/schema.rb ... or if I touch an .rb file under the db directory in my new Rails project, the RuboCop Guard fires. Is this a bug?

Rubocop-md does not work with guard

Hi,

I have configured rubocop-md on my project, it runs fine when I run rubocop form the terminal.

When I run it via guard, I get the following error

undefined method `for' for nil:NilClass
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-md-0.3.2/lib/rubocop/markdown/preprocess.rb:66:in `initialize'
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-md-0.3.2/lib/rubocop/markdown/rubocop_ext.rb:79:in `new'
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-md-0.3.2/lib/rubocop/markdown/rubocop_ext.rb:79:in `parse'
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-ast-0.0.3/lib/rubocop/ast/processed_source.rb:33:in `initialize'
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-ast-0.0.3/lib/rubocop/ast/processed_source.rb:18:in `new'
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-ast-0.0.3/lib/rubocop/ast/processed_source.rb:18:in `from_file'
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-0.84.0/lib/rubocop/runner.rb:365:in `get_processed_source'
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-0.84.0/lib/rubocop/runner.rb:121:in `block in file_offenses'
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-md-0.3.2/lib/rubocop/markdown/rubocop_ext.rb:52:in `file_offense_cache'
/home/calin/.rvm/gems/[email protected]_api/gems/rubocop-0.84.0/lib/rubocop/runner.rb:120:in `file_offenses'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.