Skip to content
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

Add validation for platform strings to exclude_parser.py #5651

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jiekang
Copy link
Contributor

@jiekang jiekang commented Sep 26, 2024

Fixes: #5650

@jiekang jiekang marked this pull request as draft September 26, 2024 01:27
@jiekang
Copy link
Contributor Author

jiekang commented Sep 26, 2024

@smlambert Would appreciate your thoughts here on the approach before I exit Draft.

And maybe I need to update the GH actions somewhere to fail when this exits with code 1?
And are there other things I can validate while I'm here?

@sophia-guo
Copy link
Contributor

Alternative of global ERROR_FOUND ( needed for all log.error) to fail the github check is adding custom handler.

class ErrorTrackingHandler(logging.Handler):
    def __init__(self):
        super().__init__()
        self.error_logged = False

    def emit(self, record):
        if record.levelno >= logging.ERROR:
            self.error_logged = True

LOG = logging.getLogger("my_custom_logger")
...

# Add the custom error-tracking handler
error_tracker = ErrorTrackingHandler()
LOG.addHandler(error_tracker)

...
# Check if any ERROR or higher-level messages were logged
if error_tracker.error_logged:
    print("Errors were logged, exiting with error.")
    sys.exit(1)

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.

Update exclude_parser.py to error when ProblemList format has issues
2 participants