Review `# type: ignore` comments across the code base.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 210
- Forks
- 36
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 2
Description
@behnazh-w I am a little confused about this comment. For one, it’s a blanket ignore and it doesn’t specify what error is being ignored here; this line should be
status_on_skipped, # type: ignore[arg-type]
But then the question arises: why is this argument type being ignored? Looking at the signature for the initializer https://github.com/oracle/macaron/blob/109edd2710d28492775f9e053433d66a968d16b0/src/macaron/slsa_analyzer/checks/base_check.py#L24-L34 the type for the status_on_skipped variable should be https://github.com/oracle/macaron/blob/109edd2710d28492775f9e053433d66a968d16b0/src/macaron/slsa_analyzer/checks/check_result.py#L15-L26 However, that status_on_skipped variable is the test function‘s argument https://github.com/oracle/macaron/blob/109edd2710d28492775f9e053433d66a968d16b0/tests/slsa_analyzer/checks/test_registry.py#L156-L162 declared as a Hypothesis SearchStrategy. But that’s not quite right because @given feeds values from strategies into the test function and not the strategy object. Thus, the function argument receives a list[None | str | int | tuple | bytes | bool] but that still doesn’t match the signature’s CheckResultType. So shouldn’t this test look something like
@given(st.sampled_from(list(CheckResultType)))
def test_exit_on_invalid_status_on_skipped(self, status_on_skipped: CheckResultType) -> None:
...
I’ve not tested this.
I then grepped through the code base and there are heaps of blanket type ignores. I think it would therefore make sense to open an issue to review all these blanket ignores, attempt to address them by fixing up the code (see above), and if that’s not possible constrain the ignore to only the error that’s being ignored. By doing so, other type errors will be surfaced if they occur instead of silently swallowing all errors.
Originally posted by @jenstroeger in https://github.com/oracle/macaron/pull/1419#discussion_r3432511385
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inventorying blanket type ignores across the codebase, then inspect tests/slsa_analyzer/checks/test_registry.py with the referenced base_check.py and check_result.py definitions. Review each ignore by fixing the type mismatch where possible or narrowing the comment to the specific error, and consider the work done when all blanket ignores have been addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100