Skip to content

N802 false positives for CGIHTTPRequestHandler and SimpleHTTPRequestHandler #19422

@dscorbett

Description

@dscorbett

Summary

#18907 added an exception to invalid-function-name (N802) for http.server.BaseHTTPRequestHandler. That exception should also apply to its subclasses, http.server.CGIHTTPRequestHandler and http.server.SimpleHTTPRequestHandler. Example:

$ cat >n802.py <<'# EOF'
from http.server import CGIHTTPRequestHandler, SimpleHTTPRequestHandler
class C(CGIHTTPRequestHandler):
    def do_OPTIONS(self):
        pass
class S(SimpleHTTPRequestHandler):
    def do_OPTIONS(self):
        pass
# EOF

$ ruff --isolated check n802.py --select N802 --output-format concise -q
n802.py:3:9: N802 Function name `do_OPTIONS` should be lowercase
n802.py:6:9: N802 Function name `do_OPTIONS` should be lowercase

Version

ruff 0.12.4 (ee2759b 2025-07-17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions