Copilot commented on code in PR #12553:
URL: https://github.com/apache/trafficserver/pull/12553#discussion_r2417655866


##########
tools/hrw4u/src/types.py:
##########
@@ -99,9 +99,21 @@ class SuffixGroup(Enum):
     def validate(self, suffix: str) -> None:
         allowed_upper = {val.upper() for val in self.value}
         if suffix.upper() not in allowed_upper:
-            raise ValueError(
-                f"Invalid suffix '{suffix}' for group '{self.name}'. "
-                f"Must be one of: {', '.join(sorted(self.value))}")
+            # Special handling for BOOL_FIELDS to detect quoted boolean values
+            if self == SuffixGroup.BOOL_FIELDS:
+                bool_msg = f"Invalid boolean value '{suffix}'. Must be one of: 
{', '.join(sorted(self.value))}"
+
+                # Check if this is a quoted boolean value
+                is_double_quoted = (suffix.startswith('"') and 
suffix.endswith('"'))
+                is_single_quoted = (suffix.startswith("'") and 
suffix.endswith("'"))
+                if ((is_double_quoted or is_single_quoted) and len(suffix) > 2 
and suffix[1:-1].upper() in allowed_upper):

Review Comment:
   [nitpick] The quoted boolean detection logic could be simplified and made 
more readable by extracting the quote detection into a helper function or using 
a more concise approach.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to