Repository: conan-io/conan-center-index

Issue:
[service] Lint errors are excessive when patch_description & patch_type are missing
### What is your problem/feature request?

Preventing to merge because these fields are missing (since https://github.com/conan-io/conan-center-index/pull/14015) is excessive since they don't change the core logic or build quality of the recipe, it's purely informative and optional in conan source code.

There are several recipes out there with tones of patches without these fields (hello Boost), and the next poor contributor who will open a PR against these recipes will have to understand all these patches to deduce proper description and patch type, even if PR is unrelated. It will just lead to poor descriptions because they may not have the background to understand these patches, or they may just give up due to frustration of having to fix something unrelated to their PR.
I think it's a lot of effort for little benefit (I prefer to see more libraries in CCI & robust builds rather than pretty patch descriptions).

/cc @prince-chrismc @danimtb @SSE4 


Discussion:
I added this issue to be discussed in the CCI meeting. 
Hi, thanks for bringing this to our attention. We've decided to relax the requirements as you suggested, and we'll be implementing a few changes shortly:
 - Clarify in the docs that those files would be good to have from the current "fields are required" wording.
 - Make the linter still show up as an annotation, but make it be a notice/warning and not exit with a fail status

I hope that with both those options things get a little bit easier for maintainers, reviewers and contributors alike :)

Resolving patch:
diff --git a/linter/conandata_yaml_linter.py b/linter/conandata_yaml_linter.py
--- a/linter/conandata_yaml_linter.py
+++ b/linter/conandata_yaml_linter.py
@@ -1,5 +1,4 @@
 import argparse
-import sys
 from strictyaml import (
     load,
     Map,
@@ -54,13 +53,12 @@ def main():
     try:
         parsed = load(content, schema)
     except YAMLValidationError as error:
-        pretty_print_yaml_validate_error(args, error)
-        sys.exit(1)
+        pretty_print_yaml_validate_error(args, error) # Error when "source" is missing or when "patches" has no versions
+        return
     except BaseException as error:
-        pretty_print_yaml_validate_error(args, error)
-        sys.exit(1)
+        pretty_print_yaml_validate_error(args, error) # YAML could not be parsed
+        return
 
-    exit_code = 0
     if "patches" in parsed:
         for version in parsed["patches"]:
             patches = parsed["patches"][version]
@@ -69,8 +67,7 @@ def main():
                 try:
                     parsed["patches"][version][i].revalidate(patch_fields)
                 except YAMLValidationError as error:
-                    pretty_print_yaml_validate_error(args, error)
-                    exit_code = 1
+                    pretty_print_yaml_validate_warning(args, error) # Warning when patch fields are not followed
                     continue
 
                 # Make sure `patch_source` exists where it's encouraged
@@ -98,8 +95,6 @@ def main():
                         " the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)"
                     )
 
-    sys.exit(exit_code)
-
 
 def pretty_print_yaml_validate_error(args, error):
     snippet = error.context_mark.get_snippet().replace("\n", "%0A")
@@ -108,6 +103,14 @@ def pretty_print_yaml_validate_error(args, error):
         f"title=conandata.yml schema error"
         f"::Schema outlined in {CONANDATA_YAML_URL}#patches-fields is not followed.%0A%0A{error.problem} in %0A{snippet}%0A"
     )
+    
+def pretty_print_yaml_validate_warning(args, error):
+    snippet = error.context_mark.get_snippet().replace("\n", "%0A")
+    print(
+        f"::warning file={args.path},line={error.context_mark.line},endline={error.problem_mark.line+1},"
+        f"title=conandata.yml schema warning"
+        f"::Schema outlined in {CONANDATA_YAML_URL}#patches-fields is not followed.%0A%0A{error.problem} in %0A{snippet}%0A"
+    )
 
 
 if __name__ == "__main__":


Test patch: