[
  {
    "path": ".flake8",
    "content": "[flake8]\nmax-line-length = 100\nignore=\n  D,\n  W503\n"
  },
  {
    "path": ".github/workflows/python-app.yml",
    "content": "name: Python\n\non:\n  push:\n    branches: [ master ]\n  pull_request:\n    branches: [ master ]\n\njobs:\n  lint:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v2\n    - name: Set up Python 3.8\n      uses: actions/setup-python@v2\n      with:\n        python-version: 3.8\n    - name: Install dependencies\n      run: |\n        python -m pip install --upgrade pip\n        pip install flake8 \n    - name: Lint with flake8\n      run: |\n        # stop the build if there are Python syntax errors or undefined names\n        flake8 . --count --max-line-length=100 --show-source --statistics\n        \n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\n"
  },
  {
    "path": ".python-version",
    "content": "3.8\n"
  },
  {
    "path": "LICENSE",
    "content": "Permission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "SublimeLinter-rubocop\n=========================\n\n[![Build Status](https://travis-ci.org/SublimeLinter/SublimeLinter-rubocop.svg?branch=master)](https://travis-ci.org/SublimeLinter/SublimeLinter-rubocop)\n\nThis 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.\n\n## Installation\nSublimeLinter must be installed in order to use this plugin. \n\nPlease use [Package Control](https://packagecontrol.io) to install the linter plugin.\n\nBefore using this plugin, you must ensure that `rubocop` (0.34.0 or later) is installed on your system. To install `rubocop`, do the following:\n\n1. Install [Ruby](http://ruby-lang.org).\n\n1. Install `rubocop` by typing the following in a terminal:\n   ```\n   [sudo] gem install rubocop\n   ```\n\n1. 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.\n\nIn 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).\n\n## Settings\n- SublimeLinter settings: http://sublimelinter.com/en/latest/settings.html\n- Linter settings: http://sublimelinter.com/en/latest/linter_settings.html\n\nYou 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).\n\nTo override the config file path, you would add this to the Sublime Linter User Settings:\n\n```json\n{ \n    \"linters\": {\n        \"rubocop\": {\n            \"args\": [\"--config\", \"path/to/config.yml\"]\n        }\n    }\n}\n```\n\n### Bundler\nIf 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:\n\n```json\n{ \n    \"linters\": {\n        \"rubocop\": {\n            \"use_bundle_exec\": true\n        }\n    }\n}\n```\n"
  },
  {
    "path": "linter.py",
    "content": "import os\nfrom SublimeLinter.lint import Linter\n\n\nclass RubyLinter(Linter):\n    __abstract__ = True\n\n    def context_sensitive_executable_path(self, cmd):\n        # The default implementation will look for a user defined `executable`\n        # setting.\n        success, executable = super().context_sensitive_executable_path(cmd)\n        if success:\n            return True, executable\n\n        gem_name = cmd[0] if isinstance(cmd, list) else cmd\n\n        if self.settings.get('use_bundle_exec', False):\n            return True, ['bundle', 'exec', gem_name]\n\n        rvm = self.which('rvm-auto-ruby')\n        if rvm:\n            return True, [rvm, '-S', gem_name]\n\n        return False, None\n\n\nclass Rubocop(RubyLinter):\n    defaults = {\n        'selector': 'source.ruby - text.html - text.haml'\n    }\n    regex = (\n        r'^.+?:(?P<line>\\d+):(?P<col>\\d+): '\n        r'(:?(?P<warning>[RCW])|(?P<error>[EF])): '\n        r'(?P<fixable>\\[Correctable\\] )?'\n        r'((?P<code>\\w+/\\w+): )?'\n        r'(?P<message>.+)$'\n    )\n    word_re = r'^((@|@@|\\$)?\\w+[!?]?)'\n\n    def cmd(self):\n        \"\"\"Build command, using STDIN if a file path can be determined.\"\"\"\n\n        command = ['rubocop', '--format', 'emacs', '--display-cop-names']\n\n        path = self.filename\n        if not path:\n            # File is unsaved, and by default unsaved files use the default\n            # rubocop config because they do not technically belong to a folder\n            # that might contain a custom .rubocop.yml. This means the lint\n            # results may not match the rules for the currently open project.\n            #\n            # If the current window has open folders then we can use the\n            # first open folder as a best-guess for the current projects\n            # root folder - we can then pretend that this unsaved file is\n            # inside this root folder, and rubocop will pick up on any\n            # config file if it does exist:\n            folders = self.view.window().folders()\n            if folders:\n                path = os.path.join(folders[0], 'untitled.rb')\n\n        if path:\n            # With this path we can instead pass the file contents in via STDIN\n            # and then tell rubocop to use this path (to search for config\n            # files and to use for matching against configured paths - i.e. for\n            # inheritance, inclusions and exclusions).\n            #\n            # The 'force-exclusion' overrides rubocop's behavior of ignoring\n            # global excludes when the file path is explicitly provided:\n            command += ['--force-exclusion', '--stdin', path]\n            # Ensure the files contents are passed in via STDIN:\n            self.tempfile_suffix = None\n        else:\n            self.tempfile_suffix = 'rb'\n            command += ['${temp_file}']\n\n        return command\n"
  },
  {
    "path": "messages/1.0.21.txt",
    "content": "SublimeLinter-rubocop 1.0.21\n----------------------------\n- Fix the version check string\n- bump the version to match what we're reporting to Package Control\n"
  },
  {
    "path": "messages/1.0.22.txt",
    "content": "SublimeLinter-rubocop 1.0.22\n----------------------------\n- Support more ruby syntaxes\n"
  },
  {
    "path": "messages/1.0.23.txt",
    "content": "SublimeLinter-rubocop 1.0.23\n----------------------------\n- Support more ruby syntaxes again\n"
  },
  {
    "path": "messages/1.0.24.txt",
    "content": "SublimeLinter-rubocop 1.0.24\n----------------------------\n- Support Better RSpec syntax\n"
  },
  {
    "path": "messages/1.0.5.txt",
    "content": "SublimeLinter-rubocop 1.0.5\n----------------------------\n- Added 'ruby on rails' to syntax.\n"
  },
  {
    "path": "messages/1.0.6.txt",
    "content": "SublimeLinter-rubocop 1.0.6\n----------------------------\n- Added rspec syntax.\n"
  },
  {
    "path": "messages/1.0.7.txt",
    "content": "SublimeLinter-rubocop 1.0.7\n----------------------------\n- Added erb (\"HTML (Rails)\") support.\n"
  },
  {
    "path": "messages/1.0.8.txt",
    "content": "SublimeLinter-rubocop 1.0.8\n----------------------------\n- refactor, convention, and warning messages are highlighted\n  as warnings, error and fatal messages as errors.\n"
  },
  {
    "path": "messages/1.0.9.txt",
    "content": "SublimeLinter-rubocop 1.0.9\n----------------------------\n- Use RubyLinter to help find the ruby we should be running. Should work on wider variety of ruby setups.\n"
  },
  {
    "path": "messages/2.0.0.txt",
    "content": "SublimeLinter-rubocop 2.0.0\n----------------------------\n- Support File location specific Rubocop rules thanks to Mark Haylock @mhaylock\n- Major version bump because it requires a much newer version of rubocop\n"
  },
  {
    "path": "messages/2.0.2.txt",
    "content": "SublimeLinter-rubocop 2.0.1\n----------------------------\n- add new config option `use_bundle_exec` @smanolloff\n- 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\n"
  },
  {
    "path": "messages/install.txt",
    "content": "SublimeLinter-rubocop\n-------------------------------\nThis linter plugin for SublimeLinter provides an interface to rubocop.\n\nPlease read the installation instructions at:\n\nhttps://github.com/SublimeLinter/SublimeLinter-rubocop\n\n"
  },
  {
    "path": "messages.json",
    "content": "{\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.7\": \"messages/1.0.7.txt\",\n    \"1.0.8\": \"messages/1.0.8.txt\",\n    \"1.0.9\": \"messages/1.0.9.txt\",\n    \"1.0.21\": \"messages/1.0.21.txt\",\n    \"1.0.22\": \"messages/1.0.22.txt\",\n    \"1.0.23\": \"messages/1.0.23.txt\",\n    \"1.0.24\": \"messages/1.0.24.txt\",\n    \"2.0.0\": \"messages/2.0.0.txt\",\n    \"2.0.2\": \"messages/2.0.2.txt\"\n}\n"
  }
]