-
Notifications
You must be signed in to change notification settings - Fork 5
Cluster haskell syntax errors using regex #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: commonerrors
Are you sure you want to change the base?
Conversation
C8R15T14N
commented
Apr 21, 2025
- New testtypes "Haskell Syntax Test" and "Haskell Runtime Test"
- Haskell Syntax Test: ready to use. Clusters syntax errors of haskell submissions using a regex-based approach.
- Haskell Runtime Test: not yet implemented (is currently very similar to the already implemented DockerTest)
- implementation missing, marked with TODO@CHW and will be similar as in docker test
- extends DockerTest
- view: HaskellRuntimeTestManagerView (based on DockerTestManagerOverView) - controller: HaskellRuntimeTestManager (based on DockerTestManager)
Conflicts during rebase: src/main/java/de/tuclausthal/submissioninterface/persistence/dao/TestDAOIf.java src/main/java/de/tuclausthal/submissioninterface/persistence/dao/impl/TestDAO.java src/main/java/de/tuclausthal/submissioninterface/servlets/controller/TestManager.java
…r than the first error message
.../de/tuclausthal/submissioninterface/servlets/view/fragments/ShowHaskellSyntaxTestResult.java
Outdated
Show resolved
Hide resolved
Wouldn't an extension/property to the DockerTest be a better approach to not duplicate a lot of code? |
- DockerTestManager now also handles case of HaskellRuntimeTest (since HaskellRuntimeTest is a specialization of DockerTest) - HaskellRuntimeTestManager is kept for consistency (it is the corresponding controller servlet of HaskellRuntimeTestManagerView)
Regarding the Haskell Runtime Test:
|
…les for HaskellSyntaxTest
Regarding the Haskell Syntax Test: HaskellSyntaxTest now extends the a modularaized version of DockerTest and thereby uses already defined functions hopefully this will reduce code duplicates. |
I was curious whether a new attribute for the dockertest may already solve the issue. Such attribute could later also be used to selected different images. |
We decided to implement the
|
Please make sure all files have a new line at the end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this is fine for the prototype. Please use final as much as possible.
|
||
public RegexBasedHaskellClustering(Session session) { | ||
this.session = session; | ||
this.clusters = new LinkedHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this be done in a static way?
|
||
@Override | ||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { | ||
getServletContext().getNamedDispatcher(DockerTestManager.class.getSimpleName()).forward(request, response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to be good style to just forward the calls to the DockerTestManager, i.e. this servlet is not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having different views for the HaskellTest is okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to be good style to just forward the calls to the DockerTestManager, i.e. this servlet is not necessary.
The HaskellRuntimeTestManager
controller servlet requires some additional functionality that is not contained in the DockerTestManager
controller servlet (this is still work in progress). My idea was to handle all actions that are specific to the haskell runtime test inside of the HaskellRuntimeTestManager
, and forward all other calls to the DockerTestManager
.
As an example, I just implemented a new "generateNewTestSteps" action inside the HaskellRuntimeTestManager
, that automatically generates a certain number of haskell runtime testcases. All other actions are forwarded to the DockerTestManager
(see new commit 402f094).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it should be added as soon as it is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it should be added as soon as it is required.
My choice of words may have been misleading - by saying "as an example", I didn’t mean that the "generateNewTestSteps"
action is optional or merely illustrative for my idea. It is definitely required, since automatically generating haskell testcases is a major part of my bachelor thesis.
What I meant is that I expect to add more actions in the future that follow the same pattern - in that sense, "generateNewTestSteps"
serves "as an example" for them.
src/main/java/de/tuclausthal/submissioninterface/servlets/controller/TestManager.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tuclausthal/submissioninterface/servlets/view/PerformTestResultView.java
Outdated
Show resolved
Hide resolved
JsonObject testOutputJson = Json.createReader(new StringReader(testResult.getTestOutput())).readObject(); | ||
String stderr = testOutputJson.containsKey("stderr") ? testOutputJson.getString("stderr") : ""; | ||
|
||
String keyStr = "HaskellSyntax: "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the "Haskell" prefix really needed?
|
||
import de.tuclausthal.submissioninterface.persistence.datamodel.TestResult; | ||
|
||
public interface HaskellErrorClassifierIf { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats is the advantage of this interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to have more Classes for a Static code analysis e.g. k-means or clustering by AST but by doing the clustering statically right now the interface is obsolete
private Path tempDir; | ||
protected static final Random random = new Random(); | ||
protected final String separator; | ||
protected Path tempDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protected allows more than you think, i.e. protected allows field access from within the same package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't had that on mind. Thank you for the hint. I fixed it in the upcoming version
return testCode.toString(); | ||
} | ||
|
||
protected void debugLog(List<String> params, Path studentDir){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this method necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a way to modulize the logging for individual logging messages in subclasses but it is currently not in use so I will remove it
- the generator is still under development - added a placeholder instead
response.sendRedirect(Util.generateRedirectURL(TaskManager.class.getSimpleName() | ||
+ "?action=editTask&lecture=" + task.getTaskGroup().getLecture().getId() | ||
+ "&taskid=" + task.getTaskid(), response)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are lecture, taskid and testid necessary?
src/main/java/de/tuclausthal/submissioninterface/persistence/datamodel/HaskellSyntaxTest.java
Outdated
Show resolved
Hide resolved
Overall the formatting is not correct, also the order of imports. |
|
||
public HaskellSyntaxTest(de.tuclausthal.submissioninterface.persistence.datamodel.HaskellSyntaxTest test) { | ||
super(test); | ||
separator = "#<GATE@" + random.nextLong() + "#@>#"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why necessary?
set -e | ||
echo '%s' | ||
for file in *.hs; do | ||
ghci -ignore-dot-ghci -v0 -ferror-spans -fdiagnostics-color=never -Wall -e ":load $file" -e ":quit" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this properly escaped?
return entry.getKey(); | ||
} | ||
} | ||
return "Sonstige Fehler"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo?
There are warnings in the project. |