ci: add hint validation checks#898
Conversation
|
thanks @upils applied two changes and answered all comments. please have a look at the changes ;) re-tested at https://github.com/cjdcordeiro/chisel-releases/actions/runs/21949859625/job/63397311896?pr=36 and https://github.com/cjdcordeiro/chisel-releases/actions/runs/21949954850/job/63397658295?pr=35 |
lczyk
left a comment
There was a problem hiding this comment.
'request changes' but only due to volume of nitpicks / minor changes requested. overall happy with :)) ty!
|
also def not_too_long(text: str, max_length: int = 40) -> ErrorMessage | None:
"""Check that the text is not too long."""
if len(text) > max_length:
return f"must be at most {max_length} characters long (found {len(text)})"
return None
def only_single_spaces(text: str) -> ErrorMessage | None:
"""Check that the text does not contain multiple consecutive spaces."""
if " " in text:
return "multiple consecutive spaces are not allowed"
return None
def no_leading_trailing_spaces(text: str) -> ErrorMessage | None:
"""Check that the text does not have leading or trailing spaces."""
if text != text.strip():
return "leading and trailing spaces are not allowed"
return None??? |
|
also def test_all_caps_acronyms(self, tmp_path):
f = tmp_path / "sdf.yaml"
yaml_content = """slices:
with-acronym:
hint: Configure the CPU and GPU settings
starting-with-acronym:
hint: HTTP and HTTPS protocols
"""
f.write_text(yaml_content, encoding="utf-8")
errors = validate_hints.validate_hints(str(f))
assert len(errors) == 0this is currently passing, which is great, but id add it as a regression test / placeholder if someone adds something to do with acronyms.. ? 🤔 from https://documentation.ubuntu.com/chisel/en/latest/reference/chisel-releases/slice-definitions/:
|
Co-authored-by: Marcin Konowalczyk <marcin.konowalczyk@canonical.com>
Co-authored-by: Marcin Konowalczyk <marcin.konowalczyk@canonical.com>
This is a tricky one. It's the same for
Both require context, and although the NLP might be able to do a good job at it, it won't do it with a high level of confidence. I guess we gotta live with manual enforcement of these for now |
lczyk
left a comment
There was a problem hiding this comment.
ty for the changes! :)) still marking as 'request changes` but only pending the resolution of #898 (comment) + 2 nits. no further comments
Co-authored-by: Marcin Konowalczyk <marcin.konowalczyk@canonical.com>
There was a problem hiding this comment.
thanks! big +1 from me. given lots of changes fro my review, @upils could you have a quick look over? the biggest functionality change is the new no_consecutive_spaces validator. other than that it's "backend" changes.
( adding the 'ready to merge' label but not merging yet )
Proposed changes
Following canonical/chisel#263, this PR introduces:
validate_hintsscript being introduced, and should grow to cover the remaining CI scriptsRelated issues/PRs
canonical/chisel#263
Checklist
Additional Context
Example of a test-ci run: https://github.com/cjdcordeiro/chisel-releases/actions/runs/21833297147
Example of a PR with validation of hints: https://github.com/cjdcordeiro/chisel-releases/actions/runs/21853592833/job/63065485307?pr=35