more verbose logs, and deal with empty spec_components#204
Open
more verbose logs, and deal with empty spec_components#204
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR bumps the project version, adds an empty-list guard in get_spec_component_type, and enhances logging and error handling in get_triple_store_graph.
- Bump project version from 0.3.1a5 to 0.3.3a1
- Add a guard clause for empty
spec_components - Improve parsing logs, error messages, and secrets handling in triple-store graph loading
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pyproject.toml | Updated version to 0.3.3a1 |
| mustrd/spec_component.py | Added empty-list check in get_spec_component_type |
| mustrd/mustrd.py | Added verbose logging, error handling, and secrets-file support in get_triple_store_graph |
Comments suppressed due to low confidence (3)
mustrd/spec_component.py:183
- [nitpick] The error message is generic. Consider including the function name or more context, e.g.,
ValueError("get_spec_component_type: 'spec_components' is empty").
raise ValueError("spec_components list is empty")
mustrd/spec_component.py:182
- This new guard clause isn’t covered by existing tests. Consider adding a unit test to verify that calling
get_spec_component_type([])raises the expectedValueError.
if not spec_components:
mustrd/mustrd.py:562
- Logging raw secrets at INFO level may expose sensitive data. Remove this log or mask the secrets before logging.
log.info("" + secrets)
| if secrets: | ||
| return Graph().parse(triple_store_graph_path).parse(data=secrets) | ||
| log.info("Parsing secrets from provided string (--secrets option)") | ||
| log.info("" + secrets) |
There was a problem hiding this comment.
[nitpick] The "" + secrets concatenation is redundant. Use log.info(secrets) or an f-string for clarity.
Suggested change
| log.info("" + secrets) | |
| log.info(secrets) |
| # Parse the main triple store graph file | ||
| try: | ||
| graph.parse(triple_store_graph_path) | ||
| except Exception as e: |
There was a problem hiding this comment.
Catching all Exception can hide unexpected errors. Consider catching more specific exceptions (e.g., a parsing or RDF-specific error).
Suggested change
| except Exception as e: | |
| except (BadSyntax, ParseException) as e: |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.