civics-cdf-validator 1.55.dev4__tar.gz → 1.56.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {civics_cdf_validator-1.55.dev4/civics_cdf_validator.egg-info → civics_cdf_validator-1.56.dev0}/PKG-INFO +1 -1
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0/civics_cdf_validator.egg-info}/PKG-INFO +1 -1
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/rules.py +34 -1
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/version.py +1 -1
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/CONTRIBUTING.md +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/LICENSE-2.0.txt +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/MANIFEST.in +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/README.md +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/__init__.py +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/base.py +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/civics_cdf_validator.egg-info/SOURCES.txt +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/civics_cdf_validator.egg-info/dependency_links.txt +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/civics_cdf_validator.egg-info/entry_points.txt +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/civics_cdf_validator.egg-info/requires.txt +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/civics_cdf_validator.egg-info/top_level.txt +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/gpunit_rules.py +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/loggers.py +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/office_utils.py +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/setup.cfg +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/setup.py +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/stats.py +0 -0
- {civics_cdf_validator-1.55.dev4 → civics_cdf_validator-1.56.dev0}/validator.py +0 -0
|
@@ -409,7 +409,7 @@ class PercentSum(base.BaseRule):
|
|
|
409
409
|
|
|
410
410
|
|
|
411
411
|
class EmptyText(base.BaseRule):
|
|
412
|
-
"""Check that Text elements are not strictly whitespace."""
|
|
412
|
+
"""Check that Text elements are not empty or strictly whitespace."""
|
|
413
413
|
|
|
414
414
|
def elements(self):
|
|
415
415
|
return ["Text"]
|
|
@@ -421,6 +421,38 @@ class EmptyText(base.BaseRule):
|
|
|
421
421
|
raise loggers.ElectionError.from_message("Text is empty", element)
|
|
422
422
|
|
|
423
423
|
|
|
424
|
+
class EmptyString(base.BaseRule):
|
|
425
|
+
"""Check that string fields are not empty or strictly whitespace."""
|
|
426
|
+
|
|
427
|
+
def elements(self):
|
|
428
|
+
"""Returns all elements of type xs:string from the schema."""
|
|
429
|
+
string_elements = []
|
|
430
|
+
for _, element in etree.iterwalk(self.schema_tree):
|
|
431
|
+
tag = self.strip_schema_ns(element)
|
|
432
|
+
if (
|
|
433
|
+
tag
|
|
434
|
+
and tag == "element"
|
|
435
|
+
and element.get("type") == "xs:string"
|
|
436
|
+
and element.get("name") is not None
|
|
437
|
+
):
|
|
438
|
+
string_elements.append(element.get("name"))
|
|
439
|
+
return string_elements
|
|
440
|
+
|
|
441
|
+
# pylint: disable=g-explicit-length-test
|
|
442
|
+
def check(self, element):
|
|
443
|
+
if element.text is None or not element.text.strip() and not len(element):
|
|
444
|
+
# TODO(b/462777279): Remove this once once feeds are no longer setting
|
|
445
|
+
# this to an empty string.
|
|
446
|
+
if element.tag == "IssuerAbbreviation":
|
|
447
|
+
raise loggers.ElectionWarning.from_message(
|
|
448
|
+
"String field is empty", [element]
|
|
449
|
+
)
|
|
450
|
+
else:
|
|
451
|
+
raise loggers.ElectionError.from_message(
|
|
452
|
+
"String field is empty", [element]
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
|
|
424
456
|
class DuplicateID(base.TreeRule):
|
|
425
457
|
"""Check that the file does not contain duplicate object IDs."""
|
|
426
458
|
|
|
@@ -4723,6 +4755,7 @@ COMMON_RULES = (
|
|
|
4723
4755
|
DuplicateGpUnits,
|
|
4724
4756
|
DuplicateID,
|
|
4725
4757
|
DuplicatedGpUnitOcdId,
|
|
4758
|
+
EmptyString,
|
|
4726
4759
|
EmptyText,
|
|
4727
4760
|
Encoding,
|
|
4728
4761
|
ExecutiveOfficeShouldNotHaveGovernmentBody,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|