Closed teonimesic closed 8 years ago
Do you think it's not running the right rubocop? or not loading the right config?
No, I don't think so. The right config isn't the issue, because i tried other config options and it worked as expected. It could be the wrong rubocop version... I will try to find and remove every other version and see if the problem persists
Any news on this?
Following @teonimesic comments above I can verify that it is also occurring on version 0.27.1. Seems to be an issue regarding RunRailsCops: true
I can't figure it out. I've run the same command it does with the same arguments and see the railscop errors. When it runs it, it doesn't see it.
I also double checked the regex we use to parse the output, the railscops output the same way as the other tests.
Rubocop needs the relative path of the file to detect what kind of file it is, currently we don't or can't pass that to rubocop. We don't seem to have control over the file SublimeLinter creates.
I see that RuboCop already supports parsing data provided on stdin. It works like this:
rubocop --stdin original/relative/path.rb < tempfile_to_parse
Could SublimeLinter-rubocop be changed to use this technique? I am not familiar with SublimeLinter plugin development, but my brief review of the documentation confirms that stdin for the linter command is supported.
Assuming the linter framework provides us with the original file path (the tokens guide implies we can at least get the parent directory), then we could use that as an argument to Rubocop when building the command line (documented here).
What do you think?
oh I think this is great, I don't have bandwidth to work on it but I think it's the right direction!
Great. Do you have any pointers on how I can start hacking on the code? Like I said, I am new Sublime plugin development, but know some Python and can probably figure it out if you can set me on the right path.
Basically, I have SublimeLinter-rubocop installed via Package Control, which (I think) places the package here:
~/Library/Application Support/Sublime Text 3/Installed Packages/SublimeLinter-rubocop.sublime-package
Is this a tar or zip, I'm guessing? Do I extract it and then move it somewhere so that I can modify it?
Basically I'm wondering how I can modify the plugin source code such that I can see my changes reflected in the editor.
The SublimeLinter docs explain how to create a linter plugin, and how to submit it for publication, but nowhere does it explain how to actually test it.
I also found this:
If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here.
Which doesn't help. :wink:
hahah! I think you can make a directory named SublimeLinter-rubocop
and unzip the files there for testing. I honestly was rezipping it each time I made a change last time I made any modifications.
The linter doesn't gives me a few rails warnings/errors.
An example would be to create a new Rails project, add the following to a
.rubocop.yml
:And then create an
app/models/some_model.rb
file with:Running it with
~/.rbenv/shims/rubocop --format emacs --config ~/Documents/RubocopLinterErrorExample/.rubocop.yml some_model.rb
gives me:but rubocop linter only shows the error related to missing top level class documentation, it doesn't show the second warning.
I've also tried passing '-R' in the arguments instead of using a
.rubocop.yml
, but the result was the same.by the way,
~/.rbenv/shims/rubocop
--version gives me0.26.0