[TxMt] Re: UI blocked while running command with “Output: Discard”

Jacob Carlborg doob at me.com
Sun Aug 7 10:58:43 UTC 2016


> I tried this bundle but it didn’t work for me. And after looking at its
> source I decided that it was way too much effort to bring it up to date:
> For example, it tries to run RuboCop directly (that is, via
> `Rubocop::CLI.new.run` [1]) from the command’s Ruby process – in my experience this does not work well with today’s usage of Bundler, Ruby version managers etc.
> 
> I think nowadays TextMate should run Ruby executables like RuboCop or
> RSpec [2] like this:
> 
> * If a binstub (e.g. `bin/rubocop`) is present, use it.
> * Otherwise, if a Gemfile is present and contains an appropriate
> entry, run the executable via `bundle exec …`
> * Otherwise fall back to simply running the executable, presuming it is somehow globally installed. (I just realized that I should add support for `TM_RUBOCOP` at this stage.)

One advantage of loading in RuboCop, like the command is doing now, is that you don’t need to start an additional process for executing the RuboCop command.

> Are there other / better ways of doing this?
> 
> [1]: And this no longer works with recent RuboCop versions at all since
> the module has been renamed to `RuboCop` about 2 years ago:
> https://github.com/bbatsov/rubocop/commit/ff167d8f202baf7a68955db0aaf0dc29afb7e7ee
> 
> [2]: I changed the RSpec bundle to work like this already some time ago:
> https://github.com/rspec/rspec.tmbundle/commit/a81c3f9c7395d72616ddc82ce5963c113334f7b5

You need this PR [1], where I fixed the issue with `RuboCop` vs `Rubocop`, added support for RVM and Bundler. It seems like this bundle has been abandoned. But I would rather take over the project myself than that someone starts from scratch.

> 
>> You might also want to take a look at this pull request that adds a
>> RuboCop formatter command to the Ruby bundle [3].
> 
> Thanks for the pointer, will look into it! Adding RuboCop to the Ruby bundle could make sense. However, I have one small objection: Running something like RuboCop on every save is quite intrusive, thus it should be something you need to explicitly enable. So the question is: Is it easier for a user wanting to use RuboCop to customize the Ruby bundle, or to install the RuboCop bundle? Not sure about this. Maybe just a question of personal preference after all?

I’m not sure. That PR, for the Ruby bundle, is designed for code formatting. That is, running RuboCop with the autocorrect flag. It will not open the HTML view showing errors with links back to the source code. It just shows the result in a tooltip. But I agree that one should be careful about executing commands on save.

[1] https://github.com/mrdougal/textmate2-rubocop/pull/11

—
/Jacob Carlborg



More information about the textmate mailing list