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

Add server mode status to -V option #10940

Merged
merged 1 commit into from Aug 22, 2022

Conversation

koic
Copy link
Member

@koic koic commented Aug 20, 2022

When YJIT (disabled by default) is enabled in Ruby, it is displayed as follows.

% ruby --yjit -ve 'RubyVM::YJIT.enabled?'
ruby 3.2.0dev (2022-08-18T08:09:08Z master b0b9f7201a) +YJIT [x86_64-darwin19]

+YJIT is added when YJIT is enabled.

This is a change inspired by it. Below is before and after rubocop -V.

Before

% rubocop -V
1.35.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.2.0 x86_64-darwin19)
  - rubocop-performance 1.14.3
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.11.1

After

It makes the -V format like ruby --version.

No server mode

The platform (x86_64-darwin19) display will change slightly.

% rubocop -V
1.35.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.2.0) [x86_64-darwin19]
  - rubocop-performance 1.14.3
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.11.1

Server mode

+server is added when server is enabled.

% rubocop -V
1.35.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.2.0) +server [x86_64-darwin19]
  - rubocop-performance 1.14.3
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.11.1

This change has the following benefits:

  • Shorthand alternative to rubocop --server-status
  • We can check the enable or disable of server mode in the bug report template

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@koic koic marked this pull request as ready for review August 20, 2022 04:28
@koic koic force-pushed the add_server_mode_to_version_option branch from f3971bc to 6dcd7a3 Compare August 20, 2022 04:32
@bbatsov
Copy link
Collaborator

bbatsov commented Aug 22, 2022

The changes look good, but your branch has to be rebased on top of the current master branch due to merge conflicts.

When YJIT (disabled by default) is enabled in Ruby, it is displayed as follows.

```console
% ruby --yjit -ve 'RubyVM::YJIT.enabled?'
ruby 3.2.0dev (2022-08-18T08:09:08Z master b0b9f7201a) +YJIT [x86_64-darwin19]
```

`+YJIT` is added when YJIT is enabled.

This is a change inspired by it. Below is before and after `rubocop -V`.

## Before

```console
% rubocop -V
1.35.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.2.0 x86_64-darwin19)
  - rubocop-performance 1.14.3
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.11.1
```

## After

It makes the `-V` format like `ruby --version`.

### No server mode

The platform (`x86_64-darwin19`) display will change slightly.

```console
% rubocop -V
1.35.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.2.0) [x86_64-darwin19]
  - rubocop-performance 1.14.3
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.11.1
```

### Server mode

`+server` is added when server is enabled.

```console
% rubocop -V
1.35.0 (using Parser 3.1.2.1, rubocop-ast 1.21.0, running on ruby 3.2.0) +server [x86_64-darwin19]
  - rubocop-performance 1.14.3
  - rubocop-rake 0.6.0
  - rubocop-rspec 2.11.1
```

This change has the following benefits:

- Shorthand alternative to `rubocop --server-status`
- We can check the enable or disable of server mode in the bug report template
@koic koic force-pushed the add_server_mode_to_version_option branch from 6dcd7a3 to e32e49c Compare August 22, 2022 07:02
@bbatsov bbatsov merged commit bfe8170 into rubocop:master Aug 22, 2022
@bbatsov
Copy link
Collaborator

bbatsov commented Aug 22, 2022

Thanks!

@koic koic deleted the add_server_mode_to_version_option branch August 22, 2022 08:24
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.

None yet

2 participants