Skip to content

Commit 32f301c

Browse files
committed
Fix grammar, update docs, clean up code
1 parent 920bba8 commit 32f301c

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

builder/build_cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,19 @@ def main(root):
7171
parser.add_argument(
7272
"-c", "--clear", help="disable incremental builds", action="store_true"
7373
)
74+
parser.add_argument(
75+
"-o",
76+
"--offline",
77+
help="build in offline mode",
78+
action="store_true",
79+
)
7480
group = parser.add_mutually_exclusive_group()
7581
group.add_argument(
7682
"-s",
7783
"--serve",
7884
help="start a local server with live reload",
7985
action="store_true",
8086
)
81-
group.add_argument(
82-
"-o",
83-
"--offline",
84-
help="build on offline mode",
85-
action="store_true",
86-
)
8787
group.add_argument(
8888
"--check-links", help="Check whether all links are valid", action="store_true"
8989
)

exts/coding_guidelines/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ def merge_domaindata(self, docnames, other):
3434

3535
def setup(app):
3636

37-
38-
# Retrieve the passed value
39-
40-
ignore_fls_checks = False
4137
app.add_domain(CodingGuidelinesDomain)
42-
app.add_config_value("offline", False, "env") # register offline option
38+
app.add_config_value("offline", False, "env") # register the offline option
4339
app.add_config_value(
4440
name="spec_std_docs_url",
4541
default="https://doc.rust-lang.org/stable/std",

exts/coding_guidelines/fls_checks.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,16 @@ def check_fls_ids_correct(app, env, fls_ids):
155155

156156
def gather_fls_paragraph_ids(app, json_url):
157157
"""
158-
Gather all Ferrocene Language Specification paragraph IDs from the paragraph-ids.json file,
159-
including both container section IDs and individual paragraph IDs.
158+
Gather all Ferrocene Language Specification paragraph IDs from the paragraph-ids.json file
159+
or from the lock file in offline mode, including both container section IDs and individual paragraph IDs.
160160
161161
Args:
162+
app: The Sphinx application
162163
json_url: The URL or path to the paragraph-ids.json file
163164
164165
Returns:
165166
Dictionary mapping paragraph IDs to metadata AND the complete raw JSON data
166167
"""
167-
logger.info("Gathering FLS paragraph IDs from %s", json_url)
168168
offline = app.config.offline
169169
lock_path = app.confdir / 'fls.lock'
170170

@@ -175,6 +175,7 @@ def gather_fls_paragraph_ids(app, json_url):
175175
try:
176176
# Load the JSON file
177177
if not offline:
178+
logger.info("Gathering FLS paragraph IDs from %s", json_url)
178179
response = requests.get(json_url)
179180
response.raise_for_status() # Raise exception for HTTP errors
180181
# Parse the JSON data
@@ -188,9 +189,11 @@ def gather_fls_paragraph_ids(app, json_url):
188189
raise
189190

190191
else : # if online mode is on read from the lock file
192+
191193
if not lock_path.exists():
192194
logger.warning(f"No FLS lock file found at {lock_path}") # TODO: returns an error
193195
return False, []
196+
logger.info("Gathering FLS paragraph IDs from lock file: %s", lock_path)
194197
with open(lock_path, 'r', encoding='utf-8') as f:
195198
raw_json_data=f.read()
196199
data = json.loads(raw_json_data)

0 commit comments

Comments
 (0)