We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Steps to reproduce the behavior:
<build> <plugins> <plugin> <groupId>com.cosium.code</groupId> <artifactId>git-code-format-maven-plugin</artifactId> <version>${git-code-format-maven-plugin.version}</version> <executions> <!-- On commit, format the modified java files --> <execution> <id>install-formatter-hook</id> <goals> <goal>install-hooks</goal> </goals> </execution> <!-- On Maven verify phase, fail if any file (including unmodified) is badly formatted --> <execution> <id>validate-code-format</id> <goals> <goal>validate-code-format</goal> </goals> </execution> </executions> <configuration> <googleJavaFormatOptions> <aosp>true</aosp> <fixImportsOnly>false</fixImportsOnly> <skipSortingImports>false</skipSortingImports> <skipRemovingUnusedImports>false</skipRemovingUnusedImports> </googleJavaFormatOptions> <propertiesToAdd> <prop>-X</prop> </propertiesToAdd> </configuration> </plugin> </plugins> </build>
git add .
git commit -m 'a message'
What is the expected output? The modified file should be indented using a 4-spaces indentation.
What happens instead? The file is still formatted using a 2-spaces indentation.
The debug logs look ok:
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?> <configuration> <currentProject default-value="${project}"/> <excludedModules>${gcf.excludedModules}</excludedModules> <googleJavaFormatOptions> <aosp>true</aosp> <fixImportsOnly>false</fixImportsOnly> <skipSortingImports>false</skipSortingImports> <skipRemovingUnusedImports>false</skipRemovingUnusedImports> </googleJavaFormatOptions> <includedModules>${gcf.includedModules}</includedModules> <skip default-value="false">${gcf.skip}</skip> <sourceEncoding default-value="${project.build.sourceEncoding}"/> </configuration> [DEBUG] ======================================================================= [INFO] [INFO] --- git-code-format-maven-plugin:3.1:on-pre-commit (default-cli) @ learn-spring-data.spring-data-custom-queries --- [DEBUG] Configuring mojo com.cosium.code:git-code-format-maven-plugin:3.1:on-pre-commit from plugin realm ClassRealm[plugin>com.cosium.code:git-code-format-maven-plugin:3.1, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@c387f44] [DEBUG] Configuring mojo 'com.cosium.code:git-code-format-maven-plugin:3.1:on-pre-commit' with basic configurator --> [DEBUG] (f) currentProject = MavenProject: com.baeldung:learn-spring-data.spring-data-custom-queries:0.1.0-SNAPSHOT @ C:\Baeldung\internal\lessons\private\learnspringdata\pom.xml [DEBUG] (f) excludedModules = [] [DEBUG] (s) aosp = true [DEBUG] (s) fixImportsOnly = false [DEBUG] (s) skipSortingImports = false [DEBUG] (s) skipRemovingUnusedImports = false [DEBUG] (f) googleJavaFormatOptions = com.cosium.code.format.MavenGoogleJavaFormatOptions@d70f722 [DEBUG] (f) includedModules = [] [DEBUG] (f) skip = false [DEBUG] (f) sourceEncoding = UTF-8 [DEBUG] -- end configuration -- [DEBUG] Goal enabled [INFO] Executing pre-commit hooks
And here the resulting modifications (using git log -p):
git log -p
- private static final Logger LOG = LoggerFactory.getLogger(MyClass.class); + private static final Logger LOG = LoggerFactory.getLogger(MyClass.class); + + @Autowired EntityManager entityManager; - @Autowired - EntityManager entityManager;
Environment:
Link to a git repository that can be cloned to reproduce the problem: https://github.com/rozagerardo/samples/tree/cosium--git-code-format-maven-plugin
The text was updated successfully, but these errors were encountered:
I have exact same issue with release 5.3, please fix it.
Sorry, something went wrong.
No branches or pull requests
Steps to reproduce the behavior:
git add .
andgit commit -m 'a message'
What is the expected output?
The modified file should be indented using a 4-spaces indentation.
What happens instead?
The file is still formatted using a 2-spaces indentation.
The debug logs look ok:
And here the resulting modifications (using
git log -p
):Environment:
Link to a git repository that can be cloned to reproduce the problem:
https://github.com/rozagerardo/samples/tree/cosium--git-code-format-maven-plugin
The text was updated successfully, but these errors were encountered: