[commit: ghc] master: users-guide: Better error messages on incomplete ghc-flag directives (7463a95)

git at git.haskell.org git at git.haskell.org
Tue Aug 22 22:02:11 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7463a95dbe53d789f8f245f26735a7ac74bb6e11/ghc

>---------------------------------------------------------------

commit 7463a95dbe53d789f8f245f26735a7ac74bb6e11
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Tue Aug 22 11:51:54 2017 -0400

    users-guide: Better error messages on incomplete ghc-flag directives


>---------------------------------------------------------------

7463a95dbe53d789f8f245f26735a7ac74bb6e11
 docs/users_guide/flags.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/users_guide/flags.py b/docs/users_guide/flags.py
index 06223b5..5a1ff51 100644
--- a/docs/users_guide/flags.py
+++ b/docs/users_guide/flags.py
@@ -28,6 +28,7 @@ from docutils import nodes
 from docutils.parsers.rst import Directive, directives
 from sphinx import addnodes
 from sphinx.domains.std import GenericObject
+from sphinx.errors import SphinxError
 
 ### Settings
 
@@ -125,6 +126,12 @@ class Flag(GenericObject):
         if 'noindex' in self.options:
             return
 
+        # Validity checking
+        if 'shortdesc' not in self.options:
+            raise SphinxError('ghc-flag (%s) directive missing :shortdesc: key' % self.names)
+        if 'type' not in self.options:
+            raise SphinxError('ghc-flag (%s) directive missing :type: key' % self.names)
+
         # Set the flag category (default: misc)
         self.category = 'misc'
         if not 'category' in self.options or self.options['category'] == '':



More information about the ghc-commits mailing list