Skip to content

Commit

Permalink
Update site to use Sentry Maven Skin, and fail build on code quality …
Browse files Browse the repository at this point in the history
…problems (#53)
  • Loading branch information
bertysentry authored Jan 31, 2024
2 parents 3558c13 + 912ae44 commit 49ed765
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 103 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# printf4j

A Java version of C's *printf() functions
21 changes: 14 additions & 7 deletions src/test/resources/checkstyle.xml → checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@

<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<!----><module name="NewlineAtEndOfFile"/>
<!---->
<module name="NewlineAtEndOfFile" />

<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
<module name="Translation" />

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="FileLength"/>
<module name="FileLength" />

<!-- Checks for tab indentation -->
<module name="RegexpSingleline">
Expand All @@ -65,12 +66,16 @@
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
<property name="format" value="\s+$" />
<property name="minimum" value="0" />
<property name="maximum" value="0" />
<property name="message" value="Line has trailing spaces." />
</module>

<!-- Filter out Checkstyle warnings that have been suppressed with the
@SuppressWarnings annotation -->
<module name="SuppressWarningsFilter" />

<module name="TreeWalker">

<!-- Checks for Javadoc comments. -->
Expand All @@ -89,6 +94,8 @@
<property name="checkEmptyJavadoc" value="true"/>
</module>-->

<!-- Make the @SuppressWarnings annotations available to Checkstyle -->
<module name="SuppressWarningsHolder" />

<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
Expand Down
98 changes: 78 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

<organization>
<name>Sentry Software</name>
<url>https://sentrysoftware.com</url>
<url>https://sentrysoftware.org</url>
</organization>

<url>https://github.com/sentrysoftware/printf4j</url>
<url>https://sentrysoftware.org/printf4j</url>
<inceptionYear>2023</inceptionYear>

<distributionManagement>
Expand Down Expand Up @@ -112,6 +112,36 @@
</configuration>
</plugin>

<!-- checkstyle -->
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<linkXref>true</linkXref>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>

<!-- pmd -->
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.21.2</version>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<minimumTokens>50</minimumTokens>
<targetJdk>${maven.compiler.release}</targetJdk>
</configuration>
</plugin>

<!-- spotbugs -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.7.3.6</version>
</plugin>

</plugins>
</pluginManagement>

Expand Down Expand Up @@ -196,10 +226,55 @@
<version>3.2.5</version>
</plugin>

<!-- checkstyle -->
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- pmd -->
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- spotbugs -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- site -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M13</version>
<version>3.12.1</version>
<dependencies>
<dependency>
<groupId>org.sentrysoftware.maven</groupId>
<artifactId>maven-skin-tools</artifactId>
<version>1.3.00</version>
</dependency>
</dependencies>
</plugin>

<!-- jar -->
Expand Down Expand Up @@ -229,34 +304,17 @@
<!-- checkstyle -->
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<linkXref>true</linkXref>
<configLocation>src/test/resources/checkstyle.xml</configLocation>
</configuration>
</plugin>

<!-- pmd -->
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.21.2</version>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<minimumTokens>50</minimumTokens>
<targetJdk>${maven.compiler.release}</targetJdk>
<rulesets>
<ruleset>src/test/resources/pmd.xml</ruleset>
</rulesets>
</configuration>
</plugin>

<!-- spotbugs -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.7.3.6</version>
</plugin>

<!-- changelog -->
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/sentrysoftware/printf4j/Printf4J.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public static char toChar(final Object o) {
* @param arr Arguments to format.
* @return The formatted string
*/
@SuppressWarnings("checkstyle:methodlength")
public static String sprintf(final Locale locale, final String format, final Object... arr) {

// We're processing each format specifier (%d, %-12s, etc.) and will slightly
Expand Down Expand Up @@ -456,7 +457,7 @@ public static String sprintf(final Locale locale, final String format, final Obj
// Pass to the next argument (for the next format specifier we'll find)
argumentIndex++;
}
} catch (IllegalFormatException e) { /* do nothing */ }
} catch (IllegalFormatException e) { /* do nothing */ } // NOPMD

// Now append the rest that didn't match our pattern
percentMatcher.appendTail(formatResultBuilder);
Expand Down
5 changes: 5 additions & 0 deletions src/site/markdown/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Getting Started

This is a Java library that implements C's `printf()` function and mimick its behavior.

More information to come later.
Binary file added src/site/resources/images/sentry-logo-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions src/site/site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="${project.name}">

<skin>
<groupId>org.sentrysoftware.maven</groupId>
<artifactId>sentry-maven-skin</artifactId>
<version>6.2.00</version>
</skin>

<custom>
<noDefaultLinks>true</noDefaultLinks>
<keywords>awk,printf,gawk,bwk,C</keywords>
</custom>

<bannerLeft>
<src>images/sentry-logo-white.png</src>
<href>https://sentrysoftware.org</href>
</bannerLeft>

<body>

<links>
<item name="GitHub Repository" href="${project.scm.url}" />
<item name="Jawk" href="https://sentrysoftware.org/jawk" />
<item name="Linux fprintf(...) Man Page" href="https://man7.org/linux/man-pages/man3/fprintf.3p.html" />
</links>

<menu name="User Documentation">
<item name="Getting Started" href="index.html" />
</menu>

<menu ref="reports" />
</body>

</project>
75 changes: 0 additions & 75 deletions src/test/resources/pmd.xml

This file was deleted.

0 comments on commit 49ed765

Please sign in to comment.