Skip to content

feat(detector_details): Add mathod to retrieve detector details#140

Closed
salome-voltz wants to merge 1 commit intomasterfrom
salomevoltz/add-detector-details
Closed

feat(detector_details): Add mathod to retrieve detector details#140
salome-voltz wants to merge 1 commit intomasterfrom
salomevoltz/add-detector-details

Conversation

@salome-voltz
Copy link
Copy Markdown
Contributor

No description provided.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 8, 2025

Codecov Report

Attention: Patch coverage is 79.26829% with 17 lines in your changes missing coverage. Please review.

Project coverage is 94.67%. Comparing base (d246b6a) to head (225c7fb).

Files with missing lines Patch % Lines
pygitguardian/models.py 78.37% 16 Missing ⚠️
pygitguardian/client.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #140      +/-   ##
==========================================
- Coverage   95.73%   94.67%   -1.06%     
==========================================
  Files           5        5              
  Lines        1196     1278      +82     
==========================================
+ Hits         1145     1210      +65     
- Misses         51       68      +17     
Flag Coverage Δ
unittests 94.67% <79.26%> (-1.06%) ⬇️

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

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

Comment thread pygitguardian/models.py
Comment on lines +739 to +740
""" "
Response from /v1/detectors, to retrieve a detetor details
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typos (but +1 for adding a docstring 🤩)

Suggested change
""" "
Response from /v1/detectors, to retrieve a detetor details
"""
Response from /v1/detectors, to retrieve a detector details

Comment thread pygitguardian/client.py

obj: Union[Detail, DetectorDetailsResponse]
if is_ok(resp):
print(resp.json())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🔥

Comment thread pygitguardian/models.py
return DetectorDetails(**data)


class DetectorDetails(Base, FromDictMixin):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you make this a dataclass then you don't need to write that long __init__() function.

And using marshmallow_dataclass you don't need to write the schema class manually.

You can have a look at SecretIncident for inspiration.

Comment thread pygitguardian/models.py
return DetectorDetails(**data)


class DetectorDetailsResponse(Base, FromDictMixin):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need both a DetectorDetails and a DetectorDetailsReponse? I think we could make detector_details() return a DetectorDetails instance, but maybe I am missing something.

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.

3 participants