44
55from sphinx .application import Sphinx
66from sphinx .util .logging import getLogger
7+ from sphinx .util .console import colorize
78from sphinx .addnodes import pending_xref
89from docutils .parsers .rst .directives .tables import ListTable
910from docutils .parsers .rst import directives
1011from docutils import nodes
1112
1213
1314LOGGER = getLogger (__name__ )
15+ DISSECT_PREFIX = colorize ("bold" , "[Dissect]" )
1416
1517
1618class SupportedTargetTable (ListTable ):
@@ -32,7 +34,11 @@ def run(self):
3234 if result and isinstance (result [0 ], nodes .table ):
3335 table_node = result [0 ]
3436 table_name = table_node [0 ].astext ()
35- LOGGER .info ("Gathering references from table '%s'" , table_name )
37+ LOGGER .info (
38+ DISSECT_PREFIX
39+ + colorize ("darkgreen" , "Gathering references from table '%s'" ),
40+ table_name ,
41+ )
3642 module_references = self ._gather_table_references (table_node )
3743
3844 if module_references :
@@ -55,7 +61,11 @@ def _gather_table_references(self, table_node: nodes.table) -> list[str]:
5561 return references
5662
5763 def validate_references (self , table_name : str , module_references : list [str ]):
58- LOGGER .info ("Validating module references from table '%s'" , table_name )
64+ LOGGER .info (
65+ DISSECT_PREFIX
66+ + colorize ("darkgreen" , "Validating module references from table '%s'" ),
67+ table_name ,
68+ )
5969 check_path : str = self .options .get ("submodule-path" )
6070 root = Path (__file__ ).parent .parent .parent .parent
6171
@@ -76,16 +86,24 @@ def validate_references(self, table_name: str, module_references: list[str]):
7686 relative_file = file .relative_to (submodule_dir )
7787
7888 if file .stem in black_list :
79- LOGGER .debug ("Skipping %s" , relative_file )
89+ LOGGER .debug (
90+ DISSECT_PREFIX + colorize ("darkgrey" , "Skipping %s" ), relative_file
91+ )
8092 continue
8193 if file .stem not in module_references :
8294 LOGGER .warning (
83- "Missing documentation entry for %s in table '%s'" ,
95+ DISSECT_PREFIX
96+ + colorize (
97+ "darkred" , "Missing documentation entry for %s in table '%s'"
98+ ),
8499 relative_file ,
85100 table_name ,
86101 )
87102
88- LOGGER .info ("Done validating table '%s'" , table_name )
103+ LOGGER .info (
104+ DISSECT_PREFIX + colorize ("darkgreen" , "Done validating table '%s'" ),
105+ table_name ,
106+ )
89107
90108
91109def setup (app : Sphinx ) -> dict [str , Any ]:
0 commit comments