The spreadsheets define a possible type as: "Integer"
However, the regex checks expect everything to be a string. This causes a warning when running the test because the check tries to perform a regular expression match against a non-string type.
The simplest fix is just to patch compliance-check-lib so that it will convert all global attrs to strings if doing a regex check:
(amf)$ cd compliance-check-lib/
(amf)$ git diff
diff --git a/checklib/code/nc_util.py b/checklib/code/nc_util.py
index 66553b2..41672e6 100644
--- a/checklib/code/nc_util.py
+++ b/checklib/code/nc_util.py
@@ -77,7 +77,9 @@ def check_global_attr_against_regex(ds, attr, regex):
"""
if attr not in ds.ncattrs():
return 0
- if not re.match("^{}$".format(regex), getattr(ds, attr), re.DOTALL):
+
+ # Always coerce the attribute to a string to do the regex check
+ if not re.match("^{}$".format(regex), str(getattr(ds, attr)), re.DOTALL):
return 1
# Success
return 2
NOTE: The test code for seeing if you get a warning is:
The spreadsheets define a possible type as: "Integer"
However, the regex checks expect everything to be a string. This causes a warning when running the test because the check tries to perform a regular expression match against a non-string type.
The simplest fix is just to patch
compliance-check-lib
so that it will convert all global attrs to strings if doing a regex check:NOTE: The test code for seeing if you get a warning is: