From 7f380b9a50f90039d5e0c5376b58db0c1957892c Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Fri, 10 Feb 2023 10:06:03 +0100 Subject: [PATCH] (#14911) yamllinter: raise if a version has patches but no sources * yamllinter: raise if a version has patches but no sources * Update conandata_yaml_linter.py * we dont want to make noise se from errors just yet --------- Co-authored-by: Chris Mc --- linter/conandata_yaml_linter.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linter/conandata_yaml_linter.py b/linter/conandata_yaml_linter.py index 739a4a6ef00da3..9e7133803906ea 100644 --- a/linter/conandata_yaml_linter.py +++ b/linter/conandata_yaml_linter.py @@ -62,6 +62,14 @@ def main(): if "patches" in parsed: for version in parsed["patches"]: patches = parsed["patches"][version] + if version not in parsed["sources"]: + print( + f"::warning file={args.path},line={patches.start_line},endline={patches.end_line}," + f"title=conandata.yml inconsistency" + f"::Patch(es) are listed for version `{version}`, but there is source for this version." + f" You should either remove `{version}` from the `patches` section, or add it to the" + f" `sources` section" + ) for i, patch in enumerate(patches): # Individual report errors for each patch object try: