DAOS-623 build: add a linter to normalize config#17781
DAOS-623 build: add a linter to normalize config#17781jolivier23 wants to merge 18 commits intomasterfrom
Conversation
Change-Id: I9d8839df99c4e2930067483fa760b9ef5c9c2b2a Signed-off-by: Jeff Olivier <jeffolivier@google.com>
Change-Id: I0ad1c874a84b6153daa6a36d0ebdd62bbb22b0ff Signed-off-by: Jeff Olivier <jeffolivier@google.com>
|
Test stage NLT completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17781/1/display/redirect |
|
Test stage Unit Test with memcheck completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17781/1/display/redirect |
|
Test stage Unit Test bdev with memcheck completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17781/1/display/redirect |
|
Test stage Unit Test bdev completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17781/1/display/redirect |
|
Ticket title is 'Generic ticket for minor code cleanup and improvement' |
…list Change-Id: I736674b78af5bd4aa239fe079b649623e7c8fbb3
Change-Id: I5129d21e31cfc5d15bf49d5623d190e04181416f Signed-off-by: Jeff Olivier <jeffolivier@google.com>
…list Change-Id: I0de0103c93b60b70d9feaa5103da27338561d1b9
Change-Id: I26aa812984e9d2ebe0985f405b8bdc14582942a9 Signed-off-by: Jeff Olivier <jeffolivier@google.com>
…list Change-Id: I0d7ee2cd0d08eceafbc4fa0cb091aa3c34edbb51
Change-Id: I200e9006b2bc23733fc4e688d1b449b1619f5aac Signed-off-by: Jeff Olivier <jeffolivier@google.com>
| # Use python to perform the check and fix | ||
| python3 - <<EOF |
There was a problem hiding this comment.
Why not put this in a python file instead?
There was a problem hiding this comment.
gemini wrote the script...who am I to question my overlord? Though you make a good point. Maybe the whole script should be python. Let me play with it.
There was a problem hiding this comment.
Ok, I reworked it in python. Even added some tests. A few of my own tests seem to work.
…list Change-Id: I0006a16e7f1c8d8395b094fc944bb413d8e5b2db
Change-Id: I566f13f8c0988b85b8a44b2d9bed88486769511d Signed-off-by: Jeff Olivier <jeffolivier@google.com>
|
Test stage Python Bandit check completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17781/6/execution/node/136/log |
Change-Id: Ibfc442d09482a4c33e01ca9f98fafd4ee180682a Signed-off-by: Jeff Olivier <jeffolivier@google.com>
Change-Id: I2dd33c8bd57883467c70261b01e39ae3b5895819 Signed-off-by: Jeff Olivier <jeffolivier@google.com>
…list Change-Id: I3440bae491e159b0bde5d9304d69d021027a95b9
|
Test stage Unit Test bdev with memcheck completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos/job/PR-17781/8/display/redirect |
Change-Id: I359022d6bf66cf047d59a3519229b6ae968e8daf Signed-off-by: Jeff Olivier <jeffolivier@google.com>
Change-Id: I7cd818494d6d8b53256f22f8c9c357c983dd2362 Signed-off-by: Jeff Olivier <jeffolivier@google.com>
| @@ -1,31 +1,28 @@ | |||
| [component] | |||
| component=daos | |||
There was a problem hiding this comment.
This is holdover from when scons_local supported cart, daos, cppr, and iof independently
| def print_githook_header(name): | ||
| """Print the standard git hook header.""" | ||
| print(f"{name + ':':<17} ", end='', flush=True) | ||
|
|
||
|
|
||
| def git_diff_cached_files(file_path): | ||
| """Check if the file has staged changes.""" | ||
| target = os.environ.get('TARGET') | ||
| if not target: | ||
| # If TARGET is not set, we can't easily determine what to diff against | ||
| # in the same way hook_base.sh does. For now, we'll return True to | ||
| # force a check if we're not sure, or try to find a base. | ||
| return True | ||
|
|
||
| cmd = ['git', 'diff', target, '--cached', '--name-only', '--diff-filter=d', '--', file_path] | ||
| result = subprocess.run( | ||
| cmd, capture_output=True, text=True, check=False, | ||
| shell=False) # nosec B603 | ||
| return result.stdout.strip() |
There was a problem hiding this comment.
Does it not work in the env to call the bash equivalents for these functions?
There was a problem hiding this comment.
Sorry, I'm not sure which functions you are referring to here. Maybe commented on a different line than you wanted?
There was a problem hiding this comment.
I mean instead of writing print_githook_header can we not call the bash function for it?
There was a problem hiding this comment.
The short answer is the bash function is defined in hook_base.sh and not visible to python. And it's a one-liner. Maybe what we should do is create a python library to do what the bash scripts do and then we could invoke python from bash :-)
…list Change-Id: I7dca976027d822b8eee19faa4fad9e6af430af60
Change-Id: I5156238fea520e7b921aa02e107ea39f23407b51 Signed-off-by: Jeff Olivier <jeffolivier@google.com>
Change-Id: I9d8839df99c4e2930067483fa760b9ef5c9c2b2a
Steps for the author:
After all prior steps are complete: