[vala/staging] valadoc: Add --fatal-warnings command line option



commit b0c0a0ee097ed8968f77cf7b1548e916b7acd8d8
Author: Jiří Janoušek <janousek jiri gmail com>
Date:   Sun Nov 25 15:00:34 2018 +0100

    valadoc: Add --fatal-warnings command line option
    
    To be able to treat warnings as fatal.

 doc/valadoc.1        | 3 +++
 valadoc/valadoc.vala | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/doc/valadoc.1 b/doc/valadoc.1
index accbf3a85..965c2a469 100644
--- a/doc/valadoc.1
+++ b/doc/valadoc.1
@@ -98,6 +98,9 @@ Display version number
 \fB\-\-force\fR
 force
 .TP
+\fB\-\-fatal\-warnings\fR
+Treat warnings as fatal
+.TP
 \fB\-\-verbose\fR
 Show all warnings
 .TP
diff --git a/valadoc/valadoc.vala b/valadoc/valadoc.vala
index 7e74a187b..d05da55d6 100644
--- a/valadoc/valadoc.vala
+++ b/valadoc/valadoc.vala
@@ -49,6 +49,7 @@ public class ValaDoc : Object {
        private static bool disable_diagnostic_colors = false;
        private static bool verbose = false;
        private static bool force = false;
+       private static bool fatal_warnings = false;
 
        private static string basedir = null;
        [CCode (array_length = false, array_null_terminated = true)]
@@ -114,6 +115,7 @@ public class ValaDoc : Object {
                { "version", 0, 0, OptionArg.NONE, ref version, "Display version number", null },
 
                { "force", 0, 0, OptionArg.NONE, ref force, "force", null },
+               { "fatal-warnings", 0, 0, OptionArg.NONE, ref fatal_warnings, "Treat warnings as fatal", null 
},
                { "verbose", 0, 0, OptionArg.NONE, ref verbose, "Show all warnings", null },
                { "no-color", 0, 0, OptionArg.NONE, ref disable_diagnostic_colors, "Disable colored output", 
null },
                { "target-glib", 0, 0, OptionArg.STRING, ref target_glib, "Target version of glib for code 
generation", "MAJOR.MINOR" },
@@ -123,7 +125,7 @@ public class ValaDoc : Object {
        };
 
        private static int quit (ErrorReporter reporter) {
-               if (reporter.errors == 0) {
+               if (reporter.errors == 0 && (!fatal_warnings || reporter.warnings == 0)) {
                        stdout.printf ("Succeeded - %d warning(s)\n", reporter.warnings);
                        return 0;
                } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]