-
Notifications
You must be signed in to change notification settings - Fork 3
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
CHANGE(pmd): @W-17310830@: Update pmd-wrapper to run rules by language forcefully #156
Conversation
// Force the language so that pmd doesn't look at file extensions. Note: we already associated the files based | ||
// on their file extensions to the correct languages the typescript side. | ||
Language pmdLanguageId = config.getLanguageRegistry().getLanguageById(language); | ||
if (pmdLanguageId == null) { | ||
throw new RuntimeException("The language \"" + language + "\" is not recognized by PMD."); | ||
} | ||
LanguageVersion forcedLangVer = config.getLanguageVersionDiscoverer() | ||
.getDefaultLanguageVersion(pmdLanguageId); | ||
config.setForceLanguageVersion(forcedLangVer); |
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.
This here is the big win. We now can ignore pmd's default association from file extension to language and just force the language ourselves on a given set of files.
So now we can associate on the typescript side the file_extensions that are associated with a specific pmd language to accomodate for the PMD AppExchange Rules, etc.
e7bf56e
to
70ba652
Compare
@@ -0,0 +1,130 @@ | |||
package com.salesforce.sfca.pmdwrapper; |
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.
This file was actually just renamed from PmdRuleRunner... not sure why github thought this was a delete and an add. Sorry for the noise.
70ba652
to
39ada2b
Compare
@@ -0,0 +1,37 @@ | |||
package com.salesforce.sfca.shared; |
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.
Nothing new in this shared folder... just moved stuff. Again sorry for the noise.
b149657
to
c17c95d
Compare
} | ||
|
||
@Test | ||
void whenCallingRunWithZeroLanguages_thenError(@TempDir Path tempDir) throws Exception { |
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.
Nitpick: Could the test name explain what it means to have zero languages, the way whenCallingRunWithEmptyArrayFor_filesToScan_thenError
does? Maybe whencallingRunWithEmptyObjectFor_runDataPerLanguage_thenError
? Or is that too wordy to be helpful?
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.
Sure. Fixed.
No description provided.