diff --git a/.github/openhab-compile-problems.json b/.github/openhab-compile-problems.json new file mode 100644 index 0000000000000..a5c5c4bb9dc51 --- /dev/null +++ b/.github/openhab-compile-problems.json @@ -0,0 +1,21 @@ +{ + "problemMatcher": [ + { + "owner": "openhab-compile-problems", + "severity": "error", + "pattern": [ + { + "regexp": "Failed to execute goal.*Compilation failure" + }, + { + "regexp": "^\\[ERROR\\] (.+\\.java):\\[(.+),(.+)\\] (.*)$", + "file": 1, + "line": 2, + "col": 3, + "message": 4, + "loop": true + } + ] + } + ] +} diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index aad303ffb4e50..5a7eee2ca567a 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -54,6 +54,11 @@ jobs: with: maven-version: ${{ matrix.maven }} + - name: Register Problem Matchers + id: problem_matchers + run: | + echo "::add-matcher::.github/openhab-compile-problems.json" + - name: Build id: build run: './.github/scripts/maven-build' @@ -77,3 +82,11 @@ jobs: with: name: sat-summary-report path: target/summary_report.html + + - name: Report SAT Errors as Annotations + uses: ghys/checkstyle-github-action@main + if: ${{ always() && ((steps.build.outcome == 'success') || (steps.build.outcome == 'failure')) }} + with: + title: CheckStyle Violations + path: '**/checkstyle-result.xml' + mode: inline diff --git a/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/exception/ModbusSlaveErrorResponseException.java b/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/exception/ModbusSlaveErrorResponseException.java index d581a51abea11..58a19df1f567f 100644 --- a/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/exception/ModbusSlaveErrorResponseException.java +++ b/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/exception/ModbusSlaveErrorResponseException.java @@ -28,10 +28,10 @@ @NonNullByDefault public abstract class ModbusSlaveErrorResponseException extends ModbusTransportException { - private static final Map exceptionCodesIndex = new HashMap<>(10); + private static final Map EXCEPTION_CODES_INDEX = new HashMap<>(10); static { for (KnownExceptionCode code : KnownExceptionCode.values()) { - exceptionCodesIndex.put(code.exceptionCode, code); + EXCEPTION_CODES_INDEX.put(code.exceptionCode, code); } } @@ -64,7 +64,7 @@ public int getExceptionCode() { } public static Optional tryFromExceptionCode(int exceptionCode) { - return Optional.ofNullable(exceptionCodesIndex.get(exceptionCode)); + return Optional.ofNullable(EXCEPTION_CODES_INDEX.get(exceptionCode)); } } diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/cache/ByteArrayFileCache.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/cache/ByteArrayFileCache.java index 8dbc865c6bd6d..5d1218df117a6 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/cache/ByteArrayFileCache.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/cache/ByteArrayFileCache.java @@ -65,8 +65,9 @@ public ByteArrayFileCache(String servicePID) { * disable this functionality. */ public ByteArrayFileCache(String servicePID, Duration expiry) { - // TODO track and limit folder size - // TODO support user specific folder + // possible to-dos: + // - track and limit folder size + // - support user specific folder cacheFolder = new File(new File(OpenHAB.getUserDataFolder(), CACHE_FOLDER_NAME), servicePID); if (!cacheFolder.exists()) { logger.debug("Creating cache folder '{}'", cacheFolder.getAbsolutePath()); diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DecimalType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DecimalType.java index ccb02d0446ca8..3d26556d7bda5 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DecimalType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DecimalType.java @@ -61,7 +61,6 @@ public DecimalType(double value) { * The English locale is used to determine (decimal/grouping) separator characters. * * @param value the non null value representing a number - * * @throws NumberFormatException when the number could not be parsed to a {@link BigDecimal} */ public DecimalType(String value) { @@ -73,7 +72,6 @@ public DecimalType(String value) { * * @param value the non null value representing a number * @param locale the locale used to determine (decimal/grouping) separator characters - * * @throws NumberFormatException when the number could not be parsed to a {@link BigDecimal} */ public DecimalType(String value, Locale locale) { @@ -102,7 +100,6 @@ public String toFullString() { * * @param value the non null value representing a number * @return a new {@link DecimalType} - * * @throws NumberFormatException when the number could not be parsed to a {@link BigDecimal} */ public static DecimalType valueOf(String value) { diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PercentType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PercentType.java index b97a6ba42dc05..51e43513427cc 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PercentType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PercentType.java @@ -45,7 +45,6 @@ public PercentType() { * Creates a new {@link PercentType} with the given value. * * @param value the value representing a percentage - * * @throws IllegalArgumentException when the value is not between 0 and 100 */ public PercentType(int value) { @@ -58,7 +57,6 @@ public PercentType(int value) { * The English locale is used to determine (decimal/grouping) separator characters. * * @param value the non null value representing a percentage - * * @throws NumberFormatException when the number could not be parsed to a {@link BigDecimal} * @throws IllegalArgumentException when the value is not between 0 and 100 */ @@ -71,7 +69,6 @@ public PercentType(String value) { * * @param value the non null value representing a percentage * @param locale the locale used to determine (decimal/grouping) separator characters - * * @throws NumberFormatException when the number could not be parsed to a {@link BigDecimal} * @throws IllegalArgumentException when the value is not between 0 and 100 */ @@ -84,7 +81,6 @@ public PercentType(String value, Locale locale) { * Creates a new {@link PercentType} with the given value. * * @param value the value representing a percentage. - * * @throws IllegalArgumentException when the value is not between 0 and 100 */ public PercentType(BigDecimal value) { @@ -103,7 +99,6 @@ private void validateValue(BigDecimal value) { * * @param value the non null value representing a percentage * @return new {@link PercentType} - * * @throws NumberFormatException when the number could not be parsed to a {@link BigDecimal} * @throws IllegalArgumentException when the value is not between 0 and 100 */ diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java index c3322483d2cea..183d66cf34fad 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java @@ -99,7 +99,6 @@ public QuantityType() { * The English locale is used to determine (decimal/grouping) separator characters. * * @param value the non null value representing a quantity with an optional unit. - * * @throws NumberFormatException when a quantity without a unit could not be parsed * @throws IllegalArgumentException when a quantity with a unit could not be parsed */ @@ -113,7 +112,6 @@ public QuantityType(String value) { * * @param value the non null value representing a quantity with an optional unit. * @param locale the locale used to determine (decimal/grouping) separator characters. - * * @throws NumberFormatException when a quantity without a unit could not be parsed * @throws IllegalArgumentException when a quantity with a unit could not be parsed */ @@ -201,7 +199,6 @@ public String toString() { * * @param value the non null value representing a quantity with an optional unit * @return a new {@link QuantityType} - * * @throws NumberFormatException when a quantity without a unit could not be parsed * @throws IllegalArgumentException when a quantity with a unit could not be parsed */