Decide whether a missing README is a warning or a hard gate
Direct answer
A scanner should report readme_missing before it decides what that finding means. The mapping in this example is deliberately external data: one team can map the same identifier to warning, while another may use block. That separation prevents a filename probe from silently imposing an organization’s release rule.
The edge case is changing policy without changing detection. If the check itself hard-codes a hard failure, a project cannot trial a warning period or apply a different policy to an internal prototype. The assertion proves the lookup, not the correctness of any chosen severity.
This example does not search for README variants, inspect contents, or authenticate a policy source. It shows a small decision boundary. Version and review real policy files when multiple consumers rely on them.
Complete example
finding = "readme_missing"
policy = {"readme_missing": "warning"}
assert finding in policy
assert policy[finding] == "warning"
print("finding=readme_missing policy=warning")
Expected stdout:
finding=readme_missing policy=warning
Sources
Prepared with AI assistance. The example uses synthetic data; its stated limits apply.
Comments
Post a Comment