Skip to content

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

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

Open
wants to merge 3 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 16.06%. Comparing base (b1ba9bf) to head (703534a).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9793   +/-   ##
=========================================
  Coverage     16.06%   16.06%           
  Complexity    12872    12872           
=========================================
  Files          5642     5642           
  Lines        493953   493953           
  Branches      59889    59889           
=========================================
  Hits          79351    79351           
  Misses       405817   405817           
  Partials       8785     8785           
Flag Coverage Δ
uitests 4.01% <ø> (ø)
unittests 16.90% <ø> (ø)

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

@jbampton jbampton requested a review from DaanHoogland October 23, 2024 11:57
@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

@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.

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland 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.

@blueorangutan
Copy link

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

@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

@blueorangutan
Copy link

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

Test Result Time (s) Test File
test_01_invalid_upgrade_kubernetes_cluster Failure 3639.18 test_kubernetes_clusters.py
test_02_upgrade_kubernetes_cluster Failure 3639.09 test_kubernetes_clusters.py
test_03_deploy_and_scale_kubernetes_cluster Failure 3638.78 test_kubernetes_clusters.py
test_04_autoscale_kubernetes_cluster Failure 3636.99 test_kubernetes_clusters.py
test_05_basic_lifecycle_kubernetes_cluster Failure 3640.37 test_kubernetes_clusters.py
test_06_delete_kubernetes_cluster Failure 3636.07 test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_cluster Failure 3665.32 test_kubernetes_clusters.py
test_10_vpc_tier_kubernetes_cluster Failure 3697.74 test_kubernetes_clusters.py

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