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

Lint/EmptyWhen false positive with inline comments. #7999

Closed
marcandre opened this issue May 20, 2020 · 1 comment
Closed

Lint/EmptyWhen false positive with inline comments. #7999

marcandre opened this issue May 20, 2020 · 1 comment
Assignees

Comments

@marcandre
Copy link
Contributor

marcandre commented May 20, 2020

  1. Proper bug: the following will detect an offense even with 'AllowComments' => true
case foo
when :bar then # do nothing
end

Note that the following is rightfully accepted

case foo
when :bar
  # do nothing
end

The spec file has multiple issues and is in need of love:

  1. Explicit testing of AllowComments is minimal, should be expanded
  2. Doesn't use except_offense/no_offense so spec failures are next to impossible to locate.
  3. The default is AllowComment: true, but the :config spec will not load the defaults unless given there is a cop_config method. Add let(:cop_config) { {} } to the current spec and it fails (related to Improved shared context. Refactor & simplify some specs. #7970)
@marcandre marcandre changed the title EmptyWhen false positive with inline comments. Lint/EmptyWhen false positive with inline comments. May 20, 2020
@marcandre marcandre self-assigned this May 20, 2020
@Darhazer
Copy link
Member

Should

case foo
when :bar # do nothing
end

also be accepted?

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

2 participants