SublimeLinter / SublimeLinter-rubocop

SublimeLinter 3 plugin for Ruby, using rubocop.
MIT License
159 stars 40 forks source link

Lint files in their original location #27

Closed jawshooah closed 8 years ago

jawshooah commented 8 years ago

Rubocop rules are location-specific, so we should lint files in their original locations rather than in temporary directories.

Review on Reviewable

jawshooah commented 8 years ago

The downside is that we can only lint on save, but I think it's worth it to ensure that the warnings displayed in-editor match exactly those displayed from the command line.

reconbot commented 8 years ago

I dunno, it's disabling one behavior over another.

I tried to get it to preserve the full project path on the temp file save (of unsaved buffers) and my knowledge of python and sublimelinter kept it from happening, I think that approach will keep both behaviors.


Francis Gulotta wizard@roborooter.com

On Sun, Dec 20, 2015 at 6:42 PM, Josh Hagins notifications@github.com wrote:

The downside is that we can only lint on save, but I think it's worth it to ensure that the warnings displayed in-editor match exactly those displayed from the command line.

— Reply to this email directly or view it on GitHub https://github.com/SublimeLinter/SublimeLinter-rubocop/pull/27#issuecomment-166165432 .

jawshooah commented 8 years ago

I tried to get it to preserve the full project path on the temp file save

I'm not sure how that would work. Cops can be configured to exclude or include files in a particular location relative to the location of .rubocop.yml. If you run against a copy of the buffer contents in a temporary directory, it is no longer at the location specified in the configuration, so the inclusion/exclusion rules won't apply properly.

reconbot commented 8 years ago

It's possible to recreate the directory structure in the temp directory.

On Mon, Dec 21, 2015, 5:35 AM Josh Hagins notifications@github.com wrote:

I tried to get it to preserve the full project path on the temp file save

I'm not sure how that would work. Cops can be configured to exclude or include files in a particular location relative to the location of .rubocop.yml. If you run against a copy of the buffer contents in a temporary directory, it is no longer at the location specified in the configuration, so the inclusion/exclusion rules won't apply properly.

— Reply to this email directly or view it on GitHub https://github.com/SublimeLinter/SublimeLinter-rubocop/pull/27#issuecomment-166266595 .

jawshooah commented 8 years ago

Sure, but you'd also have to copy over the config file (and any config files in parent directories). And it still wouldn't work properly because you'd have to chdir into the temporary directory root for RuboCop to get the relative paths right.

Is all of that really worth not just linting on save?