cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

pre-commit: clean up Python flake8 excludes with black

Open jbampton opened this issue 1 year ago • 7 comments

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)
  • [X] 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 avatar Oct 14 '24 14:10 jbampton

@blueorangutan package

jbampton avatar Oct 14 '24 15:10 jbampton

@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 avatar Oct 14 '24 15:10 blueorangutan

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 17.39%. Comparing base (96ccd7e) to head (82574eb). :warning: Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9793   +/-   ##
=========================================
  Coverage     17.39%   17.39%           
- Complexity    15283    15285    +2     
=========================================
  Files          5889     5889           
  Lines        526141   526141           
  Branches      64234    64234           
=========================================
  Hits          91542    91542           
  Misses       424265   424265           
  Partials      10334    10334           
Flag Coverage Δ
uitests 3.62% <ø> (ø)
unittests 18.44% <ø> (ø)

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Oct 14 '24 15:10 codecov[bot]

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

blueorangutan avatar Oct 14 '24 16:10 blueorangutan

@blueorangutan test

vishesh92 avatar Oct 16 '24 07:10 vishesh92

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

blueorangutan avatar Oct 16 '24 07:10 blueorangutan

[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

blueorangutan avatar Oct 17 '24 04:10 blueorangutan

@blueorangutan package

vishesh92 avatar Oct 25 '24 04:10 vishesh92

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

blueorangutan avatar Oct 25 '24 04:10 blueorangutan

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

vishesh92 avatar Oct 25 '24 04:10 vishesh92

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

https://github.com/apache/sedona/pull/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

jbampton avatar Oct 25 '24 05:10 jbampton

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

blueorangutan avatar Oct 25 '24 06:10 blueorangutan

@blueorangutan package

jbampton avatar Dec 20 '24 22:12 jbampton

@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 avatar Dec 20 '24 22:12 blueorangutan

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

blueorangutan avatar Dec 20 '24 23:12 blueorangutan

@blueorangutan test

DaanHoogland avatar Dec 23 '24 09:12 DaanHoogland

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

blueorangutan avatar Dec 23 '24 09:12 blueorangutan

@blueorangutan package

DaanHoogland avatar Dec 31 '24 08:12 DaanHoogland

@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 avatar Dec 31 '24 08:12 blueorangutan

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

blueorangutan avatar Dec 31 '24 09:12 blueorangutan

@blueorangutan test

vishesh92 avatar Dec 31 '24 09:12 vishesh92

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

blueorangutan avatar Dec 31 '24 09:12 blueorangutan

[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

blueorangutan avatar Jan 01 '25 16:01 blueorangutan

@blueorangutan package

jbampton avatar Sep 16 '25 19:09 jbampton

@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 avatar Sep 16 '25 19:09 blueorangutan

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

blueorangutan avatar Sep 16 '25 21:09 blueorangutan