Add compilation errors & SAT GitHub annotations (#2543)

Signed-off-by: Yannick Schaus <github@schaus.net>
This commit is contained in:
Yannick Schaus 2021-11-13 22:13:28 +01:00 committed by GitHub
parent 917e268e68
commit d4f62ed024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 16 deletions

21
.github/openhab-compile-problems.json vendored Normal file
View File

@ -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
}
]
}
]
}

View File

@ -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

View File

@ -28,10 +28,10 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
@NonNullByDefault
public abstract class ModbusSlaveErrorResponseException extends ModbusTransportException {
private static final Map<Integer, KnownExceptionCode> exceptionCodesIndex = new HashMap<>(10);
private static final Map<Integer, KnownExceptionCode> 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 abstract class ModbusSlaveErrorResponseException extends ModbusTransportE
}
public static Optional<KnownExceptionCode> tryFromExceptionCode(int exceptionCode) {
return Optional.ofNullable(exceptionCodesIndex.get(exceptionCode));
return Optional.ofNullable(EXCEPTION_CODES_INDEX.get(exceptionCode));
}
}

View File

@ -65,8 +65,9 @@ public class ByteArrayFileCache {
* 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());

View File

@ -61,7 +61,6 @@ public class DecimalType extends Number implements PrimitiveType, State, Command
* 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 class DecimalType extends Number implements PrimitiveType, State, Command
*
* @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 class DecimalType extends Number implements PrimitiveType, State, Command
*
* @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) {

View File

@ -45,7 +45,6 @@ public class PercentType extends DecimalType {
* 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 class PercentType extends DecimalType {
* 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 class PercentType extends DecimalType {
*
* @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 class PercentType extends DecimalType {
* 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 @@ public class PercentType extends DecimalType {
*
* @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
*/

View File

@ -99,7 +99,6 @@ public class QuantityType<T extends Quantity<T>> extends Number
* 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 class QuantityType<T extends Quantity<T>> extends Number
*
* @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 class QuantityType<T extends Quantity<T>> extends Number
*
* @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
*/