Skip to content

Commit f1f141d

Browse files
committed
Fix grammar, update docs, clean up code
1 parent 16f85f5 commit f1f141d

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
@@ -114,6 +114,12 @@ def main(root):
114114
parser.add_argument(
115115
"-c", "--clear", help="disable incremental builds", action="store_true"
116116
)
117+
parser.add_argument(
118+
"-o",
119+
"--offline",
120+
help="build in offline mode",
121+
action="store_true",
122+
)
117123
group = parser.add_mutually_exclusive_group()
118124
parser.add_argument(
119125
"--ignore-spec-lock-diff",
@@ -132,12 +138,6 @@ def main(root):
132138
help="start a local server with live reload",
133139
action="store_true",
134140
)
135-
group.add_argument(
136-
"-o",
137-
"--offline",
138-
help="build on offline mode",
139-
action="store_true",
140-
)
141141
group.add_argument(
142142
"--check-links", help="Check whether all links are valid", action="store_true"
143143
)

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)