-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Updates to support groovy 4 #439
Conversation
Bump jars to their latest versions Update the CodeNarcServer Update linter groovy version
Amazing, i'll test tht asap :) cc @stevenh |
Just a quick note to say I've seen this and its on my list to look at. |
I believe a minimal example could be useful here for testing. Instead of updating the description, I'm adding this working code snippet as a comment. More complex scenarios benefit from this syntax, but this should be sufficient, as it reflects a somewhat reasonable use of a Groovy class that features return statements. class TestClass {
enum TestStrings{
ONE('One has been used'),
TWO('Two has been used'),
DEFAULT('Default string')
String content
TestStrings(String content) {
this.content = content
}
String get() {
content
}
}
static String compareStrings(String testString) {
String innerString = TestStrings.DEFAULT.get()
switch (testString) {
case 'one' -> {
innerString = TestStrings.ONE.get()
println(innerString)
}
case 'two' -> {
innerString = TestStrings.TWO.get()
println(innerString)
}
default -> println(innerString)
}
innerString
}
}
assert TestClass.compareStrings() == TestClass.TestStrings.DEFAULT.get()
assert TestClass.compareStrings('one') == TestClass.TestStrings.ONE.get()
assert TestClass.compareStrings('two') == TestClass.TestStrings.TWO.get() |
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.
Looks like just an editor format change and then should be good to go.
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.
LGTM
Fixes
Proposed Changes
Additional info ℹ️
CodeNarcServer
was required, otherwise Groovy would throw an error.