From 5cf04a979ac00ef4571f2972e333976f60324d0e Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 27 Jan 2021 20:49:33 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Checkstyle=20f=C3=BCr=20Maven=20konfigurier?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 20 +++++++++++++++++++ .../typicalc/model/step/InferenceStep.java | 13 ++++++++++++ ...checkstyle_typicalc.xml => checkstyle.xml} | 0 3 files changed, 33 insertions(+) rename src/test/resources/{checkstyle_typicalc.xml => checkstyle.xml} (100%) diff --git a/pom.xml b/pom.xml index f68615b..c91e15a 100644 --- a/pom.xml +++ b/pom.xml @@ -155,6 +155,26 @@ maven-surefire-plugin 2.22.2 + + + maven-checkstyle-plugin + 3.1.1 + + ${project.build.directory}/../src/test/resources/checkstyle.xml + true + true + ${project.build.directory}/../src/main/java + + + + validate + validate + + check + + + + diff --git a/src/main/java/edu/kit/typicalc/model/step/InferenceStep.java b/src/main/java/edu/kit/typicalc/model/step/InferenceStep.java index 488437e..be0ea21 100644 --- a/src/main/java/edu/kit/typicalc/model/step/InferenceStep.java +++ b/src/main/java/edu/kit/typicalc/model/step/InferenceStep.java @@ -1,7 +1,11 @@ package edu.kit.typicalc.model.step; import edu.kit.typicalc.model.Conclusion; +<<<<<<< HEAD import edu.kit.typicalc.model.Constraint; +======= + +>>>>>>> 0f6c701 (Checkstyle für Maven konfiguriert) /** * Models one step of the inference tree. * Depending on the inference rule that is applied in a step, @@ -46,4 +50,13 @@ public abstract class InferenceStep { * @param stepVisitor the visitor that wants to visit this object */ public abstract void accept(StepVisitor stepVisitor); +<<<<<<< HEAD } +======= + + public Conclusion getConclusion() { + return null; // TODO + } + +} +>>>>>>> 0f6c701 (Checkstyle für Maven konfiguriert) diff --git a/src/test/resources/checkstyle_typicalc.xml b/src/test/resources/checkstyle.xml similarity index 100% rename from src/test/resources/checkstyle_typicalc.xml rename to src/test/resources/checkstyle.xml From 15134d544ddd47f2e34f47da52cfa82851934f35 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 27 Jan 2021 20:53:33 +0100 Subject: [PATCH 2/3] CI: Checkstyle --- .gitlab-ci.yml | 1 + pom.xml | 13 ++----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 031bafc..1f58140 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,4 @@ build: script: + - mvn -Dmaven.repo.local=/tmp/m2/repository -Duser.home=/tmp checkstyle:check - mvn -Dmaven.repo.local=/tmp/m2/repository -Duser.home=/tmp test diff --git a/pom.xml b/pom.xml index c91e15a..b435ef6 100644 --- a/pom.xml +++ b/pom.xml @@ -161,19 +161,10 @@ 3.1.1 ${project.build.directory}/../src/test/resources/checkstyle.xml - true - true + true + warning ${project.build.directory}/../src/main/java - - - validate - validate - - check - - - From cf00fb803b84283f29947fcb72c7c08d8acad4e3 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 27 Jan 2021 21:01:41 +0100 Subject: [PATCH 3/3] Checkstyle-Fehler behoben --- pom.xml | 1 - .../edu/kit/typicalc/model/parser/LambdaLexer.java | 2 +- .../kit/typicalc/model/parser/LambdaParser.java | 8 ++++---- .../java/edu/kit/typicalc/model/term/VarTerm.java | 8 ++++++-- .../kit/typicalc/view/TypicalcI18NProvider.java | 14 +++++++------- src/main/resources/application.properties | 2 -- src/test/resources/checkstyle.xml | 6 +++--- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index b435ef6..5630b1d 100644 --- a/pom.xml +++ b/pom.xml @@ -163,7 +163,6 @@ ${project.build.directory}/../src/test/resources/checkstyle.xml true warning - ${project.build.directory}/../src/main/java diff --git a/src/main/java/edu/kit/typicalc/model/parser/LambdaLexer.java b/src/main/java/edu/kit/typicalc/model/parser/LambdaLexer.java index 252c167..b2a6401 100644 --- a/src/main/java/edu/kit/typicalc/model/parser/LambdaLexer.java +++ b/src/main/java/edu/kit/typicalc/model/parser/LambdaLexer.java @@ -66,7 +66,7 @@ public class LambdaLexer { return new Result<>(t); case '\\': case 'λ': - t = new Token(TokenType.LAMBDA, c+"", pos); + t = new Token(TokenType.LAMBDA, c + "", pos); advance(); return new Result<>(t); default: diff --git a/src/main/java/edu/kit/typicalc/model/parser/LambdaParser.java b/src/main/java/edu/kit/typicalc/model/parser/LambdaParser.java index 2625ec9..e6a8924 100644 --- a/src/main/java/edu/kit/typicalc/model/parser/LambdaParser.java +++ b/src/main/java/edu/kit/typicalc/model/parser/LambdaParser.java @@ -27,7 +27,7 @@ public class LambdaParser { */ private Token token; - private static final Set atomStartTokens + private static final Set ATOM_START_TOKENS = EnumSet.of(TokenType.VARIABLE, TokenType.NUMBER, TokenType.TRUE, TokenType.FALSE, TokenType.LP); @@ -97,11 +97,11 @@ public class LambdaParser { nextToken(); Result var = parseVar(); if (!expect(TokenType.DOT)) { - // TODO + return new Result<>(null, ParseError.UNEXPECTED_TOKEN); } Result body = parseTerm(); // TODO: Fehlerbehandlung - return new Result(new AbsTerm(var.unwrap(), body.unwrap())); + return new Result<>(new AbsTerm(var.unwrap(), body.unwrap())); } /** @@ -110,7 +110,7 @@ public class LambdaParser { */ private Result parseApplication() { LambdaTerm left = parseAtom().unwrap(); // TODO: Fehlerbehandlung - while (atomStartTokens.contains(token.getType())) { + while (ATOM_START_TOKENS.contains(token.getType())) { LambdaTerm atom = parseAtom().unwrap(); // TODO: Fehlerbehandlung left = new AppTerm(left, atom); } diff --git a/src/main/java/edu/kit/typicalc/model/term/VarTerm.java b/src/main/java/edu/kit/typicalc/model/term/VarTerm.java index e803363..fa67492 100644 --- a/src/main/java/edu/kit/typicalc/model/term/VarTerm.java +++ b/src/main/java/edu/kit/typicalc/model/term/VarTerm.java @@ -12,8 +12,12 @@ public class VarTerm extends LambdaTerm { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } VarTerm varTerm = (VarTerm) o; return Objects.equals(name, varTerm.name); } diff --git a/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java b/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java index 57b939e..adf0db2 100644 --- a/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java +++ b/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java @@ -12,13 +12,13 @@ import com.vaadin.flow.i18n.I18NProvider; @Component /** - * Provides a simple implementation of the I18NProvider. + * Provides a simple implementation of the I18NProvider. * Allows for multiple languages and retrieving static Strings from .property-files. */ public class TypicalcI18NProvider implements I18NProvider { - + private static final long serialVersionUID = 8261479587838699070L; - + /** * Prefix of all .property-files */ @@ -31,12 +31,12 @@ public class TypicalcI18NProvider implements I18NProvider { @Override public String getTranslation(String key, Locale locale, Object... params) { - if(key == null) { + if (key == null) { return StringUtils.EMPTY; } - + String translation; - + try { final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_PREFIX, locale); translation = bundle.getString(key); @@ -44,7 +44,7 @@ public class TypicalcI18NProvider implements I18NProvider { throw new IllegalStateException("this should never happen:" + " either an invalid locale is set or an invalid key is provided."); } - + return translation; } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d579d9e..b5da9ee 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -2,6 +2,4 @@ server.port=${PORT:8080} logging.level.org.atmosphere = warn spring.mustache.check-template-location = false -# To improve the performance during development. -# For more information https://vaadin.com/docs/flow/spring/tutorial-spring-configuration.html#special-configuration-parameters # vaadin.whitelisted-packages= org/vaadin/example diff --git a/src/test/resources/checkstyle.xml b/src/test/resources/checkstyle.xml index eeb91a6..3a97f7e 100644 --- a/src/test/resources/checkstyle.xml +++ b/src/test/resources/checkstyle.xml @@ -10,14 +10,15 @@ - property name="allowUndeclaredRTE" value="true"/--> - property name="suppressLoadErrors" value="true"/--> + + + @@ -27,7 +28,6 @@ -