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

pre-commit: clean up Python flake8 excludes with black #9793

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jbampton
Copy link
Member

https://github.com/psf/black

https://black.readthedocs.io/en/stable/

Description

This PR now allows us to check all our Python files with flake8.

The excluded files have been cleaned up and formatted with black.

"By using Black, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom from pycodestyle nagging about formatting. You will save time and mental energy for more important matters.

Black makes code review faster by producing the smallest diffs possible. Blackened code looks the same regardless of the project you’re reading. Formatting becomes transparent after a while and you can focus on the content instead."

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

First ran black on the excluded files.

Then ran: pre-commit run --all-files and the flake8 test passed.

How did you try to break this feature and the system with this change?

@jbampton
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@jbampton a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 15.78%. Comparing base (019f2c6) to head (9749d1b).

Additional details and impacted files
@@             Coverage Diff             @@
##               main    #9793     +/-   ##
===========================================
  Coverage     15.78%   15.78%             
- Complexity    12564    12565      +1     
===========================================
  Files          5627     5627             
  Lines        492250   492250             
  Branches      61405    62888   +1483     
===========================================
  Hits          77710    77710             
  Misses       406066   406066             
  Partials       8474     8474             
Flag Coverage Δ
uitests 4.04% <ø> (ø)
unittests 16.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@jbampton jbampton marked this pull request as ready for review October 14, 2024 15:57
@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11339

@vishesh92
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@vishesh92 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@vishesh92 vishesh92 self-requested a review October 16, 2024 07:33
@vishesh92 vishesh92 self-assigned this Oct 16, 2024
@blueorangutan
Copy link

[SF] Trillian test result (tid-11672)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 72113 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9793-t11672-kvm-ol8.zip
Smoke tests completed. 138 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_04_nonsecured_to_secured_vm_migration Error 351.08 test_vm_life_cycle.py
test_01_cancel_host_maintenace_with_no_migration_jobs Error 2487.06 test_host_maintenance.py
test_hostha_enable_ha_when_host_in_maintenance Error 432.35 test_hostha_kvm.py

@DaanHoogland DaanHoogland force-pushed the clean-up-flake8-excludes-with-black branch from d0544ee to 9749d1b Compare October 23, 2024 19:19
Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

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

clgtm

@vishesh92
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@vishesh92
Copy link
Member

@DaanHoogland @jbampton should we add black as a pre-commit hook? I have been thinking of fixing formatting for our tests and marvin lib as well. Not in this PR, but a separate PR for that.

@jbampton
Copy link
Member Author

Hey @vishesh92 I added black pre-commit on Apache Sedona here:

apache/sedona#1593

There are a lot more pre-commit hooks we can add to CloudStack including black.

I was waiting for some of my PRs to be merged before adding more pre-commit hooks

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants