]> git.ozlabs.org Git - ccan/blobdiff - tools/ccanlint/ccanlint.c
ccanlint: run tests in alphabetical order
[ccan] / tools / ccanlint / ccanlint.c
index fb3e4d140fe378108f23b4d0042f5ec41a6fd645..8aa9f2894c4aa83e053692c560b0bb6e74a5a6ea 100644 (file)
@@ -59,7 +59,7 @@ static void indent_print(const char *string)
 
 bool ask(const char *question)
 {
-       char reply[2];
+       char reply[80];
 
        printf("%s ", question);
        fflush(stdout);
@@ -149,11 +149,13 @@ static bool run_test(struct ccanlint *i,
                printf("\n");
        }
 
-       if (!quiet && !score->pass) {
+       if ((!quiet && !score->pass) || verbose) {
                struct file_error *f;
+               unsigned int lines = 1;
 
                if (score->error)
-                       printf("%s:\n", score->error);
+                       printf("%s%s\n", score->error,
+                              list_empty(&score->per_file_errors) ? "" : ":");
 
                list_for_each(&score->per_file_errors, f, list) {
                        if (f->line)
@@ -163,8 +165,12 @@ static bool run_test(struct ccanlint *i,
                                printf("%s:%s\n", f->file->fullname, f->error);
                        else
                                printf("%s\n", f->error);
+                       if (verbose < 2 && ++lines > 5) {
+                               printf("... more (use -vv to see them all)\n");
+                               break;
+                       }
                }
-               if (i->handle)
+               if (!quiet && !score->pass && i->handle)
                        i->handle(m, score);
        }