Skip to content

Commit

Permalink
Configure Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
vpaturet committed Dec 10, 2024
1 parent 69f87fb commit d296bbb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
SONAR_PROJECT_NAME: ${{ github.event.repository.name }}
SONAR_PROJECT_KEY: entur_${{ github.event.repository.name }}
run: |
mvn -s .github/workflows/settings.xml \
mvn -Psonar -s .github/workflows/settings.xml \
org.jacoco:jacoco-maven-plugin:prepare-agent verify \
org.jacoco:jacoco-maven-plugin:report sonar:sonar \
-Dmaven.main.skip \
Expand Down
50 changes: 50 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
<hamcrest.version>3.0</hamcrest.version>
<jakarta.annotation-api.version>3.0.0</jakarta.annotation-api.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<sonar-maven-plugin.version>4.0.0.4121</sonar-maven-plugin.version>
<prettier-java.version>2.1.0</prettier-java.version>
<prettier-maven-plugin.version>0.22</prettier-maven-plugin.version>
<plugin.prettier.goal>write</plugin.prettier.goal>


<!-- empty argLine property, the value is set up by Jacoco during unit tests execution -->
Expand Down Expand Up @@ -187,6 +191,22 @@
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>com.hubspot.maven.plugins</groupId>
<artifactId>prettier-maven-plugin</artifactId>
<version>${prettier-maven-plugin.version}</version>
<configuration>
<prettierJavaVersion>${prettier-java.version}</prettierJavaVersion>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>${plugin.prettier.goal}</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -266,6 +286,36 @@
</plugins>
</build>
</profile>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${sonar-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>com.hubspot.maven.plugins</groupId>
<artifactId>prettier-maven-plugin</artifactId>
<version>${prettier-maven-plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>prettierCheck</id>
<properties>
<!-- In the CI environment we want to validate that code is formatted -->
<plugin.prettier.goal>check</plugin.prettier.goal>
</properties>
</profile>
</profiles>

</project>

0 comments on commit d296bbb

Please sign in to comment.