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

Style/DateTime wrongly triggered on classes ...::DateTime #4896

Closed
doits opened this issue Oct 20, 2017 · 1 comment · Fixed by #4902
Closed

Style/DateTime wrongly triggered on classes ...::DateTime #4896

doits opened this issue Oct 20, 2017 · 1 comment · Fixed by #4902
Labels

Comments

@doits
Copy link

doits commented Oct 20, 2017

I've a file with the following line:

Icalendar::Values::DateTime.new(start_at)

It gives me the following error:

Style/DateTime: Prefer Date or Time over DateTime.

In this case it is wrong, because Icalendar::Values::Time is totally different from Icalendar::Values::DateTime (first does not include the date at all).

I think the linter should only be triggered on /\b(::)?DateTime\b/ and ignore other things. Or am I missing something?


Expected behavior

Icalendar::Values::DateTime.new(start_at) should not trigger Style/DateTime

Actual behavior

It trigger Style/DateTime

Steps to reproduce the problem

Lint a file with Icalendar::Values::DateTime.new(start_at).

RuboCop version

Include the output of rubocop -V. Here's an example:

$ rubocop -V
0.51.0 (using Parser 2.4.0.0, running on ruby 2.4.2 x86_64-darwin17)
@Drenmi Drenmi added the bug label Oct 20, 2017
@Drenmi
Copy link
Collaborator

Drenmi commented Oct 20, 2017

Yep. There's no reason we should register an offense on a qualified DateTime in another namespace. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants