Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting to set maximum line or file size #1882

Open
themilkman opened this issue Oct 6, 2022 · 3 comments
Open

Setting to set maximum line or file size #1882

themilkman opened this issue Oct 6, 2022 · 3 comments

Comments

@themilkman
Copy link

Hi there,

first of all thanks for SublimeLinter, really helpful plugin!

Today I worked with a >50k lines and over nearly 3MB huge file (better don't ask..) and noticed that rubocop was eating really much CPU (although I reeally didn't want to touch that file at all ;-)).
I didn't find an option to limit the maximum file/line size for the linters. Is there one?

Otherwise I'd like to bring this up as feature idea.

Cheers!

@kaste
Copy link
Contributor

kaste commented Oct 7, 2022

Hi! There is something to it but a file size check is so arbitrary ... There is just no default you can justify. As soon as you hit it, a file magically (because you sure forget about this) does not get linted. And otherwise linters are different, sure some linters can handle big files.

Did you need to edit that file? From what I would expect is that closing the view will or should abort the lint process. The process runs in the background anyway so I assume Sublime Text does not block here (at least it should not freeze) so just closing the view is an option.

If you need to edit that file, then maybe you should just exclude the file or view from rubocop. There are plenty ways to do this.

I can imagine that a trivial add-on like

class MaybeDisableRubocop(sublime_plugin.EventListener):
    def on_activated(self, view):
        view.settings().set("SublimeLinter.linters.rubocopy.disable", view.size() > 1_000_000)

would do the trick. (Or the newer setting SublimeLinter.enabled? which will turn off all functionality for that view.)

Sure you forget such an automatic thing so maybe a key binding or a command for the Command Palette. Something among:

	{ "keys": ["f10"], "command": "toggle_setting", "args": {"setting": "SublimeLinter.linters.rubocopy.disable"} },

🤔

@themilkman
Copy link
Author

Hi @kaste,

thanks for your response!

The plugin approach looks interesting, I'll give it a try later.

I agree with file size is not a really handy metric and that disabling isn't always desired. A global setting for sure wouldn't be optimal as not every language/linter is as hungry as rubocop.

To answer your question, no I didn't edit it, I just had to look a few details up.
FWIW, that's the file https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-ec2/lib/aws-sdk-ec2/client.rb and the rubocop process persists even after closing the view - even when I quit Sublime Text (tbh, this surprised me).

Anyway, it is not that a big issue and I just wanted to know if I missed a setting. For me it's fine if you decide to close this.

Again thanks for your feedback!

@kaste
Copy link
Contributor

kaste commented Oct 7, 2022

So it's still running 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants