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

Underline Syntax Errors #3700

Merged
merged 12 commits into from
Dec 19, 2024
Merged

Conversation

volodya-lombrozo
Copy link
Member

In this PR I've made several useful tweaks:

  1. Added the posibility to check error messages in unit tests
  2. Udded UnderlinedMessage class that underlines syntax errors (tests provide examples)

It's only the first step to make error messages readable (the future steps are described in the new puzzles)

Related to #3332.

@volodya-lombrozo
Copy link
Member Author

@yegor256 Could you have a look, please?

@yegor256
Copy link
Member

@volodya-lombrozo the build is not clean yet, can you take a look?

@yegor256
Copy link
Member

@maxonfjvipon please, check this one


/**
* Test case for {@link UnderlinedMessage}.
* @since 0.1
Copy link
Member

Choose a reason for hiding this comment

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

@volodya-lombrozo let's make it @since 0.50

* tests pass.
* @return Test cases.
*/
static Stream<Arguments> examples() {
Copy link
Member

Choose a reason for hiding this comment

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

@volodya-lombrozo can the method be private?

Copy link
Member

@maxonfjvipon maxonfjvipon left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@yegor256 yegor256 left a comment

Choose a reason for hiding this comment

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

@volodya-lombrozo very good contribution! a few comments above though

// @checkstyle MethodBodyCommentsCheck (20 lines)
// @todo #3332:30min Add more specific error messages.
// Currently we write just "error: no viable alternative at input" for all errors.
// It's better to use {@link #recognizer} to get more specific error messages.
Copy link
Member

Choose a reason for hiding this comment

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

@volodya-lombrozo who is #recognizer? If I would be the resolver of this puzzle, I would be very puzzled.


/**
* Underlined message.
* For example, if you have a message "Problem is here" and you want to underline
Copy link
Member

Choose a reason for hiding this comment

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

@volodya-lombrozo check this out: https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html This is basically HTML. It's a good practice to use <p> tags for paragraphs.

@volodya-lombrozo
Copy link
Member Author

@yegor256 Could you have a look one more time, please?

@yegor256 yegor256 merged commit 32d00ed into objectionary:master Dec 19, 2024
20 checks passed
@yegor256
Copy link
Member

@volodya-lombrozo thanks a lot, this is helpful!

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.

3 participants