Skip to content

Commit

Permalink
Spotless (#50)
Browse files Browse the repository at this point in the history
* add spotless

* apply spotless

* fix license header
  • Loading branch information
kortemik authored Aug 28, 2024
1 parent d8a0585 commit 8879b45
Show file tree
Hide file tree
Showing 62 changed files with 1,216 additions and 515 deletions.
450 changes: 450 additions & 0 deletions eclipse-java-formatter.xml

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions license-header
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Teragrep RFC5424 frame library for Java (rlo_06)
* Copyright (C) 2022-2024 Suomen Kanuuna Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*
* Additional permission under GNU Affero General Public License version 3
* section 7
*
* If you modify this Program, or any covered work, by linking or combining it
* with other code, such other code is not for that reason alone subject to any
* of the requirements of the GNU Affero GPL version 3 as long as this Program
* is the same Program as licensed from Suomen Kanuuna Oy without any additional
* modifications.
*
* Supplemented terms under GNU Affero General Public License version 3
* section 7
*
* Origin of the software must be attributed to Suomen Kanuuna Oy. Any modified
* versions must be marked as "Modified version of" The Program.
*
* Names of the licensors and authors may not be used for publicity purposes.
*
* No rights are granted for use of trade names, trademarks, or service marks
* which are in The Program if any.
*
* Licensee must indemnify licensors and authors for any liability that these
* contractual assumptions impose on licensors and authors.
*
* To the extent this program is licensed as part of the Commercial versions of
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
163 changes: 107 additions & 56 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<packaging>jar</packaging>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.teragrep</groupId>
<artifactId>rlo_06</artifactId>
<version>${revision}${sha1}${changelist}</version>
<packaging>jar</packaging>
<name>rlo_06</name>
<description>Syslog (RFC 5424) library for Java</description>
<groupId>com.teragrep</groupId>
<url>https://teragrep.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<java.version>1.8</java.version>
<revision>0.0.1</revision>
<changelist>-SNAPSHOT</changelist>
<sha1/>
<junit.jupiter.version>5.7.1</junit.jupiter.version>
<publish.serverId>localhost</publish.serverId>
<publish.nexusUrl>http://localhost</publish.nexusUrl>
<publish.stagingRepositoryId>releases</publish.stagingRepositoryId>
<repository.id>releases</repository.id>
<repository.url>http://localhost/repository/releases/</repository.url>
</properties>
<licenses>
<license>
<name>GNU Affero General Public License v3.0</name>
Expand All @@ -44,6 +27,27 @@
<developerConnection>scm:git:[email protected]:teragrep/rlo_06.git</developerConnection>
<url>https://github.com/teragrep/rlo_06/tree/master</url>
</scm>
<distributionManagement>
<repository>
<id>${repository.id}</id>
<url>${repository.url}</url>
</repository>
</distributionManagement>
<properties>
<changelist>-SNAPSHOT</changelist>
<java.version>1.8</java.version>
<junit.jupiter.version>5.7.1</junit.jupiter.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<publish.nexusUrl>http://localhost</publish.nexusUrl>
<publish.serverId>localhost</publish.serverId>
<publish.stagingRepositoryId>releases</publish.stagingRepositoryId>
<repository.id>releases</repository.id>
<repository.url>http://localhost/repository/releases/</repository.url>
<revision>0.0.1</revision>
<sha1></sha1>
</properties>
<dependencies>
<!-- /// just for timestamp parsing \\\ -->
<dependency>
Expand Down Expand Up @@ -87,18 +91,63 @@
<finalName>rlo_06</finalName>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.15</version>
<inherited>false</inherited>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.30.0</version>
<configuration>
<java>
<eclipse>
<file>${project.basedir}/eclipse-java-formatter.xml</file>
<version>4.10.0</version>
</eclipse>
<removeUnusedImports></removeUnusedImports>
<licenseHeader>
<file>${project.basedir}/license-header</file>
</licenseHeader>
</java>
<pom>
<sortPom>
<!-- see https://github.com/diffplug/spotless/blob/main/plugin-maven/README.md#sortpom -->
<encoding>UTF-8</encoding>
<lineSeparator>\n</lineSeparator>
<expandEmptyElements>true</expandEmptyElements>
<keepBlankLines>false</keepBlankLines>
<nrOfIndentSpace>2</nrOfIndentSpace>
<predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
<sortProperties>true</sortProperties>
<sortModules>true</sortModules>
<sortExecutions>true</sortExecutions>
</sortPom>
</pom>
<formats>
<format>
<includes>
<include>.gitattributes</include>
<include>.gitignore</include>
</includes>
<trimTrailingWhitespace></trimTrailingWhitespace>
<endWithNewline></endWithNewline>
<indent>
<tabs>true</tabs>
<spacesPerTab>4</spacesPerTab>
</indent>
</format>
</formats>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.15</version>
<inherited>false</inherited>
<configuration>
<addDefaultLicenseMatchers>false</addDefaultLicenseMatchers>
<licenses>
Expand Down Expand Up @@ -128,6 +177,14 @@
<exclude>README.adoc</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -168,18 +225,18 @@
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<id>flatten.clean</id>
<goals>
<goal>flatten</goal>
<goal>clean</goal>
</goals>
<phase>clean</phase>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<id>flatten</id>
<goals>
<goal>clean</goal>
<goal>flatten</goal>
</goals>
<phase>process-resources</phase>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -225,6 +282,17 @@
</profile>
<profile>
<id>publish-maven-central</id>
<distributionManagement>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
Expand All @@ -234,10 +302,10 @@
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<phase>verify</phase>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
Expand All @@ -249,20 +317,16 @@
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>publish-github-packages</id>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/teragrep/rlo_06</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>publish-github-packages</id>
<build>
<plugins>
<plugin>
Expand All @@ -272,10 +336,10 @@
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<phase>verify</phase>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
Expand All @@ -287,19 +351,6 @@
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/teragrep/rlo_06</url>
</repository>
</distributionManagement>
</profile>
</profiles>
<distributionManagement>
<repository>
<id>${repository.id}</id>
<url>${repository.url}</url>
</repository>
</distributionManagement>
</project>
7 changes: 3 additions & 4 deletions src/main/java/com/teragrep/rlo_06/AppNameFunction.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java RFC524 parser library RLO-06
* Copyright (C) 2022 Suomen Kanuuna Oy
* Teragrep RFC5424 frame library for Java (rlo_06)
* Copyright (C) 2022-2024 Suomen Kanuuna Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -53,13 +53,12 @@ public final class AppNameFunction implements BiFunction<Stream, ByteBuffer, Byt
||||||||
vvvvvvvv
<14>1 2014-06-20T09:14:07.12345+00:00 host01 systemd DEA MSG-01 [ID_A@1 u="3" e="t"][ID_B@2 n="9"] sigsegv\n
Actions: _______O
Payload:'systemd '
States : .......T
*/


@Override
public ByteBuffer apply(Stream stream, ByteBuffer buffer) {

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/teragrep/rlo_06/AppNameParseException.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java RFC524 parser library RLO-06
* Copyright (C) 2022 Suomen Kanuuna Oy
* Teragrep RFC5424 frame library for Java (rlo_06)
* Copyright (C) 2022-2024 Suomen Kanuuna Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -46,6 +46,7 @@
package com.teragrep.rlo_06;

class AppNameParseException extends ParseException {

public AppNameParseException(String message, Throwable cause) {
super(message, cause);
}
Expand All @@ -58,4 +59,3 @@ public AppNameParseException(Throwable cause) {
super(cause);
}
}

4 changes: 2 additions & 2 deletions src/main/java/com/teragrep/rlo_06/Byteable.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java RFC524 parser library RLO-06
* Copyright (C) 2022 Suomen Kanuuna Oy
* Teragrep RFC5424 frame library for Java (rlo_06)
* Copyright (C) 2022-2024 Suomen Kanuuna Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/teragrep/rlo_06/Cache.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java RFC524 parser library RLO-06
* Copyright (C) 2022 Suomen Kanuuna Oy
* Teragrep RFC5424 frame library for Java (rlo_06)
* Copyright (C) 2022-2024 Suomen Kanuuna Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -46,6 +46,8 @@
package com.teragrep.rlo_06;

interface Cache<T> {

T take();

void put(T t);
}
5 changes: 3 additions & 2 deletions src/main/java/com/teragrep/rlo_06/Clearable.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Java RFC524 parser library RLO-06
* Copyright (C) 2022 Suomen Kanuuna Oy
* Teragrep RFC5424 frame library for Java (rlo_06)
* Copyright (C) 2022-2024 Suomen Kanuuna Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -46,5 +46,6 @@
package com.teragrep.rlo_06;

interface Clearable {

void clear();
}
Loading

0 comments on commit 8879b45

Please sign in to comment.