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

Option for displaying elapsed time without using --debug. #8925

Closed
joshuapinter opened this issue Oct 22, 2020 · 4 comments · Fixed by #8970
Closed

Option for displaying elapsed time without using --debug. #8925

joshuapinter opened this issue Oct 22, 2020 · 4 comments · Fixed by #8970

Comments

@joshuapinter
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When you run rubocop it doesn't show the elapsed time. However, when you run rubocop --debug it outputs Finished in 3.1285830000415444 seconds at the end, but it also shows you the path of every file it is scanning.

I'd like to get the elapsed time without getting all the debug information. We use this in our CI to routinely monitor the performance to see if there are bottlenecks, etc.

We have tried using time rubocop and it works, but not as cleanly and varies from system to system (e.g. macOS to Ubuntu to CodeShip servers).

Describe the solution you'd like

If you are against outputting this by default, perhaps a simple option like --time or something that will output the elapsed time.

Describe alternatives you've considered

As mentioned above,

We have tried using time rubocop and it works, but not as cleanly and varies from system to system (e.g. macOS to Ubuntu to CodeShip servers).

Additional context

I'm happy to PR this if it's something you think is valuable and we decide on the details.

Thanks! I love this library!

@fatkodima
Copy link
Contributor

I'm also seeing this as useful outside of --debug.
@bbatsov wdyt on this?

@dvandersluis
Copy link
Member

dvandersluis commented Oct 27, 2020

I think it'd also be useful to be able to get a backtrace from a erroring cop without all the other noise from --debug.

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 30, 2020

I'd like to get the elapsed time without getting all the debug information. We use this in our CI to routinely monitor the performance to see if there are bottlenecks, etc.

Don't you have RuboCop checks as separate tasks which would be timed by your CI anyways? I'm not arguing with the proposal, but I do find the use-case a bit odd, as that information should be available anyways.

@joshuapinter
Copy link
Contributor Author

It's a good question. We definitely could keep Rubocop as a separate task but we use a default rake task to essentially handle all prep, tests and linting, including Rubocop. This is all done in a multi-threaded fashion where possible. Similar to how rubocop does it.

This feature is certainly not mission critical but helpful in diagnosing where a bottleneck is in that rake command. Plus, it's helpful in benchmarking between different CIs, systems, etc.

joshuapinter added a commit to joshuapinter/rubocop that referenced this issue Oct 30, 2020
This shows the elapsed time of the Rubocop command without needing to show all of the output of `--debug`.

Fixes rubocop#8925.
joshuapinter added a commit to joshuapinter/rubocop that referenced this issue Nov 1, 2020
This shows the elapsed time of the Rubocop command without needing to show all of the output of `--debug`.

Fixes rubocop#8925.
bbatsov pushed a commit that referenced this issue Nov 2, 2020
This shows the elapsed time of the Rubocop command without needing to show all of the output of `--debug`.
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

Successfully merging a pull request may close this issue.

4 participants