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

Remove deprecated Python utf8 encoding declaration #441

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

cclauss
Copy link
Collaborator

@cclauss cclauss commented Feb 13, 2025

% ruff rule UP009

utf8-encoding-declaration (UP009)

Derived from the pyupgrade linter.

Fix is always available.

What it does

Checks for unnecessary UTF-8 encoding declarations.

Why is this bad?

PEP 3120 makes UTF-8 the default encoding, so a UTF-8 encoding
declaration is unnecessary.

Example

# -*- coding: utf-8 -*-
print("Hello, world!")

Use instead:

print("Hello, world!")

@cclauss cclauss changed the title ruff rule UP009 ruff rule UP009: Remove deprecated utf8 encoding declaration Feb 13, 2025
@cclauss cclauss marked this pull request as ready for review February 13, 2025 08:37
@cclauss cclauss changed the title ruff rule UP009: Remove deprecated utf8 encoding declaration Remove deprecated Python utf8 encoding declaration Feb 13, 2025
@cclauss cclauss requested review from boomanaiden154 and mtrofin and removed request for boomanaiden154 February 13, 2025 19:58
@cclauss cclauss merged commit 4ad9add into google:main Feb 13, 2025
13 checks passed
@cclauss cclauss deleted the ruff-rule-UP009 branch February 13, 2025 20:22
@cclauss cclauss mentioned this pull request Feb 14, 2025
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

Successfully merging this pull request may close these issues.

3 participants