Skip to content

Added the option to use configs of format templates #1229

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

Merged
merged 1 commit into from
May 23, 2025

Conversation

Chrxxxxs
Copy link
Contributor

What

added the option to use the config id with get_report to get customizable reports

Why

It was not possible to add a config to the format that was selected. Therefore it was only possible to use the already existing formats from Greenbone and not the custom configs to enable different fields.

This is my first contribution ever so please let me know if there are things that i missed or should do differently :)

@Chrxxxxs Chrxxxxs requested a review from a team as a code owner May 22, 2025 13:15
@greenbonebot greenbonebot enabled auto-merge (rebase) May 22, 2025 13:15
Copy link

Conventional Commits Report

😢 No conventional commits found.

👉 Learn more about the conventional commits usage at Greenbone.

ozgen
ozgen previously approved these changes May 23, 2025
@ozgen ozgen self-requested a review May 23, 2025 06:58
@ozgen ozgen dismissed their stale review May 23, 2025 06:59

misunderstanding

@ozgen ozgen removed their request for review May 23, 2025 06:59
Copy link

codecov bot commented May 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.78%. Comparing base (acbfce4) to head (e09c9d0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1229   +/-   ##
=======================================
  Coverage   97.78%   97.78%           
=======================================
  Files          73       73           
  Lines        5110     5112    +2     
  Branches      928      929    +1     
=======================================
+ Hits         4997     4999    +2     
  Misses         76       76           
  Partials       37       37           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@bjoernricks bjoernricks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Chrxxxxs thanks a lot for the PR

IMHO the config_id argument was added to GMP 22.6 only and is not available for 22.4 and 22.5. I need to verify that.

Could you add tests for the report_config_id argument too and change your commit message to add argument scan_config_id for get_report to get customizable reports?

auto-merge was automatically disabled May 23, 2025 09:26

Head branch was pushed to by a user without write access

@greenbonebot greenbonebot enabled auto-merge (rebase) May 23, 2025 09:26
@Chrxxxxs
Copy link
Contributor Author

Hi @bjoernricks,
i only used the version 22.6 and then saw that the same get_report function also existed in 22.4. I didn't test if that parameter also existed in that version which is why i removed it now. I hope the changes i did were what you expected me to do.
Best Regards

@bjoernricks
Copy link
Contributor

@Chrxxxxs could you cleanup your commits into a single commit (via git rebase -i)?

@bjoernricks
Copy link
Contributor

also you need to run poetry run black on the test file first to fix the CI issues.

@Chrxxxxs
Copy link
Contributor Author

Chrxxxxs commented May 23, 2025

Im sorry i think i used a wrong command. I dont fully understand git yet, can i also use venv to run the test file or do i need to use poetry?

@Chrxxxxs
Copy link
Contributor Author

I used poetry now to run the formatting on the test. Could you maybe try and explain the git rebase command to me? I tried using it and it just seems to make more commits instead of squashing it into one

@bjoernricks
Copy link
Contributor

With git rebase you can rewrite your git history. See https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History for details.

@bjoernricks
Copy link
Contributor

or do i need to use poetry?

Yes to setup the venv. poetry run foo ensures to call the foo command from the venv.

@Chrxxxxs
Copy link
Contributor Author

The Git link says that i shouldn't use this on commits that I already sent to a server. Should i open a new pull request with the changes or can i still squash my fork into 1 commit?

@bjoernricks
Copy link
Contributor

The Git link says that i shouldn't use this on commits that I already sent to a server.

That's a miss indication. Your PR is just for preparing changes. Therefore we can change and update it.

auto-merge was automatically disabled May 23, 2025 10:03

Head branch was pushed to by a user without write access

@greenbonebot greenbonebot enabled auto-merge (rebase) May 23, 2025 10:03
@Chrxxxxs
Copy link
Contributor Author

All changes should now be in Commit d06ead1. I hope this is what you meant.

@bjoernricks
Copy link
Contributor

Nope. https://github.com/greenbone/python-gvm/pull/1229/commits contains 7 commits. I would like to get a single one. You need to squash them.

auto-merge was automatically disabled May 23, 2025 10:14

Head branch was pushed to by a user without write access

@greenbonebot greenbonebot enabled auto-merge (rebase) May 23, 2025 10:14
auto-merge was automatically disabled May 23, 2025 10:16

Head branch was pushed to by a user without write access

@greenbonebot greenbonebot enabled auto-merge (rebase) May 23, 2025 10:16
@Chrxxxxs
Copy link
Contributor Author

I think i got it now. Apologies for the amount of tries it took me. As i said its my first Pull Request.

@bjoernricks
Copy link
Contributor

Looks good now but sadly I forgot to mention you need to remove the changes from the GMP v224 files. We only want to add that change to GMP 22.6.

@Chrxxxxs
Copy link
Contributor Author

It got added again in my first force push but i think i removed it in my second, didn't i? I also saw that after looking at the online commit

@bjoernricks
Copy link
Contributor

Looks good to me know. One last thing could you also add a test to https://github.com/greenbone/python-gvm/blob/main/tests/protocols/gmp/requests/v226/test_reports.py ?

auto-merge was automatically disabled May 23, 2025 11:41

Head branch was pushed to by a user without write access

@greenbonebot greenbonebot enabled auto-merge (rebase) May 23, 2025 11:41
@Chrxxxxs
Copy link
Contributor Author

I added the test and formatted it again with poetry run black :)

@bjoernricks bjoernricks requested a review from ozgen May 23, 2025 11:43
@greenbonebot greenbonebot merged commit 71b85ff into greenbone:main May 23, 2025
22 checks passed
@bjoernricks
Copy link
Contributor

Thanks!

@Chrxxxxs Chrxxxxs deleted the reportConfigID branch May 23, 2025 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants