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

Display 'Running parallel inspection' only with --debug #4436

Merged
merged 1 commit into from
May 29, 2017

Conversation

pocke
Copy link
Collaborator

@pocke pocke commented May 28, 2017

In parallel mode, --format option may not be work well.

For example

$ rubocop --parallel --format json | jq .
parse error: Invalid numeric literal at line 1, column 8

Because RuboCop prints a message if --parallel is received.

This change fixes the problem by removing the message if --debug is not received.

WDYT? cc: @jonas054


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Used the same coding conventions as the rest of the project.
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • All tests are passing.
  • The new code doesn't generate RuboCop offenses.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Updated cop documentation with rake generate_cops_documentation (required only when you've added a new cop or changed the configuration/documentation of an existing cop).

@jonas054
Copy link
Collaborator

I see the problem with printing the message unconditionally. The fix is fine as far as I'm concerned. It's a change to released functionality that's visible for the user, so a change log entry is needed.

In parallel mode, `--format` option may not be work well.

For example

```bash
$ rubocop --parallel --format json | jq .
parse error: Invalid numeric literal at line 1, column 8
```

Because RuboCop prints a message if `--parallel` is received.

This change fixes the problem by removing the message if `--debug` is not received.
@pocke
Copy link
Collaborator Author

pocke commented May 29, 2017

I added a changelog entry. Thanks!

@@ -49,7 +49,7 @@ def abort
# Warms up the RuboCop cache by forking a suitable number of rubocop
# instances that each inspects its alotted group of files.
def warm_cache(target_files)
puts 'Running parallel inspection'
puts 'Running parallel inspection' if @options[:debug]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably create some debug_puts method or something at some point.

@bbatsov
Copy link
Collaborator

bbatsov commented May 29, 2017

This change fixes the problem by removing the message if --debug is not received.

This this is still going to be broken with --debug...

@bbatsov bbatsov merged commit 6102234 into rubocop:master May 29, 2017
@pocke pocke deleted the parallel-with-format branch May 29, 2017 05:33
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 this pull request may close these issues.

3 participants