[hawkmoth] [PATCH] cautodoc: fix error message formatting on pattern not matching

  • From: Jani Nikula <jani@xxxxxxxxxx>
  • To: hawkmoth@xxxxxxxxxxxxx
  • Date: Wed, 26 Dec 2018 21:18:14 +0200

Fixes

  File "/path/to/hawkmoth/__init__.py", line 68, in run
    env.app.warn(fmt.format(pattern),
KeyError: 'pat'

when the cautodoc directive filename pattern does not match any files.
---
 hawkmoth/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hawkmoth/__init__.py b/hawkmoth/__init__.py
index e3d4713e74ab..7f854002bc19 100644
--- a/hawkmoth/__init__.py
+++ b/hawkmoth/__init__.py
@@ -65,7 +65,7 @@ class CAutoDocDirective(Directive):
             filenames = glob.glob(env.config.cautodoc_root + '/' + pattern)
             if len(filenames) == 0:
                 fmt = 'Pattern "{pat}" does not match any files.'
-                env.app.warn(fmt.format(pattern),
+                env.app.warn(fmt.format(pat=pattern),
                              location=(env.docname, self.lineno))
                 continue
 
-- 
2.19.2


Other related posts: