11# SPDX-License-Identifier: MIT OR Apache-2.0
22# SPDX-FileCopyrightText: The Coding Guidelines Subcommittee Contributors
3-
4- from . import fls_checks
5- from . import write_guidelines_ids
6- from . import std_role
7- from . import fls_linking
8- from . import guidelines_checks
93
10- from .common import logger , get_tqdm , bar_format , logging
114from sphinx .domains import Domain
125
6+ from . import (
7+ common ,
8+ fls_checks ,
9+ fls_linking ,
10+ guidelines_checks ,
11+ std_role ,
12+ write_guidelines_ids ,
13+ )
14+ from .common import bar_format , get_tqdm , logger , logging
15+
16+
1317class CodingGuidelinesDomain (Domain ):
1418 name = "coding-guidelines"
1519 label = "Rust Standard Library"
@@ -19,17 +23,17 @@ class CodingGuidelinesDomain(Domain):
1923 directives = {}
2024 object_types = {}
2125 indices = {}
22-
26+
2327 def get_objects (self ):
2428 return []
25-
29+
2630 def merge_domaindata (self , docnames , other ):
2731 pass # No domain data to merge
2832
2933
3034def on_build_finished (app , exception ):
3135 print ("\n Finalizing build:" )
32- for _ in get_tqdm (iterable = range (1 ), desc = "Finalizing" ,bar_format = bar_format ):
36+ for _ in get_tqdm (iterable = range (1 ), desc = "Finalizing" , bar_format = bar_format ):
3337 pass
3438
3539 outdir = app .outdir
@@ -39,47 +43,44 @@ def on_build_finished(app, exception):
3943 if not app .config .debug :
4044 print (f" + Build complete -> { outdir } " )
4145
46+
4247def setup (app ):
43-
4448 app .add_domain (CodingGuidelinesDomain )
4549 app .add_config_value (
46- name = "offline" ,
47- default = False ,
48- rebuild = "env"
49- ) # register the offline option
50+ name = "offline" , default = False , rebuild = "env"
51+ ) # register the offline option
5052 app .add_config_value (
5153 name = "spec_std_docs_url" ,
5254 default = "https://doc.rust-lang.org/stable/std" ,
5355 rebuild = "env" , # Rebuild the environment when this changes
5456 types = [str ],
5557 )
56- app .add_config_value (name = 'debug' ,
57- default = False ,
58- rebuild = 'env'
58+ app .add_config_value (name = "debug" , default = False , rebuild = "env" )
59+ app .add_config_value (
60+ name = "fls_paragraph_ids_url" ,
61+ default = "https://rust-lang.github.io/fls/paragraph-ids.json" ,
62+ rebuild = "env" ,
63+ )
64+ app .add_config_value (
65+ name = "enable_spec_lock_consistency" , default = True , rebuild = "env"
5966 )
60- app .add_config_value (name = 'fls_paragraph_ids_url' ,
61- default = 'https://rust-lang.github.io/fls/paragraph-ids.json' ,
62- rebuild = 'env' )
63- app .add_config_value (name = 'enable_spec_lock_consistency' ,
64- default = True ,
65- rebuild = 'env' )
6667 app .add_config_value (
67- name = ' required_guideline_fields' ,
68- default = [' release' , ' fls' , ' decidability' , ' scope' ],
69- rebuild = ' env' ,
68+ name = " required_guideline_fields" ,
69+ default = [" release" , " fls" , " decidability" , " scope" ],
70+ rebuild = " env" ,
7071 types = [list ],
7172 )
7273 if app .config .debug :
7374 logger .setLevel (logging .INFO )
74- common .disable_tqdm = True
75-
76- app .connect (' env-check-consistency' , guidelines_checks .validate_required_fields )
77- app .connect (' env-check-consistency' , fls_checks .check_fls )
78- app .connect (' build-finished' , write_guidelines_ids .build_finished )
79- app .connect (' build-finished' , fls_linking .build_finished )
80- app .connect (' build-finished' , on_build_finished )
81-
75+ common .disable_tqdm = True
76+
77+ app .connect (" env-check-consistency" , guidelines_checks .validate_required_fields )
78+ app .connect (" env-check-consistency" , fls_checks .check_fls )
79+ app .connect (" build-finished" , write_guidelines_ids .build_finished )
80+ app .connect (" build-finished" , fls_linking .build_finished )
81+ app .connect (" build-finished" , on_build_finished )
82+
8283 return {
83- ' version' : ' 0.1' ,
84- ' parallel_read_safe' : True ,
84+ " version" : " 0.1" ,
85+ " parallel_read_safe" : True ,
8586 }
0 commit comments