File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -227,6 +227,10 @@ def validate_module_name_content(name):
227227 r = "[a-z][a-z0-9]*(-[a-z0-9]+)*"
228228 proper_name = name
229229
230+ if is_module_local (name ) or is_module_absolute (name ):
231+ # If one of these are true, the other must be false
232+ assert is_module_absolute (name ) != is_module_local (name )
233+
230234 if is_module_local (name ):
231235 if not name .startswith ("./" ):
232236 raise CFBSValidationError (name , "Local module names should begin with `./`" )
@@ -270,10 +274,18 @@ def validate_module_name_content(name):
270274 "Module name proper is empty" ,
271275 )
272276
277+ if proper_name [0 ] not in "abcdefghijklmnopqrstuvwxyz" :
278+ raise CFBSValidationError (
279+ name ,
280+ "Module name must start with a lowercase ASCII letter ('{}' starts with '{}')" .format (
281+ proper_name , proper_name [0 ]
282+ ),
283+ )
284+
273285 if not re .fullmatch (r , proper_name ):
274286 raise CFBSValidationError (
275287 name ,
276- "Module name contains illegal characters (only lowercase ASCII alphanumeric characters are legal )" ,
288+ "Module name contains illegal characters (only lowercase ASCII alphanumeric characters and single dash separators are allowed )" ,
277289 )
278290
279291 log .debug ("Successfully validated name of module %s" % name )
You can’t perform that action at this time.
0 commit comments