-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable loading eclipse rules from local repository, prepare Prettier …
…over NodeJs
- Loading branch information
Showing
58 changed files
with
485 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
java/src/main/java/eu/solven/cleanthat/language/CleanthatUrlLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package eu.solven.cleanthat.language; | ||
|
||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.Optional; | ||
|
||
import org.springframework.core.io.ByteArrayResource; | ||
import org.springframework.core.io.DefaultResourceLoader; | ||
import org.springframework.core.io.Resource; | ||
|
||
import eu.solven.cleanthat.codeprovider.ICodeProvider; | ||
|
||
/** | ||
* Knows how to load resource given a URL, with a flexible format handling 'classpath:' to load from the classpath, and | ||
* 'code:' to load from the repository. | ||
* | ||
* @author Benoit Lacelle | ||
* | ||
*/ | ||
public class CleanthatUrlLoader { | ||
|
||
protected CleanthatUrlLoader() { | ||
// hidden | ||
} | ||
|
||
public static Resource loadUrl(ICodeProvider codeProvider, String javaConfigFile) { | ||
Resource resource; | ||
if (javaConfigFile.startsWith("code:")) { | ||
// This is inspired by Spring 'classpath:' | ||
// Here, it is used to load files from current repository | ||
String path = javaConfigFile.substring("code:".length()); | ||
Optional<String> optContent; | ||
try { | ||
optContent = codeProvider.loadContentForPath(path); | ||
} catch (IOException e) { | ||
throw new UncheckedIOException(e); | ||
} | ||
if (optContent.isEmpty()) { | ||
throw new IllegalStateException("There is no content at: " + path); | ||
} | ||
resource = new ByteArrayResource(optContent.get().getBytes(StandardCharsets.UTF_8), path); | ||
} else { | ||
resource = new DefaultResourceLoader().getResource(javaConfigFile); | ||
} | ||
|
||
return resource; | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
java/src/main/java/eu/solven/cleanthat/language/java/EclipseFormatterCacheKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package eu.solven.cleanthat.language.java; | ||
|
||
import eu.solven.cleanthat.codeprovider.ICodeProvider; | ||
import eu.solven.cleanthat.language.ILanguageProperties; | ||
import eu.solven.cleanthat.language.java.eclipse.EclipseJavaFormatterProcessorProperties; | ||
import lombok.EqualsAndHashCode; | ||
|
||
/** | ||
* Used as cache Key for Eclipse configuration | ||
* | ||
* @author Benoit Lacelle | ||
* | ||
*/ | ||
@EqualsAndHashCode | ||
public class EclipseFormatterCacheKey { | ||
// The same URL may map to different configuration (e.g. if the URL is relative to the repository) | ||
final ICodeProvider codeProvider; | ||
final ILanguageProperties languageProperties; | ||
final EclipseJavaFormatterProcessorProperties eclipseJavaFormatterProcessorProperties; | ||
|
||
public EclipseFormatterCacheKey(ICodeProvider codeProvider, | ||
ILanguageProperties languageProperties, | ||
EclipseJavaFormatterProcessorProperties eclipseJavaFormatterProcessorProperties) { | ||
this.codeProvider = codeProvider; | ||
this.languageProperties = languageProperties; | ||
this.eclipseJavaFormatterProcessorProperties = eclipseJavaFormatterProcessorProperties; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
.../cleanthat/rules/ATodoJavaParserRule.java → ...guage/java/rules/ATodoJavaParserRule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.