Skip to content
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

Fix #537 - support warnings that span multiple lines in standalone compiler #543

Merged
merged 23 commits into from
Oct 19, 2021

Conversation

oowekyala
Copy link
Collaborator

@oowekyala oowekyala commented Sep 27, 2021

This also adds tests for the way the standalone compiler formats messages. (that required changes in CI files, there's a new workflow standalone-lfc-tests)

This is a sample multiline warning:


lfc: error: Reactor must be named.
--> test/resources/org/lflang/lfc/tests/multilineWarning.lf:3:1
  |
2 |
  | >>>>>>>>>>>>>>
3 | reactor {
4 |
5 | }
  | <<<<<<<<<<<<<< Reactor must be named.

If the block is too long it's shortened with ...

Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice feature! It's also a great step forward to have tests for this. The only thing I worry about is the reporting to CodeCov. What I expect to happen is that whichever job finishes last will report it's coverage as overall coverage. I might be wrong, because I'm not completely sure how this works, but we should be on the look out for this...

.github/workflows/build.yml Outdated Show resolved Hide resolved
org.lflang.lfc/src/org/lflang/lfc/LFStandaloneModule.java Outdated Show resolved Hide resolved
@lhstrh lhstrh self-requested a review September 27, 2021 16:40
@lhstrh
Copy link
Member

lhstrh commented Sep 27, 2021

There's also this issue: #336

@lhstrh
Copy link
Member

lhstrh commented Sep 27, 2021

Why don't we make the tests you added part of the compiler tests? Is it because of Kotlin? We should really find a way to calculate code coverage over the entire code base...

@lhstrh
Copy link
Member

lhstrh commented Sep 27, 2021

Maybe this helps? https://docs.codecov.com/docs/merging-reports

@lhstrh
Copy link
Member

lhstrh commented Sep 27, 2021

Judging by what is described there, reporting is incremental by default, so it might actually just work the way you were doing it initially... Let's just give it a shot and see what happens?

@oowekyala
Copy link
Collaborator Author

@lhstrh Our codecov integration looks broken anyway, this should probably be the focus of another fix PR.

Maybe this data is private and I need to log in?

Here's an error in the latest successful build on master.

@lhstrh
Copy link
Member

lhstrh commented Sep 28, 2021

RE: CodeCov: The move from the icyphy to lf-lang org required some configuration changes, but those changes didn't solve the underlying issue that apparently the reporting had been broken for quite a while already; still troubleshooting.

Copy link
Collaborator

@cmnrd cmnrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! Thanks for taking care of this and also adding tests.

Why don't we make the tests you added part of the compiler tests? Is it because of Kotlin? We should really find a way to calculate code coverage over the entire code base...

I think it is a good idea to keep tests close to the source code. I am not sure how this is commonly handled in Java projetcs, but in Python projects it's quite common to have tests in every package. The tests here test lfc's ability to produce correctly formatted error messages. This shouldn't be a concern relevant to any other package.

Also, we need to be careful about dependencies here. Adding dependencies to Kotlin code from projects that we can compile from Eclipse will cause trouble. The org.lflang.lfc project is currently not even visible to our developer Eclipse.

@@ -61,7 +61,7 @@
private static String MAIN_PATH_IN_JAR = String.join("/",
new String[] {"!", "org", "lflang", "lfc", "Main.class"});


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lhstrh We really need to decide on a formatter and consistent style that we use across IDEs. All these formatting changes make it really hard to review things

@oowekyala
Copy link
Collaborator Author

I think it is a good idea to keep tests close to the source code. I am not sure how this is commonly handled in Java projetcs, but in Python projects it's quite common to have tests in every package. The tests here test lfc's ability to produce correctly formatted error messages. This shouldn't be a concern relevant to any other package.

I fully agree. The typical gradle setup is that each subproject has both main and test sources (like here for the submodule org.lflang.lfc, but with different path conventions). Having all tests in a separate subproject is really an xtext idiosyncrasy.

@codecov
Copy link

codecov bot commented Sep 29, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@4b514c7). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #543   +/-   ##
=========================================
  Coverage          ?   66.39%           
  Complexity        ?     3465           
=========================================
  Files             ?      132           
  Lines             ?    22321           
  Branches          ?     2886           
=========================================
  Hits              ?    14819           
  Misses            ?     6354           
  Partials          ?     1148           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b514c7...7673a77. Read the comment docs.

@lhstrh
Copy link
Member

lhstrh commented Sep 29, 2021

Looks like the stack trace option kills code coverage?

@oowekyala
Copy link
Collaborator Author

Looks like the stack trace option kills code coverage?

I'm not sure what you mean, but I think the reason we got a coverage report is that that commit is the first to this branch since your changes to code coverage reporting on master. I don't think it's related to the stack trace option itself

@lhstrh
Copy link
Member

lhstrh commented Sep 29, 2021

Yes, you're right. What about the test failures in the standalone tests though?

Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the test failure that are still there, this looks good!

@oowekyala
Copy link
Collaborator Author

Yes, you're right. What about the test failures in the standalone tests though?

It seems to be failing only on windows, I'll need some time to reproduce it :'(

@lhstrh
Copy link
Member

lhstrh commented Oct 16, 2021

Looks like this Windows failure is the only thing holding us back from merging this. Any progress on this issue?

@oowekyala
Copy link
Collaborator Author

I think this is done, I'm going to merge it

@lhstrh lhstrh merged commit 437e0f9 into master Oct 19, 2021
@lhstrh lhstrh deleted the issue537-multiline-warnings branch October 19, 2021 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatting Multiline Errors/Warnings StringIndexOutOfBoundsException when reporting error
3 participants