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

cache or --cache option #1924

Closed
ghost opened this issue May 27, 2015 · 5 comments
Closed

cache or --cache option #1924

ghost opened this issue May 27, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented May 27, 2015

Hi!

Not sure if it would be worth it, it probably is a lot of work.

Could there be a --cache option added, or similar?

Sometimes I run rubocop on a large codebase, and it takes a while - not so long, perhaps 1 minute.
With a --cache option, we could also store the information in the HOME DIRECTORY of the user, with the name of the directory in question.

That way, we could simply re-read that cache on later tries again.

Reason: I just ran rubocop on a codebase, then went to focus on my editor and fixed some issues. Made a break, came back later when I did other things.

I use kde konsole with several tabs though - I thought that it might be useful to have a --cache option to review what I used rubocop some hours ago.

If this is not useful feel free to close the issue. :)

Thanks.

@jonas054
Copy link
Collaborator

I think it could be useful, I have an implementation of a --cache option that I've been working on. I'll submit a PR when I think it's ready. Then we can discuss pros and cons based on something concrete.

@rrosenblum
Copy link
Contributor

I am curious to see an implementation of this. I am currently struggling to see how this would differ from specifying an output file that can be reviewed later.

I too use RuboCop on a large project, one that takes RuboCop about 7 minutes to process. We set up a rake task to run RuboCop against unpushed or unmerged files locally, and then have jenkins run RuboCop against the entire codebase. This works well for day to day work when you aren't enabling new cops. I would be happy to share this configuration if anyone is interested.

@jonas054
Copy link
Collaborator

Alright @rrosenblum, it's not ready but you can take a look here: https://github.com/bbatsov/rubocop/compare/master...jonas054:cache_option?expand=1

I think the difference between saving the result of a whole run and caching results is, that when you change one file in the inspected code base, you have to run for 7 minutes to produce the output file again, whereas with a --cache option only the changed file is slow to inspect.

@rrosenblum
Copy link
Contributor

Looks interesting. It sounds like it could be a better solution than my current solution of running against unpushed/unmerged files.

@kbrock
Copy link

kbrock commented Aug 25, 2015

I run rubocop > cops.txt
and I more the file...
but this could be nice

bbatsov added a commit that referenced this issue Sep 1, 2015
[Fix #1924] Use a cache to speed things up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants