Closed ekampp closed 9 years ago
We currently specify the root .rubocop
file from the loaded project directory. It might be best to let rubocop find it on it's own.
The config_file mechanism searches the file hierarchy starting from the currently linted file. So that isn't the problem. IIRC, I'm using config_file because the linter uses temp files and rubocop would look for .rubocop in the temp directory, which doesn't work.
@ekampp Please turn on debug mode and show us the ST3 console output when linting a file. That will display the exact command line being passed to rubocop.
@aparajita I'll have a look at that sometime today, and update with console content. Thanks.
I'm going to close this due to age - please open it back up if you want to follow up!
So I'm seeing what I think is the same thing: The rubocop linter is run when there's a .rubocop
file in the same directory as the file I'm editing -- but not when the file being edited is in a sub-directory.
I'm not using an actual SublimeText project, just opening the project as a while (subl .
from the project root).
SublimeLinter: rubocop version query: /Users/jfrisby/.rvm/bin/rvm-auto-ruby -S rubocop --version
SublimeLinter: rubocop version: 0.32.0
SublimeLinter: rubocop: (>= 0.15.0) satisfied by 0.32.0
SublimeLinter: rubocop activated: ['/Users/jfrisby/.rvm/bin/rvm-auto-ruby']
SublimeLinter: ruby: Rakefile ['/Users/jfrisby/.rvm/bin/rvm-auto-ruby', '-wc']
SublimeLinter: ruby output:
Syntax OK
SublimeLinter: rubocop: Rakefile ['/Users/jfrisby/.rvm/bin/rvm-auto-ruby', '-S', 'rubocop', '--format', 'emacs', '--config', '/Users/jfrisby/renzu/dashboard/.rubocop.yml']
SublimeLinter: rubocop output:
/var/folders/bv/cl8trrj12zvg1q81tz6jvxp40000gn/T/SublimeLinter3-jfrisby/Rakefile.rb:1:1: C: Use snake_case for source file names.
SublimeLinter: ruby: metric.rb ['/Users/jfrisby/.rvm/bin/rvm-auto-ruby', '-wc']
SublimeLinter: ruby output:
Syntax OK
That's explicitly linting a file in the project root, followed by one in app/models
.
It simply doesn't find it in the upstream directory hierarchy.
It doesn't and wont with the current sublime-linter setup. There isn't a way we can pass the paths to rubocop because we don't actually run it against the file, we instead take the current window (saved or not) write it out to a temporary file and then tell it to use the root rubocop file. I'd love to find a way to work around it.
Either I'm being unclear or I'm failing to understand what is meant by 'root rubocop file'.
I interpret 'root rubocop file' as the .rubocop.yml
in the project root directory.
In this case, the behavior I saw was that the only time a .rubocop.yml
file would be used was if it was in the same directory as the file being edited. If the file is in a sub-directory of the project root, the .rubocop.yml
at the project root does not get used.
On Jun 13, 2015, at 4:32 PM, Francis Gulotta notifications@github.com wrote:
It doesn't and wont with the current sublime-linter setup. There isn't a way we can pass the paths to rubocop because we don't actually run it against the file, we instead take the current window (saved or not) write it out to a temporary file and then tell it to use the root rubocop file. I'd love to find a way to work around it.
— Reply to this email directly or view it on GitHub https://github.com/SublimeLinter/SublimeLinter-rubocop/issues/12#issuecomment-111760305.
Hi there.
I have just installed this plugin, and it seems that the
.rubocop.yml
in my project root isn't loaded as expected when running the Rubocop Linter. E.g. my line length max is set to 120 characters, but the linter errors out at 80 characters.I'm wondering if the
config_file
traverses the file tree correctly, and looks in parenting folders?Bets regards, Emil