Skip to content

Enable ruff LOG (flake8-logging) rules#1695

Merged
bdraco merged 1 commit into
esphome:mainfrom
bluetoothbot:koan/ruff-log
May 21, 2026
Merged

Enable ruff LOG (flake8-logging) rules#1695
bdraco merged 1 commit into
esphome:mainfrom
bluetoothbot:koan/ruff-log

Conversation

@bluetoothbot

@bluetoothbot bluetoothbot commented May 21, 2026

Copy link
Copy Markdown
Contributor

What

Enable the LOG (flake8-logging) rule family in ruff. Codebase currently has zero violations.

Why

Continues the established one-ruff-family-per-PR cadence (PERF → PTH #1678 → PT006/PT007 #1679 → B #1683 → PGH #1684 → DTZ #1694). LOG catches logging anti-patterns distinct from G (flake8-logging-format) which is already enabled — G checks format strings, LOG checks logger usage patterns (e.g. logging.warn aliases, getLogger arg shape, .exception() outside except blocks, exc_info usage).

Especially valuable here: this is a network library with extensive logging across connection.py, client_base.py, and the frame helpers — fencing future logging code against these footguns at zero migration cost.

How

One-line addition to [tool.ruff.lint] select in pyproject.toml, inserted alphabetically between I and PERF. No code changes needed (zero existing violations).

Testing

  • ruff check . — all checks passed
  • ruff format --check . — 61 files already formatted
  • python -m pytest tests/ — 1117 passed, 2 skipped

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code quality improvements to existing code or addition of tests
  • Other

Quality Report

Changes: 1 file changed, 1 insertion(+)

Code scan: clean

Tests: failed (FAILED)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

@codecov

codecov Bot commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c2c73bf) to head (3a50a14).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1695   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         4166      4166           
=========================================
  Hits          4166      4166           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq

codspeed-hq Bot commented May 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 47 untouched benchmarks


Comparing bluetoothbot:koan/ruff-log (3a50a14) with main (c2c73bf)

Open in CodSpeed

@bdraco

bdraco commented May 21, 2026

Copy link
Copy Markdown
Member

@bluetoothbot rebase

@bluetoothbot

Copy link
Copy Markdown
Contributor Author

Rebase with requested adjustments

Branch koan/ruff-log was rebased onto main and review feedback was applied.

Stats

1 file changed, 1 insertion(+)
Actions performed
  • Already-solved check: negative (confidence=high, reasoning=No commit on main enables ruff LOG rules; pyproject.toml select list lacks LOG entry.)
  • Resolved merge conflicts (1 round(s))
  • Rebased koan/ruff-log onto upstream/main
  • Pre-push CI check: previous run passed
  • Force-pushed koan/ruff-log to origin
  • CI check enqueued in ## CI (async)

CI status

CI will be checked asynchronously.


Automated by Kōan

@bdraco bdraco marked this pull request as ready for review May 21, 2026 15:24
Copilot AI review requested due to automatic review settings May 21, 2026 15:24
@bdraco bdraco merged commit c0f1f85 into esphome:main May 21, 2026
15 checks passed
@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@bdraco has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 45 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 200489cf-c67e-44d2-b751-6e1f2977d9f2

📥 Commits

Reviewing files that changed from the base of the PR and between c2c73bf and 3a50a14.

📒 Files selected for processing (1)
  • pyproject.toml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the repository’s Ruff lint configuration by enabling the LOG (flake8-logging) rule family, continuing the project’s “one rule family per PR” cadence and aiming to prevent future logging anti-patterns.

Changes:

  • Enable Ruff’s LOG rule family by adding "LOG" to [tool.ruff.lint].select in pyproject.toml.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml
Comment on lines +21 to 24
"LOG", # flake8-logging
"PERF", # Perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
Comment thread pyproject.toml
"G", # flake8-logging-format
"I", # isort
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
@bluetoothbot bluetoothbot deleted the koan/ruff-log branch May 21, 2026 16:40
@github-actions github-actions Bot locked and limited conversation to collaborators May 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants