Skip to content

Conversation

@cgoldberg
Copy link
Member

@cgoldberg cgoldberg commented Oct 31, 2025

User description

🔗 Related Issues

#16432 and #11442

💥 What does this PR do?

This PR cleans up docstrings and removes the ruff rule for ignoring D415 warnings.

🔄 Types of changes

  • Cleanup (formatting, renaming)

PR Type

Cleanup


Description

  • Fix ruff D415 docstring warnings by adding periods to summary lines

  • Reformat multi-line docstrings to follow proper structure

  • Convert code examples from >>> format to backticks or code blocks

  • Remove D415 rule from ruff configuration ignore list


Diagram Walkthrough

flowchart LR
  A["Docstrings with D415 violations"] -->|"Add periods to summaries"| B["Compliant docstrings"]
  A -->|"Reformat examples"| C["Code blocks or backticks"]
  D["pyproject.toml"] -->|"Remove D415 ignore rule"| E["Enable D415 enforcement"]
Loading

File Walkthrough

Relevant files
Documentation
webdriver.py
Fix docstring formatting and D415 violations                         

py/selenium/webdriver/chromium/webdriver.py

  • Fixed docstring in set_network_conditions() by changing quoted
    variable to backticks
  • Reformatted execute_cdp_cmd() docstring with proper period,
    restructured description, and converted example to backticks
+8/-6     
options.py
Fix descriptor class docstring D415 violations                     

py/selenium/webdriver/common/options.py

  • Fixed _PageLoadStrategyDescriptor docstring by adding period and
    restructuring with "See:" section
  • Fixed _UnHandledPromptBehaviorDescriptor docstring with period and
    proper formatting
  • Fixed _TimeoutsDescriptor docstring with period and restructured
    reference link
+12/-7   
webdriver.py
Comprehensive docstring cleanup and D415 fixes                     

py/selenium/webdriver/remote/webdriver.py

  • Reformatted file_detector_context() example from >>> format to code
    block
  • Simplified name property docstring by removing unnecessary example
  • Fixed execute_cdp_cmd() docstring with period and restructured
    description
  • Converted multiple method examples from >>> format to backticks or
    code blocks
  • Removed redundant example sections from simple property docstrings
  • Fixed comment capitalization ("firefox" to "Firefox")
  • Reformatted complex multi-line examples in BiDi and authentication
    methods
+157/-225
options.py
Fix Safari options descriptor docstring                                   

py/selenium/webdriver/safari/options.py

  • Fixed _SafariOptionsDescriptor docstring by adding period to summary
    line
  • Restructured multi-line description with proper formatting and bullet
    points
  • Reformatted example sections with backticks and parenthetical
    explanations
+10/-13 
select.py
Fix select module docstring D415 violations                           

py/selenium/webdriver/support/select.py

  • Fixed first_selected_option docstring by adding period
  • Reformatted select_by_value() docstring with "Example:" section and
    backticks
  • Reformatted select_by_visible_text() docstring with proper structure
  • Fixed deselect_by_value() and deselect_by_visible_text() docstrings
    similarly
+21/-13 
webserver.py
Fix webserver test docstring                                                         

py/test/selenium/webdriver/common/webserver.py

  • Fixed log_message() docstring by adding period to end of summary line
+1/-1     
remote_connection_tests.py
Fix test docstring                                                                             

py/test/selenium/webdriver/remote/remote_connection_tests.py

  • Fixed test_browser_specific_method() docstring by adding period
+1/-1     
Configuration changes
pyproject.toml
Remove D415 from ruff ignore rules                                             

py/pyproject.toml

  • Removed D415 rule from ruff extend-ignore list to enforce period
    requirement
  • Removed comment about cleaning up docstrings as it is now complete
+0/-2     

@selenium-ci selenium-ci added C-py Python Bindings B-support Issue or PR related to support classes labels Oct 31, 2025
@selenium-ci
Copy link
Member

Thank you, @cgoldberg for this code suggestion.

The support packages contain example code that many users find helpful, but they do not necessarily represent
the best practices for using Selenium, and the Selenium team is not currently merging changes to them.

After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium
to work, we will likely close the PR.

We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks.
If you have any questions, please contact us

@cgoldberg cgoldberg merged commit 4428c25 into SeleniumHQ:trunk Oct 31, 2025
8 checks passed
@cgoldberg cgoldberg deleted the py-ruff-fix-D415-docstrings branch October 31, 2025 13:55
@SeleniumHQ SeleniumHQ deleted a comment from qodo-merge-pro bot Oct 31, 2025
@SeleniumHQ SeleniumHQ deleted a comment from qodo-merge-pro bot Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-support Issue or PR related to support classes C-py Python Bindings Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants