-
Notifications
You must be signed in to change notification settings - Fork 2
add capability to substitute values #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…es or tags. add existence check operator ~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, ""))); |
Copilot uses AI. Check for mistakes.
add existence check operator ~~