Skip to content

Commit 920a73a

Browse files
committed
Fixed the formatting of a number of custom checks for the django check format, to be easier to read.
- Legacy-Id: 14407
1 parent 967ece7 commit 920a73a

1 file changed

Lines changed: 37 additions & 33 deletions

File tree

ietf/checks.py

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def check_doc_email_aliases_exists(app_configs, **kwargs):
8282
ok = check_doc_email_aliases()
8383
if not ok:
8484
errors.append(checks.Error(
85-
"Found no aliases in the document email aliases file\n'%s'."%settings.DRAFT_ALIASES_PATH,
85+
"Found no aliases in the document email aliases file\n'%s'."%settings.DRAFT_VIRTUAL_PATH,
8686
hint="Please run ietf/bin/generate-draft-aliases to generate them.",
8787
obj=None,
8888
id="datatracker.E0004",
@@ -108,11 +108,11 @@ def check_id_submission_directories(app_configs, **kwargs):
108108
p = getattr(settings, s)
109109
if not os.path.exists(p):
110110
errors.append(checks.Critical(
111-
"A directory used by the ID submission tool does not exist at the path given\n"
112-
"in the settings file. The setting is:\n"
111+
"A directory used by the ID submission tool does not\n"
112+
"exist at the path given in the settings file. The setting is:\n"
113113
" %s = %s" % (s, p),
114-
hint = ("Please either update the local settings to point at the correct directory,"
115-
"or if the setting is correct, create the indicated directory."),
114+
hint = ("Please either update the local settings to point at the correct\n"
115+
"\tdirectory, or if the setting is correct, create the indicated directory.\n"),
116116
id = "datatracker.E0006",
117117
))
118118
return errors
@@ -128,11 +128,12 @@ def check_id_submission_files(app_configs, **kwargs):
128128
p = getattr(settings, s)
129129
if not os.path.exists(p):
130130
errors.append(checks.Critical(
131-
"A file used by the ID submission tool does not exist at the path given\n"
132-
"in the settings file. The setting is:\n"
131+
"A file used by the ID submission tool does not exist\n"
132+
"at the path given in the settings file. The setting is:\n"
133133
" %s = %s" % (s, p),
134-
hint = ("Please either update the local settings to point at the correct file,"
135-
"or if the setting is correct, make sure the file is in place and has the right permissions."),
134+
hint = ("Please either update the local settings to point at the correct\n"
135+
"\tfile, or if the setting is correct, make sure the file is in place and\n"
136+
"\thas the right permissions.\n"),
136137
id = "datatracker.E0007",
137138
))
138139
return errors
@@ -149,11 +150,11 @@ def check_yang_model_directories(app_configs, **kwargs):
149150
p = getattr(settings, s)
150151
if not os.path.exists(p):
151152
errors.append(checks.Critical(
152-
"A directory used by the yang validation tools does not exist at the path\n"
153-
"gvien in the settings file. The setting is:\n"
153+
"A directory used by the yang validation tools does\n"
154+
"not exist at the path gvien in the settings file. The setting is:\n"
154155
" %s = %s" % (s, p),
155-
hint = ("Please either update your local settings to point at the correct directory,"
156-
"or if the setting is correct, create the indicated directory."),
156+
hint = ("Please either update your local settings to point at the correct\n"
157+
"\tdirectory, or if the setting is correct, create the indicated directory.\n"),
157158
id = "datatracker.E0006",
158159
))
159160
return errors
@@ -171,26 +172,27 @@ def check_id_submission_checkers(app_configs, **kwargs):
171172
checker_class = import_string(checker_path)
172173
except Exception as e:
173174
errors.append(checks.Critical(
174-
"An exception was raised when trying to import the draft submission"
175-
"checker class '%s':\n %s" % (checker_path, e),
176-
hint = "Please check that the class exists and can be imported.",
175+
"An exception was raised when trying to import the\n"
176+
"draft submission checker class '%s':\n %s" % (checker_path, e),
177+
hint = "Please check that the class exists and can be imported.\n",
177178
id = "datatracker.E0008",
178179
))
179180
try:
180181
checker = checker_class()
181182
except Exception as e:
182183
errors.append(checks.Critical(
183-
"An exception was raised when trying to instantiate the draft submission"
184-
"checker class '%s': %s" % (checker_path, e),
185-
hint = "Please check that the class can be instantiated.",
184+
"An exception was raised when trying to instantiate\n"
185+
"the draft submission checker class '%s':\n %s" % (checker_path, e),
186+
hint = "Please check that the class can be instantiated.\n",
186187
id = "datatracker.E0009",
187188
))
188189
continue
189190
for attr in ('name',):
190191
if not hasattr(checker, attr):
191192
errors.append(checks.Critical(
192-
"The draft submission checker '%s' has no attribute '%s', which is required" % (checker_path, attr),
193-
hint = "Please update the class.",
193+
"The draft submission checker\n '%s'\n"
194+
"has no attribute '%s', which is required" % (checker_path, attr),
195+
hint = "Please update the class.\n",
194196
id = "datatracker.E0010",
195197
))
196198
checker_methods = ("check_file_txt", "check_file_xml", "check_fragment_txt", "check_fragment_xml", )
@@ -199,9 +201,10 @@ def check_id_submission_checkers(app_configs, **kwargs):
199201
break
200202
else:
201203
errors.append(checks.Critical(
202-
"The draft submission checker '%s' has no recognised checker method; "
204+
"The draft submission checker\n '%s'\n"
205+
" has no recognised checker method; "
203206
"should be one or more of %s." % (checker_path, checker_methods),
204-
hint = "Please update the class.",
207+
hint = "Please update the class.\n",
205208
id = "datatracker.E0011",
206209
))
207210
return errors
@@ -217,11 +220,11 @@ def check_media_directories(app_configs, **kwargs):
217220
p = getattr(settings, s)
218221
if not os.path.exists(p):
219222
errors.append(checks.Critical(
220-
"A directory used for media uploads and serves does not exist at the path given\n"
221-
"in the settings file. The setting is:\n"
223+
"A directory used for media uploads and serves does\n"
224+
"not exist at the path given in the settings file. The setting is:\n"
222225
" %s = %s" % (s, p),
223-
hint = ("Please either update the local settings to point at the correct directory,"
224-
"or if the setting is correct, create the indicated directory."),
226+
hint = ("Please either update the local settings to point at the correct\n"
227+
"\tdirectory, or if the setting is correct, create the indicated directory.\n"),
225228
id = "datatracker.E0012",
226229
))
227230
return errors
@@ -238,11 +241,11 @@ def check_proceedings_directories(app_configs, **kwargs):
238241
p = getattr(settings, s)
239242
if not os.path.exists(p):
240243
errors.append(checks.Critical(
241-
"A directory used for meeting materials does not exist at the path given\n"
242-
"in the settings file. The setting is:\n"
244+
"A directory used for meeting materials does not\n"
245+
"exist at the path given in the settings file. The setting is:\n"
243246
" %s = %s" % (s, p),
244-
hint = ("Please either update the local settings to point at the correct directory,"
245-
"or if the setting is correct, create the indicated directory."),
247+
hint = ("Please either update the local settings to point at the correct\n"
248+
"\tdirectory, or if the setting is correct, create the indicated directory.\n"),
246249
id = "datatracker.E0013",
247250
))
248251
return errors
@@ -261,7 +264,7 @@ def cache_error(msg, errnum):
261264
( "A cache test failed with the message:\n '%s'.\n"
262265
"This indicates that the cache is unavailable or not working as expected.\n"
263266
"It will impact performance, but isn't fatal. The default cache is:\n"
264-
" CACHES['default']['BACKEND'] = %s\n") % (
267+
" CACHES['default']['BACKEND'] = %s") % (
265268
msg,
266269
settings.CACHES["default"]["BACKEND"],
267270
),
@@ -303,7 +306,7 @@ def maybe_create_svn_symlinks(settings):
303306
"does not exist:\n"
304307
" %s\n" % path,
305308
hint = "Please provide the correct python system site-package paths for\n"
306-
"svn and libsvn in SVN_PACKAGES.",
309+
"\tsvn and libsvn in SVN_PACKAGES.\n",
307310
id = "datatracker.E0015",))
308311
return errors
309312

@@ -374,6 +377,7 @@ def check_api_key_in_local_settings(app_configs, **kwargs):
374377
different than the default settings. You seem to have API key settings
375378
in settings_local.py, but they don't seem to propagate to django.conf.settings.
376379
Please check if you have multiple settings_local.py files.
380+
377381
""").replace('\n', '\n ').rstrip(),
378382
id = "datatracker.E0016",
379383
))

0 commit comments

Comments
 (0)