-
Notifications
You must be signed in to change notification settings - Fork 487
feat: Add ReplaceObsoletesStep
#2530
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
Conversation
3c0e723
to
ee24a54
Compare
kindly request review @iddeepak. |
be0e0a5
to
5b74aa0
Compare
} | ||
|
||
@Test | ||
@Disabled("feature envy: (edge case/hard to implement) having a dedicated method") |
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.
Thanks for adding this. Since it's currently disabled, maybe a follow-up issue should be created ?
thx for feedback. |
5b74aa0
to
fcc724d
Compare
fcc724d
to
a5d9e0b
Compare
String processed = compile( | ||
"(enum\\s+\\w+\\s*\\{[^}]*?)(public\\s+static\\s+)(\\w+\\s*,\\s*|\\w+\\s*;)", | ||
MULTILINE) | ||
.matcher(input) |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
user-provided value
processed = compile( | ||
"(enum\\s+\\w+\\s*\\{[^}]*?)(public\\s+static\\s+)(\\w+\\s+\\w+\\s*\\([^)]*\\)\\s*(?:throws\\s+[\\w.]+(?:\\s*,\\s*[\\w.]+)*\\s*)?\\{)", | ||
MULTILINE) | ||
.matcher(processed) |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
user-provided value
This
regular expression
user-provided value
processed = compile( | ||
"(interface\\s+\\w+\\s*\\{[^}]*?)(public\\s+static\\s+)(final\\s+)(\\w+\\s+\\w+\\s*=)", | ||
MULTILINE) | ||
.matcher(processed) |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
user-provided value
processed = compile( | ||
"(interface\\s+\\w+\\s*\\{[^}]*?)(public\\s+static\\s+)(\\w+\\s+\\w+\\s*\\([^)]*\\)\\s*(?:throws\\s+[\\w.]+(?:\\s*,\\s*[\\w.]+)*\\s*)?;)", | ||
MULTILINE) | ||
.matcher(processed) |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
user-provided value
This
regular expression
user-provided value
processed = compile( | ||
"(interface\\s+\\w+\\s*\\{[^}]*?)(public\\s+static\\s+)(class\\s+\\w+\\s*\\{)", | ||
MULTILINE) | ||
.matcher(processed) |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
user-provided value
return compile( | ||
"(interface\\s+\\w+\\s*\\{[^}]*?)(?:public\\s+)?abstract\\s+(\\w+\\s+\\w+\\s*\\([^)]*\\)\\s*(?:throws\\s+[\\w.]+(?:\\s*,\\s*[\\w.]+)*\\s*)?;)", | ||
MULTILINE) | ||
.matcher(input) |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data High
regular expression
user-provided value
This
regular expression
user-provided value
Thank you! |
Spotless is primarily a switchboard for existing formatters. Sometimes we merge in a step where the implementation is inside our repository, but that tends to cause problems with backward compatibility - Spotless has pretty strict backwards-compatibility. If the step implementation lives in a separate jar, that gives the step a lot more flexibility to change, and Spotless users can choose to pin an older version of the step's behavior but still get new Gradle/Maven support from Spotless if they want. In my view, this step has some great cleanups (redundant I'm very happy to merge support for this step whether I agree with it or not, but I think it should live in a separate project similar to say google-java-format. I would think about the If that's too much work and you just want to use if for your own projects, you can always put it in |
Thanks for the insight. I partially agree. If this step is generic, it should apply to Google, Palantir, and any other Java formatter. The same goes for wildcard imports—this is a general feature we want, regardless of the formatter in use. But what if one project uses Palantir and wants to apply this recipe, even though it lives under the Google formatter? How would we handle that? Assuming this is as generic as the wildcard feature, I don’t see why it should be treated differently. |
What about splitting the process? This way, users can choose which aspect they want to focus on. |
feat: Add
ReplaceObsoletesStep
This PR introduces a new step to remove common boilerplate code, such as:
Motivation:
Discovered during the review of:
getProperty
can be simplified forline.separator
#2524Benefits: