ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Rubo​Cop

by pderichs ALL

A Sublime Text RuboCop plugin.

Details

  • 2023.09.02.07.31.22
  • github.​com
  • github.​com
  • 1 year ago
  • 1 hour ago
  • 12 years ago

Installs

  • Total 36K
  • Win 3K
  • Mac 22K
  • Linux 11K
Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 1 0 1 0 0
Mac 0 0 1 1 1 0 1 1 0 2 1 1 2 3 0 0 0 0 2 0 1 1 0 0 1 0 0 0 0 0 0 2 1 1 0 0 1 1 0 0 0 0 0 1 0 1
Linux 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 2 1 3 0 2 0 0 3 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 2 1

Readme

Source
raw.​githubusercontent.​com

[!NOTE] Searching for a new maintainer. Please see https://github.com/pderichs/sublime_rubocop/issues/71 for more information.

Sublime RuboCop

A Sublime Text plugin that runs RuboCop on your Ruby files in the editor. It will mark issues right inside the view but it can also be called as a “compiler” from the ST menu.

The Plugin currently supports both ST2 and ST3, but the usage of ST3 is strongly recommended.

Installation

Prerequisites

Please make sure rubocop is installed:

gem install rubocop

Recommended

Install Sublime RuboCop via Package Control.

Manual

  1. Navigate to the Sublime Text Packages folder (You can find the location of the Packages folder here).

  2. Run the git clone command right inside the packages directory: git clone git@github.com:pderichs/sublime_rubocop.git "RuboCop"

  3. Restart Sublime Text.

What can it do for you?

By default, the plugin marks RuboCop issues right in the view when you open or save a Ruby file.

Additionally you can run RuboCop from the ST menu in many ways. For example you can perform a RuboCop check on all files of the current project to get a general overview. The issues will be listed inside the Sublime output window, so you can easily navigate to each of them.

You can also run the RuboCop auto correction for the current file from the Sublime Text menu.

ST2

Due to performance issues the plugin behaves a bit different under ST2. It will run RuboCop only when you save files. If you experience any performance issues when saving ruby files caused by that plugin, just disable the functionality in the settings (see mark_issues_in_view).

Environment

By default this plugin uses rvm to run RuboCop, but you can switch to rbenv or provide your own command line in the settings. The plugin uses default paths to run rvm or rbenv but you can customize these paths in the settings.

To use rbenv, for example, go to Preferences > Package Settings > Rubocop > Settings-User and add the following:

{
  "check_for_rvm": false,
  "check_for_rbenv": true,
  // In case you need a custom rbenv path
  "rbenv_path": "~/.rbenv/bin/rbenv",
}

ToDo

  • As reported by some users the plugin seems to be not working properly when using RVM with custom gemsets: issue #19.

Reporting issues

If you encounter an issue, please add some general information about your environment:

  • Operating System
  • Sublime Text version
  • Details about your config e.g. do you use rbenv, rvm or your_own_command to run rubocop?

Please also provide the steps to reproduce the issue.

Contributing

  1. Fork the repo.
  2. Create a branch from the current master branch.
  3. Start hacking.
  4. Create a pull request.
  5. Patience :relaxed: .

Credits

Thanks go out to all contributors.

Thanks go out to Will Bond for his awesome sample and documentation about ST plugins, and thanks go out to the people implementing the sublime-text-2-ruby-tests Plugin - your source gave me some important hints for my implementation.

License

All of Sublime RuboCop is licensed under the MIT license.

Copyright © 2013 Patrick Derichs patderichs@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.