= Integration with Other Tools

== Editor integration

=== Emacs

https://github.com/rubocop-hq/rubocop-emacs[rubocop.el] is a simple
Emacs interface for RuboCop. It allows you to run RuboCop inside Emacs
and quickly jump between problems in your code.

https://github.com/flycheck/flycheck[flycheck] > 0.9 also supports
RuboCop and uses it by default when available.

=== Vim

RuboCop is supported by
https://github.com/scrooloose/syntastic[syntastic],
https://github.com/neomake/neomake[neomake],
and https://github.com/w0rp/ale[ale].

There is also the https://github.com/ngmy/vim-rubocop[vim-rubocop] plugin.

=== Sublime Text

If you're a ST user you might find the
https://github.com/pderichs/sublime_rubocop[Sublime RuboCop plugin]
useful.

=== Brackets

The https://github.com/smockle-archive/brackets-rubocop[brackets-rubocop]
extension displays RuboCop results in Brackets.
It can be installed via the extension manager in Brackets.

=== TextMate2

The https://github.com/mrdougal/textmate2-rubocop[textmate2-rubocop]
bundle displays formatted RuboCop results in a new window.
Installation instructions can be found https://github.com/mrdougal/textmate2-rubocop#installation[here].

=== Atom

The https://github.com/AtomLinter/linter-rubocop[linter-rubocop] plugin for Atom's
https://github.com/AtomLinter/Linter[linter] runs RuboCop and highlights the offenses in Atom.

=== LightTable

The https://github.com/seancaffery/lt-rubocop[lt-rubocop] plugin
provides LightTable integration.

=== RubyMine / Intellij IDEA

RuboCop support is https://www.jetbrains.com/help/idea/2017.1/rubocop.html[available] as of the 2017.1 releases.

=== Visual Studio Code

The https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby[ruby] extension
provides RuboCop integration for Visual Studio Code. RuboCop is also used for the formatting
capabilities of this extension.

=== Other Editors

Here's one great opportunity to contribute to RuboCop - implement
RuboCop integration for your favorite editor.

== Git pre-commit hook integration

https://github.com/brigade/overcommit[overcommit] is a fully configurable and
extendable Git commit hook manager. To use RuboCop with overcommit, add the
following to your `.overcommit.yml` file:

[source,yaml]
----
PreCommit:
  RuboCop:
    enabled: true
----

== Guard integration

If you're fond of https://github.com/guard/guard[Guard] you might
like
https://github.com/yujinakayama/guard-rubocop[guard-rubocop]. It
allows you to automatically check Ruby code style with RuboCop when
files are modified.

== Rake integration

To use RuboCop in your `Rakefile` add the following:

[source,ruby]
----
require 'rubocop/rake_task'

RuboCop::RakeTask.new
----

If you run `rake -T`, the following two RuboCop tasks should show up:

[source,sh]
----
$ rake rubocop                                  # Run RuboCop
$ rake rubocop:auto_correct                     # Auto-correct RuboCop offenses
----

The above will use default values

[source,ruby]
----
require 'rubocop/rake_task'

desc 'Run RuboCop on the lib directory'
RuboCop::RakeTask.new(:rubocop) do |task|
  task.patterns = ['lib/**/*.rb']
  # only show the files with failures
  task.formatters = ['files']
  # don't abort rake on failure
  task.fail_on_error = false
end
----
