-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Changed parsing library to flexmark #245
Changed parsing library to flexmark #245
Conversation
it would be really great If one of you can take a look at this PR. We would really like to include it in release 0.4.1 - #231 (comment) |
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.
Thanks, I added some minor comments looks better great that so much code could be removed :-)
custom-checks/checkstyle/pom.xml
Outdated
<artifactId>commonmark</artifactId> | ||
<version>${commonmark.version}</version> | ||
</dependency> | ||
<dependency> |
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.
Please format consistently it looks like a mixture of tabs and spaces.
@@ -251,16 +250,16 @@ protected void logMessage(String filePath, int line, String fileName, String mes | |||
fireErrors(filePath); | |||
dispatcher.fireFileFinished(filePath); | |||
} | |||
|
|||
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 would you add this whitespace?
@@ -51,6 +44,7 @@ | |||
* info</a> | |||
* | |||
* @author Erdoan Hadzhiyusein - Initial contribution | |||
* @author Lyubomir Papazov - Change the Markdown parser to flexmark |
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 author-tags and signed off seem inconsistent
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.
Yes, actually @lpapazow did the changes on the checks and he's the rightful author. He's been working on a new binding and he hasn't had time to update this PR. Because of #244 , we decided that it would be a good idea to include this check in the new release, so I added a new test and fixed some comments from @dstivanov.
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.
AFAIK the also-by should then be added to the commit message, see https://docs.openhab.org/developers/contributing/contributing.html#sign-your-work
|
||
MutableDataSet options = new MutableDataSet(); | ||
//By setting this option to true, the parser provides line numbers in the original markdown text for each node | ||
options.set(Parser.TRACK_DOCUMENT_LINES, true); |
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.
Hooray, so we do loose some of that flaky code
// The code block is not the first line, and the previous line is not empty | ||
if (zeroBasedStartLineNumber == 0 || !StringUtils.isBlank(fileText.get(zeroBasedStartLineNumber - 1))) { | ||
// log the one-based line number | ||
callback.log(zeroBasedStartLineNumber + 1, EMPTY_LINE_BEFORE_CODE_MSG); |
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 don't know whether you control the callback, but maybe you should do the adding of one there, it's too easy to forget one.
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.
Great idea! Thanks!
@@ -66,7 +69,7 @@ public void testSpecialHeader() throws Exception { | |||
|
|||
@Test | |||
public void testEmptyLineBeforeList() throws Exception { | |||
String[] expectedMessages = generateExpectedMessages(1, "The line before a Markdown list must be empty."); | |||
String[] expectedMessages = generateExpectedMessages(2, "The line before a Markdown list must be empty."); |
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 do only some of the linenumbers change is that a bug or a feature?
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.
It is not a bug. After changing the parsing library and adding more tests, the logging in some cases seemed inconsistent, so we changed where the warning message should be placed.
Signed-off-by: Kristina S. Simova <kssimovaa@gmail.com>
18bb0e4
to
755071c
Compare
LGTM |
Included in 0.4.1. |
Fix for issues #205 and #244
Signed-off-by: Kristina S. Simova kssimovaa@gmail.com