Repository: SublimeLinter/SublimeLinter-rubocop
Branch: master
Commit: 11622ffd0268
Files: 20
Total size: 9.0 KB
Directory structure:
gitextract_va1oy1nv/
├── .flake8
├── .github/
│ └── workflows/
│ └── python-app.yml
├── .gitignore
├── .python-version
├── LICENSE
├── README.md
├── linter.py
├── messages/
│ ├── 1.0.21.txt
│ ├── 1.0.22.txt
│ ├── 1.0.23.txt
│ ├── 1.0.24.txt
│ ├── 1.0.5.txt
│ ├── 1.0.6.txt
│ ├── 1.0.7.txt
│ ├── 1.0.8.txt
│ ├── 1.0.9.txt
│ ├── 2.0.0.txt
│ ├── 2.0.2.txt
│ └── install.txt
└── messages.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .flake8
================================================
[flake8]
max-line-length = 100
ignore=
D,
W503
================================================
FILE: .github/workflows/python-app.yml
================================================
name: Python
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --max-line-length=100 --show-source --statistics
================================================
FILE: .gitignore
================================================
.DS_Store
================================================
FILE: .python-version
================================================
3.8
================================================
FILE: LICENSE
================================================
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.
================================================
FILE: README.md
================================================
SublimeLinter-rubocop
=========================
[](https://travis-ci.org/SublimeLinter/SublimeLinter-rubocop)
This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) provides an interface to [rubocop](https://github.com/bbatsov/rubocop). It will be used with files that have the `ruby`, `ruby on rails`, `rspec`, `betterruby`, `better rspec`, `ruby experimental` or `cucumber steps` syntaxes.
## Installation
SublimeLinter must be installed in order to use this plugin.
Please use [Package Control](https://packagecontrol.io) to install the linter plugin.
Before using this plugin, you must ensure that `rubocop` (0.34.0 or later) is installed on your system. To install `rubocop`, do the following:
1. Install [Ruby](http://ruby-lang.org).
1. Install `rubocop` by typing the following in a terminal:
```
[sudo] gem install rubocop
```
1. If you are using `rvm` or `rbenv`, ensure that they are loaded in your shell’s correct startup file. See [here](http://sublimelinter.com/en/latest/troubleshooting.html#adjusting-shell-startup-files) for more information.
In order for `rubocop` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. The docs cover [troubleshooting PATH configuration](http://sublimelinter.com/en/latest/troubleshooting.html#finding-a-linter-executable).
## Settings
- SublimeLinter settings: http://sublimelinter.com/en/latest/settings.html
- Linter settings: http://sublimelinter.com/en/latest/linter_settings.html
You can configure rubocop exactly the way you would from the command line, using `.rubocop.yml` configuration files. For more information, see the [rubocop documentation](https://github.com/bbatsov/rubocop#configuration).
To override the config file path, you would add this to the Sublime Linter User Settings:
```json
{
"linters": {
"rubocop": {
"args": ["--config", "path/to/config.yml"]
}
}
}
```
### Bundler
If you are using Bundler and would like to use the locked rubocop version (which will also allow you to use `inherit_gem` in `rubocop.yml`, in case you are inheriting from another gem in the project), you must set `use_bundle_exec` to true:
```json
{
"linters": {
"rubocop": {
"use_bundle_exec": true
}
}
}
```
================================================
FILE: linter.py
================================================
import os
from SublimeLinter.lint import Linter
class RubyLinter(Linter):
__abstract__ = True
def context_sensitive_executable_path(self, cmd):
# The default implementation will look for a user defined `executable`
# setting.
success, executable = super().context_sensitive_executable_path(cmd)
if success:
return True, executable
gem_name = cmd[0] if isinstance(cmd, list) else cmd
if self.settings.get('use_bundle_exec', False):
return True, ['bundle', 'exec', gem_name]
rvm = self.which('rvm-auto-ruby')
if rvm:
return True, [rvm, '-S', gem_name]
return False, None
class Rubocop(RubyLinter):
defaults = {
'selector': 'source.ruby - text.html - text.haml'
}
regex = (
r'^.+?:(?P<line>\d+):(?P<col>\d+): '
r'(:?(?P<warning>[RCW])|(?P<error>[EF])): '
r'(?P<fixable>\[Correctable\] )?'
r'((?P<code>\w+/\w+): )?'
r'(?P<message>.+)$'
)
word_re = r'^((@|@@|\$)?\w+[!?]?)'
def cmd(self):
"""Build command, using STDIN if a file path can be determined."""
command = ['rubocop', '--format', 'emacs', '--display-cop-names']
path = self.filename
if not path:
# File is unsaved, and by default unsaved files use the default
# rubocop config because they do not technically belong to a folder
# that might contain a custom .rubocop.yml. This means the lint
# results may not match the rules for the currently open project.
#
# If the current window has open folders then we can use the
# first open folder as a best-guess for the current projects
# root folder - we can then pretend that this unsaved file is
# inside this root folder, and rubocop will pick up on any
# config file if it does exist:
folders = self.view.window().folders()
if folders:
path = os.path.join(folders[0], 'untitled.rb')
if path:
# With this path we can instead pass the file contents in via STDIN
# and then tell rubocop to use this path (to search for config
# files and to use for matching against configured paths - i.e. for
# inheritance, inclusions and exclusions).
#
# The 'force-exclusion' overrides rubocop's behavior of ignoring
# global excludes when the file path is explicitly provided:
command += ['--force-exclusion', '--stdin', path]
# Ensure the files contents are passed in via STDIN:
self.tempfile_suffix = None
else:
self.tempfile_suffix = 'rb'
command += ['${temp_file}']
return command
================================================
FILE: messages/1.0.21.txt
================================================
SublimeLinter-rubocop 1.0.21
----------------------------
- Fix the version check string
- bump the version to match what we're reporting to Package Control
================================================
FILE: messages/1.0.22.txt
================================================
SublimeLinter-rubocop 1.0.22
----------------------------
- Support more ruby syntaxes
================================================
FILE: messages/1.0.23.txt
================================================
SublimeLinter-rubocop 1.0.23
----------------------------
- Support more ruby syntaxes again
================================================
FILE: messages/1.0.24.txt
================================================
SublimeLinter-rubocop 1.0.24
----------------------------
- Support Better RSpec syntax
================================================
FILE: messages/1.0.5.txt
================================================
SublimeLinter-rubocop 1.0.5
----------------------------
- Added 'ruby on rails' to syntax.
================================================
FILE: messages/1.0.6.txt
================================================
SublimeLinter-rubocop 1.0.6
----------------------------
- Added rspec syntax.
================================================
FILE: messages/1.0.7.txt
================================================
SublimeLinter-rubocop 1.0.7
----------------------------
- Added erb ("HTML (Rails)") support.
================================================
FILE: messages/1.0.8.txt
================================================
SublimeLinter-rubocop 1.0.8
----------------------------
- refactor, convention, and warning messages are highlighted
as warnings, error and fatal messages as errors.
================================================
FILE: messages/1.0.9.txt
================================================
SublimeLinter-rubocop 1.0.9
----------------------------
- Use RubyLinter to help find the ruby we should be running. Should work on wider variety of ruby setups.
================================================
FILE: messages/2.0.0.txt
================================================
SublimeLinter-rubocop 2.0.0
----------------------------
- Support File location specific Rubocop rules thanks to Mark Haylock @mhaylock
- Major version bump because it requires a much newer version of rubocop
================================================
FILE: messages/2.0.2.txt
================================================
SublimeLinter-rubocop 2.0.1
----------------------------
- add new config option `use_bundle_exec` @smanolloff
- I'm looking for a new maintainer. The maintenance cost has been pretty low but I'm no longer using sublime or ruby in a day to day capacity. If you're interested speak up! https://github.com/SublimeLinter/SublimeLinter-rubocop/issues/38
================================================
FILE: messages/install.txt
================================================
SublimeLinter-rubocop
-------------------------------
This linter plugin for SublimeLinter provides an interface to rubocop.
Please read the installation instructions at:
https://github.com/SublimeLinter/SublimeLinter-rubocop
================================================
FILE: messages.json
================================================
{
"install": "messages/install.txt",
"1.0.5": "messages/1.0.5.txt",
"1.0.6": "messages/1.0.6.txt",
"1.0.7": "messages/1.0.7.txt",
"1.0.8": "messages/1.0.8.txt",
"1.0.9": "messages/1.0.9.txt",
"1.0.21": "messages/1.0.21.txt",
"1.0.22": "messages/1.0.22.txt",
"1.0.23": "messages/1.0.23.txt",
"1.0.24": "messages/1.0.24.txt",
"2.0.0": "messages/2.0.0.txt",
"2.0.2": "messages/2.0.2.txt"
}
gitextract_va1oy1nv/ ├── .flake8 ├── .github/ │ └── workflows/ │ └── python-app.yml ├── .gitignore ├── .python-version ├── LICENSE ├── README.md ├── linter.py ├── messages/ │ ├── 1.0.21.txt │ ├── 1.0.22.txt │ ├── 1.0.23.txt │ ├── 1.0.24.txt │ ├── 1.0.5.txt │ ├── 1.0.6.txt │ ├── 1.0.7.txt │ ├── 1.0.8.txt │ ├── 1.0.9.txt │ ├── 2.0.0.txt │ ├── 2.0.2.txt │ └── install.txt └── messages.json
SYMBOL INDEX (4 symbols across 1 files)
FILE: linter.py
class RubyLinter (line 5) | class RubyLinter(Linter):
method context_sensitive_executable_path (line 8) | def context_sensitive_executable_path(self, cmd):
class Rubocop (line 27) | class Rubocop(RubyLinter):
method cmd (line 40) | def cmd(self):
Condensed preview — 20 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (10K chars).
[
{
"path": ".flake8",
"chars": 51,
"preview": "[flake8]\nmax-line-length = 100\nignore=\n D,\n W503\n"
},
{
"path": ".github/workflows/python-app.yml",
"chars": 604,
"preview": "name: Python\n\non:\n push:\n branches: [ master ]\n pull_request:\n branches: [ master ]\n\njobs:\n lint:\n runs-on: "
},
{
"path": ".gitignore",
"chars": 10,
"preview": ".DS_Store\n"
},
{
"path": ".python-version",
"chars": 4,
"preview": "3.8\n"
},
{
"path": "LICENSE",
"chars": 1023,
"preview": "Permission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentati"
},
{
"path": "README.md",
"chars": 2423,
"preview": "SublimeLinter-rubocop\n=========================\n\n[:\n __abstract__ = True\n\n def context_sen"
},
{
"path": "messages/1.0.21.txt",
"chars": 157,
"preview": "SublimeLinter-rubocop 1.0.21\n----------------------------\n- Fix the version check string\n- bump the version to match wha"
},
{
"path": "messages/1.0.22.txt",
"chars": 87,
"preview": "SublimeLinter-rubocop 1.0.22\n----------------------------\n- Support more ruby syntaxes\n"
},
{
"path": "messages/1.0.23.txt",
"chars": 93,
"preview": "SublimeLinter-rubocop 1.0.23\n----------------------------\n- Support more ruby syntaxes again\n"
},
{
"path": "messages/1.0.24.txt",
"chars": 88,
"preview": "SublimeLinter-rubocop 1.0.24\n----------------------------\n- Support Better RSpec syntax\n"
},
{
"path": "messages/1.0.5.txt",
"chars": 92,
"preview": "SublimeLinter-rubocop 1.0.5\n----------------------------\n- Added 'ruby on rails' to syntax.\n"
},
{
"path": "messages/1.0.6.txt",
"chars": 79,
"preview": "SublimeLinter-rubocop 1.0.6\n----------------------------\n- Added rspec syntax.\n"
},
{
"path": "messages/1.0.7.txt",
"chars": 95,
"preview": "SublimeLinter-rubocop 1.0.7\n----------------------------\n- Added erb (\"HTML (Rails)\") support.\n"
},
{
"path": "messages/1.0.8.txt",
"chars": 169,
"preview": "SublimeLinter-rubocop 1.0.8\n----------------------------\n- refactor, convention, and warning messages are highlighted\n "
},
{
"path": "messages/1.0.9.txt",
"chars": 163,
"preview": "SublimeLinter-rubocop 1.0.9\n----------------------------\n- Use RubyLinter to help find the ruby we should be running. Sh"
},
{
"path": "messages/2.0.0.txt",
"chars": 210,
"preview": "SublimeLinter-rubocop 2.0.0\n----------------------------\n- Support File location specific Rubocop rules thanks to Mark H"
},
{
"path": "messages/2.0.2.txt",
"chars": 350,
"preview": "SublimeLinter-rubocop 2.0.1\n----------------------------\n- add new config option `use_bundle_exec` @smanolloff\n- I'm loo"
},
{
"path": "messages/install.txt",
"chars": 229,
"preview": "SublimeLinter-rubocop\n-------------------------------\nThis linter plugin for SublimeLinter provides an interface to rubo"
},
{
"path": "messages.json",
"chars": 435,
"preview": "{\n \"install\": \"messages/install.txt\",\n \"1.0.5\": \"messages/1.0.5.txt\",\n \"1.0.6\": \"messages/1.0.6.txt\",\n \"1.0."
}
]
About this extraction
This page contains the full source code of the SublimeLinter/SublimeLinter-rubocop GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 20 files (9.0 KB), approximately 2.9k tokens, and a symbol index with 4 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.