← Back to issue list

style: use black for consistent and automated formatting

View original Github issue

Metadata

Project
charmcraft
Number
#315
Type
pull request
State
merged
Author
cjp256
Labels
—
Created
Updated
Closed

Current evaluation

Merged Black formatting across 36 files, added a formatting test, and ignored flake8 E203/W503 for Black compatibility in charmcraft#315 (merge commit ad135981).

Resolution: closed resolved

Reason: PR #315 was approved and merged as commit ad135981, introducing consistent Black formatting, a formatting check, and compatible flake8 settings.

Evaluated by: mr-cal-bot

No scores available.

Issue body

- Add test case to check formatting. - Add a couple of ignores to flake8 that conflict with black, including E203 and W503. For further reading, the rationale is provided @ https://black.readthedocs.io/en/stable/the_black_code_style.html They also recommend to disable E501 (line-too-long), but for this PR I simply bumped the minimum required line length after using black. We need to revisit our approach if we want to be stricter than that. Signed-off-by: Chris Patterson <chris.patterson@canonical.com>

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged Black formatting across 36 files, added a formatting test, and ignored flake8 E203/W503 for Black compatibility in charmcraft#315 (merge commit ad135981).
stealth/space-bunny-alpha — closed resolved Merged Black formatting across 36 files, added a formatting test, and configured flake8 to ignore E203 and W503 for Black compatibility.
qwen/qwen3.6-35b-a3b — — Merged after two approvals. Adopted Black for automated formatting across 36 files, added a formatting test, and configured flake8 to ignore conflicting rules. Increased the line length limit to accommodate Black's output.
qwen3.6-35b-a3b-mtp-q6 — — Merged adoption of Black for automated code formatting. Added a formatting test, configured flake8 to ignore conflicting rules, and increased the line length limit to standardize code style.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2599 static: update to newer black snapcraft merged Merged #2599, applying formatting from a newer Black release across 15 files in commit 05913cd56.
76%
#638 style: update to black 2024 craft-parts merged Merged PR #638 as commit 423ad779, applying Black 2024 formatting to resolve formatting-related CI failures exposed by #627.
75%
#3853 lint: lint legacy code with black snapcraft merged Merged #3853 as 806bfd04, applying Black formatting to legacy code across 12 files (+84/-37); follow-up #3865 added those files to test-black linting.
75%
#2603 black: minor format changes from updated black snapcraft merged Merged #2603 (commit b442ea48d) by cjp256, applying minor formatting-only changes (+4/-6 lines, 4 files) after Black was updated to the 19.10b0 syntax, keeping ./runtests.sh static passing.
73%
#3650 lint: apply autoformat-black to source files snapcraft merged Merged #3650 to scope autoformat-black to source files, matching test-black; landed in commit 0481269c4.
73%
#3722 static: black update to 22 syntax snapcraft merged Merged PR #3722 (branch 'black', commit 3afcb2ade, merge commit 24ce5d5b0) into main, reformatting 55 files for Black 22 syntax; a prerequisite cleanup for the later switch from black to the ruff formatter.
73%
#1779765 Use black as the default code formatter snapcraft (launchpad) closed Merged canonical/snapcraft#2180, adopting Black as the standard Python style and reformatting 567 files in commit 96da199ac.
72%
#212 style: replace black formatter with ruff format starbase merged Merged PR #212 as commit aae9d00, replacing Black with Ruff format across seven files (+26/-10).
72%
#2180 code: use black as the standard style snapcraft merged Merged PR #2180 made Black the standard Python style, reformatting 567 files; merge commit 96da199ac.
72%
#446 Configure black in 99 columns. charmcraft merged Merged #446, setting Black to 99 columns and reformatting 39 files; changes landed in faf6125f and merged as db9b3cdf.
71%