Conversation
…es or tags. add existence check operator ~~
There was a problem hiding this comment.
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
Files not reviewed (1)
- src/test/groovy/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancerSpec.groovy: Language not supported
Comments suppressed due to low confidence (2)
src/main/java/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancer.java:119
- The IllegalArgumentException thrown here lacks a descriptive message, which may hinder debugging. Consider adding a message detailing the cause, possibly including the IOException message.
throw new IllegalArgumentException();
src/main/java/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancer.java:84
- [nitpick] The parameter name 'addTags1' is unclear and inconsistent with similar naming elsewhere. Consider renaming it to 'addTags' to improve clarity.
public static void addAllTags(final Set<String> tags, Map<String, String> attributes, String addTags1, boolean enableSubstitution) {
There was a problem hiding this comment.
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- src/test/groovy/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancerSpec.groovy: Language not supported
Comments suppressed due to low confidence (1)
src/main/java/org/rundeck/plugins/nodes/attributes/AttributeNodeEnhancer.java:133
- Add unit tests to cover the substitution logic, including cases with special characters and missing attribute values to ensure the new functionality behaves as expected.
private static String substitute(Map<String, String> attributes, String value) {
| while (matcher.find()) { | ||
| String name = matcher.group("name"); | ||
| String replacement = attributes.get(name); | ||
| matcher.appendReplacement(sb, Objects.requireNonNullElse(replacement, "")); |
There was a problem hiding this comment.
Use Matcher.quoteReplacement on the replacement string to ensure that any special characters are escaped properly. For example, replace with matcher.appendReplacement(sb, Matcher.quoteReplacement(Objects.requireNonNullElse(replacement, ""))).
| matcher.appendReplacement(sb, Objects.requireNonNullElse(replacement, "")); | |
| matcher.appendReplacement(sb, Matcher.quoteReplacement(Objects.requireNonNullElse(replacement, ""))); |
add existence check operator ~~