Skip to content

Improve repr string representation of GqlStatusObject #1234

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

Open
wants to merge 1 commit into
base: 6.x
Choose a base branch
from

Conversation

robsdedude
Copy link
Member

@robsdedude robsdedude commented Aug 22, 2025

Instead of for example

GqlStatusObject(gql_status='12345', status_description='descr', position=<SummaryInputPosition object at ...>, raw_classification='HINT', classification=<NotificationClassification.HINT: 'HINT'>, raw_severity='WARNING', severity=<NotificationSeverity.WARNING: 'WARNING'>, diagnostic_record={...})

the repr string representation is now

<GqlStatusObject gql_status='12345', status_description='descr', position=<SummaryInputPosition line=1, column=2, offset=3>, raw_classification='HINT', classification=<NotificationClassification.HINT: 'HINT'>, raw_severity='WARNING', severity=<NotificationSeverity.WARNING: 'WARNING'>, diagnostic_record={...}>

or similar.

This is more in line with Python's recommendations since GqlStatusObject has no such public constructor:

If at all possible, this should look like a valid Python expression that could be used to recreate an object with the same value (given an appropriate environment). If this is not possible, a string of the form <...some useful description...> should be returned.

-- https://docs.python.org/3/reference/datamodel.html#object.__repr__

To enable the above change, SummaryInputPosition's repr string representation was also changed to contain more information.

@robsdedude robsdedude marked this pull request as ready for review August 22, 2025 13:02
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.

1 participant