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 page.driver.pause as additional element for DebuggerMethods of Lint/Debugger rubocop #10859

Closed
Ivanov-Anton opened this issue Aug 3, 2022 · 4 comments · Fixed by #10869
Closed
Assignees
Labels

Comments

@Ivanov-Anton
Copy link

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

The problem is when I perform debugging with page.driver.pause of Cuprite this line should be detected by robocop.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like

I suggest adding this page.driver.pause debugger to DebuggerMethods Configurable attributes of Lint/Debugger cop

A clear and concise description of what you want to happen.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

@Ivanov-Anton Ivanov-Anton changed the title add page.driver.pause as assitional element for DebuggerMethods of Lint/Debugger rubocop add page.driver.pause as additional element for DebuggerMethods of Lint/Debugger rubocop Aug 3, 2022
@dvandersluis
Copy link
Member

You should be able to handle this in your .rubocop.yml file. Try adding the following:

Lint/Debugger:
  DebuggerMethods:
    Cuprite:
      - page.driver.pause

@dvandersluis
Copy link
Member

I have opened #10860 to make it more clear how you can add your own debugger methods for the cop, but there are no code changes needed here.

@Ivanov-Anton
Copy link
Author

@dvandersluis Thank you for helping I tried it previously but It is not working.

Step to reproduce:

  1. create file test_spec.rb
# frozen_string_literal: true

RSpec.describe '' do
  it 'should' do
    page.driver.pause
  end
end
  1. add the following code in the test_spec.rb file
  2. add the following code in the .rubocop config file
Lint/Debugger:
  DebuggerMethods:
    Cuprite:
      - page.driver.pause
  1. rub bundle exec rubocop test_spec.rb

Expected behaviour:

test_spec.rb:5:5: W: Lint/Debugger: Remove debugger entry point page.driver.pause.
    page.driver.pause

Actual behaviour:

Inspecting 1 file
.

1 file inspected, no offenses detected

Additional info:

robocop (1.32.0)
ruby-3.1.2

@dvandersluis
Copy link
Member

@Ivanov-Anton thank you, I can replicate now. The cop is not handling method chains properly. I'll have a PR shortly.

@dvandersluis dvandersluis reopened this Aug 4, 2022
@dvandersluis dvandersluis self-assigned this Aug 4, 2022
dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Aug 4, 2022
koic added a commit that referenced this issue Aug 5, 2022
[Fix #10859] Fix `Lint/Debugger` to be able to handle method chains correctly
WJWH pushed a commit to WJWH/rubocop that referenced this issue Aug 8, 2022
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