Clean up Generate function in report.go#992
Conversation
|
Hey @egibs, just checking in any updates on this ? Appreciate your time! |
| caps = append(caps, v) | ||
| } | ||
| } | ||
| handleMetadata(m, b, fr, override, mrsMap, pledges, caps, syscalls) |
There was a problem hiding this comment.
I noticed we're missing pledges and syscalls (and most likely caps even though we don't currently have any samples with this) in the recent test diffs.
We can probably move pledges, caps, and syscalls to handleMetadata's scope.
To verify your changes locally you can run make refresh-sample-testdata to build the latest changes and refresh our sample data. If you see any diffs, you can quickly iterate and try again rather than waiting for CI.
c0b64a0 to
d1f27b1
Compare
6012a57 to
eab7421
Compare
|
@Ritish134 -- I made a few conflicting changes in #1017 -- namely calling Once that's fixed, I think this will be in good shape. |
Broken down the functionality of the generate function into modular functions: `buildIgnoreMap()` — creates the ignore tag map `trimDisplayPath()` — handles trimming file paths `initFileReport()` — initializes the report struct `createMatchRulesMap()` — Store match rules in a map `processMatchedStrings()` — processes all pattern matches `buildBehavior()` — creates a behavior object from rule data `handleMetadata()` — processes metadata and applies overrides `updateBehavior()` — updates behavior entries in the file report Signed-off-by: Ritish Srivastava <121374890+Ritish134@users.noreply.github.com>
Signed-off-by: Ritish Srivastava <121374890+Ritish134@users.noreply.github.com>
Signed-off-by: Ritish Srivastava <121374890+Ritish134@users.noreply.github.com>
Signed-off-by: Ritish Srivastava <121374890+Ritish134@users.noreply.github.com>
- Moved the regex for checking the version outside `getExt` func for better performance - Created slices to check for `.elf, .gzip, .Z` files using `bytes.hasPrefix` - Wrote Equivalent code without an anonymous function in `GetExt` for extension of size greater than 2, which is more idiomatic. Signed-off-by: Ritish Srivastava <121374890+Ritish134@users.noreply.github.com>
Signed-off-by: Ritish Srivastava <121374890+Ritish134@users.noreply.github.com>
|
@egibs Done. I'm not sure why the commit signature verification is failing — I tried setting up GPG keys, but it didn’t resolve the issue. |
egibs
left a comment
There was a problem hiding this comment.
Looks good, appreciate the contribution!
Broken down the functionality of the generate function into modular functions:
buildIgnoreMap()— creates the ignore tag maptrimDisplayPath()— handles trimming file pathsinitFileReport()— initializes the report structcreateMatchRulesMap()— Store match rules in a mapprocessMatchedStrings()— processes all pattern matchesbuildBehavior()— creates a behavior object from rule datahandleMetadata()— processes metadata and applies overridesupdateBehavior()— updates behavior entries in the file reportfixes #751