cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

pre-commit: add hook to trim trailing whitespace

Open jbampton opened this issue 2 years ago • 10 comments

https://github.com/pre-commit/pre-commit-hooks#trailing-whitespace

Description

This PR adds another hook or test to our pre-commit framework.

This hook automatically trims trailing whitespace when run locally.

Follow up PRs can target more file types if needed.

Extra unneeded whitespace is extra data. Save the planet :)

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

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?

pre-commit run --all-files

or

pre-commit run trailing-whitespace --all-files

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

jbampton avatar Nov 09 '23 08:11 jbampton

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 31.16%. Comparing base (4b4dfef) to head (9177024).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8205   +/-   ##
=========================================
  Coverage     31.15%   31.16%           
- Complexity    34034    34041    +7     
=========================================
  Files          5404     5404           
  Lines        380305   380305           
  Branches      55506    55506           
=========================================
+ Hits         118502   118524   +22     
+ Misses       246105   246077   -28     
- Partials      15698    15704    +6     
Flag Coverage Δ
simulator-marvin-tests 24.93% <ø> (+<0.01%) :arrow_up:
uitests 4.34% <ø> (ø)
unit-tests 16.88% <ø> (ø)

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.

codecov[bot] avatar Nov 09 '23 09:11 codecov[bot]

Hey @DaanHoogland when the hook runs on GitHub with actions it is just a check that will either pass or fail.

But when pre-commit is setup locally and run this hook will also automatically trim trailing whitespace.

So yes it is a corrective edit. So all these whitespace clean ups were done automatically by the hook.

jbampton avatar Nov 09 '23 10:11 jbampton

@blueorangutan package

jbampton avatar Mar 23 '24 09:03 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 Mar 23 '24 09:03 blueorangutan

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

blueorangutan avatar Mar 23 '24 10:03 blueorangutan

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 15.28%. Comparing base (21af134) to head (6fd07be).

Additional details and impacted files
@@            Coverage Diff             @@
##               main    #8205    +/-   ##
==========================================
  Coverage     15.28%   15.28%            
- Complexity    11535    11536     +1     
==========================================
  Files          5425     5425            
  Lines        474138   474138            
  Branches      58984    59503   +519     
==========================================
+ Hits          72486    72492     +6     
+ Misses       393584   393578     -6     
  Partials       8068     8068            
Flag Coverage Δ
uitests 4.26% <ø> (ø)
unittests 16.02% <ø> (+<0.01%) :arrow_up:

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.

codecov-commenter avatar Apr 22 '24 13:04 codecov-commenter

@blueorangutan package

DaanHoogland avatar Apr 23 '24 07:04 DaanHoogland

@blueorangutan package

jbampton avatar May 12 '24 21:05 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 May 12 '24 21:05 blueorangutan

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

blueorangutan avatar May 12 '24 22:05 blueorangutan

@blueorangutan test

DaanHoogland avatar May 18 '24 20:05 DaanHoogland

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

blueorangutan avatar May 18 '24 20:05 blueorangutan

[SF] Trillian Build Failed (tid-10214)

blueorangutan avatar May 18 '24 20:05 blueorangutan

@blueorangutan test

DaanHoogland avatar May 22 '24 08:05 DaanHoogland

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

blueorangutan avatar May 22 '24 08:05 blueorangutan

[SF] Trillian test result (tid-10245) Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 49836 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8205-t10245-kvm-centos7.zip Smoke tests completed. 130 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_events_resource Error 414.61 test_events_resource.py

blueorangutan avatar May 22 '24 22:05 blueorangutan