]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/compulsory_tests/has_info.c
ccanlint: rename test keys
[ccan] / tools / ccanlint / compulsory_tests / has_info.c
index 77867dedd9c875ff22bcc4f42c7886065bd99265..5b71efa4fc9fd9c1304098a5e134d51a3c513e29 100644 (file)
 #include <ccan/noerr/noerr.h>
 #include <ccan/talloc/talloc.h>
 
-static void *check_has_info(struct manifest *m,
-                           bool keep,
-                           unsigned int *timeleft)
+static void check_has_info(struct manifest *m,
+                          bool keep,
+                          unsigned int *timeleft,
+                          struct score *score)
 {
-       if (m->info_file)
-               return NULL;
-       return m;
-}
-
-static const char *describe_has_info(struct manifest *m, void *check_result)
-{
-       return "You have no _info file.\n\n"
+       if (m->info_file) {
+               score->pass = true;
+               score->score = score->total;
+       } else {
+               score->error = "You have no _info file.\n\n"
        "The file _info contains the metadata for a ccan package: things\n"
        "like the dependencies, the documentation for the package as a whole\n"
        "and license information.\n";
+       }
 }
 
 static const char template[] = 
@@ -55,7 +54,7 @@ static const char template[] =
        "       return 1;\n"
        "}\n";
 
-static void create_info_template(struct manifest *m, void *check_result)
+static void create_info_template(struct manifest *m, struct score *score)
 {
        FILE *info;
        const char *filename;
@@ -76,10 +75,9 @@ static void create_info_template(struct manifest *m, void *check_result)
 }
 
 struct ccanlint has_info = {
-       .key = "info",
+       .key = "info_exists",
        .name = "Module has _info file",
        .check = check_has_info,
-       .describe = describe_has_info,
        .handle = create_info_template,
 };