Skip to content

Conversation

@Marat-Tim
Copy link
Contributor

@Marat-Tim Marat-Tim commented Apr 23, 2025

In this pull request, I propose to solve the problem of verifying the validity of comments from the markdown point of view by connecting the markdownlint tool and creating a bridge between java and javascript. Although the running time is very long, it seems to me that this is the best option, since we cannot write and maintain our own library for checking markdown. Also, using outdated tools like oxygenxml doesn't sound good either. Using a bridge between java and javascript will allow us to use the supported markdownlint library as well as the ability to run other js tools in our code.

Summary by CodeRabbit

  • New Features

    • Introduced a lint check to validate EO code comments against markdownlint rules, providing warnings for non-compliant Markdown in comments.
    • Added integration with markdownlint via GraalVM and Node.js, automating setup and linting as part of the build process.
    • Automated installation of Node.js and npm, and JavaScript resource management during the build.
  • Documentation

    • Added user documentation explaining the new markdownlint-based comment validation, with examples of violations and corrections.
  • Tests

    • Added tests to verify detection of markdownlint violations and acceptance of valid comments.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 23, 2025

🚀 Performance Analysis

All benchmarks are within the acceptable range. No critical degradation detected (threshold is 100%). Please refer to the detailed report for more information.

Click to see the detailed report
Test Base Score PR Score Change % Change Unit Mode
benchmarks.SourceBench.scansXmir (size=S) 6229.963 6217.954 -12.009 -0.19% ms/op Average Time
benchmarks.SourceBench.scansXmir (size=M) 6902.263 6894.308 -7.955 -0.12% ms/op Average Time
benchmarks.SourceBench.scansXmir (size=L) 7793.636 7906.210 112.574 1.44% ms/op Average Time
benchmarks.SourceBench.scansXmir (size=XL) 9424.238 9292.736 -131.502 -1.40% ms/op Average Time
benchmarks.SourceBench.scansXmir (size=XXL) 23135.485 22963.336 -172.149 -0.74% ms/op Average Time

✅ Performance gain: benchmarks.SourceBench.scansXmir (size=S) is faster by 12.009 ms/op (0.19%)
✅ Performance gain: benchmarks.SourceBench.scansXmir (size=M) is faster by 7.955 ms/op (0.12%)
⚠️ Performance loss: benchmarks.SourceBench.scansXmir (size=L) is slower by 112.574 ms/op (1.44%)
✅ Performance gain: benchmarks.SourceBench.scansXmir (size=XL) is faster by 131.502 ms/op (1.40%)
✅ Performance gain: benchmarks.SourceBench.scansXmir (size=XXL) is faster by 172.149 ms/op (0.74%)

@Marat-Tim
Copy link
Contributor Author

@yegor256

@yegor256
Copy link
Member

@h1alexbel can you please check this one?

Copy link
Member

@h1alexbel h1alexbel left a comment

Choose a reason for hiding this comment

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

@Marat-Tim looks like a good start! Take a look at my comments, please

pom.xml Outdated
</configuration>
</execution>
<execution>
<id>copy-js</id>
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's use javascript instead of js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@h1alexbel does this apply only to the maven id, or do I need to rename all js uses to javascript (for example, in folder names and comments)?

Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim all js -> javascript

* This lint works for multiple files, as creating a MarkdownLinter takes a very long time
* and creating it many times is a bad idea.
*
* @since 0.57.0
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's place a valid @since tag here

*/
private static final Set<String> IGNORED = Set.of(
"MD041",
"MD047",
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim can we enable MD047? It seems it does good service: https://github.com/DavidAnson/markdownlint/blob/main/doc/md047.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@h1alexbel do we want comments on objects to have an empty line at the end?

It will look like this

# Main object.
#
[] > foo

Is this exactly what we want? That's not how they write it in the EO code I've seen.

Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim indeed, you are right. We should ignore this rule


@Override
public String name() {
return "lt-markdown-only";
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's simplify the name to invalid-markdown-comment. Java class can be renamed to LtInvalidMarkdownComment

*
* @since 0.57.0
*/
final class LtMarkdownOnly implements Lint<Map<String, XML>> {
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim Do we need to analyze multiple programs in the scope to issue the defects? I think that single XMIR scope should be enough for this lint. So, we should implement Lint<XML> instead. Or I'm missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@h1alexbel I did this because it takes a lot of time to create a MarkdownLinter and it is very expensive to create it for each file. It is better to reuse it. We can require an instance of it in the class constructor and shift responsibility for its lifetime to the library user, but in my opinion this complicates our API

Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's document it in the JavaDoc then

*
* @since 0.57.0
*/
public interface MarkdownDefect {
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim why new class here? Maybe we can use Defect.Simple?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@h1alexbel I think not. Ideologically, Defect is an error in the eolang. But this class is an interop between the java class and the javascript class. I don't think it's worth mixing them up

Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim I think we just transferring them from markdownlint to the lints. Thats why its reasonable to use Defect.Simple and not overcomplicate the logic with new class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@h1alexbel no, this error appears due to the analysis of plain text (not XMIR). It has no severity, it has no name, it has no version and context. This is a completely different logical entity

Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim yes, but MarkdownDefect is used only as intermediate class. Eventually, in the lint you map MarkdownDefect into Defect.Simple. Seems to be redundant to me. Can we directly produce Defect.Simple without mapping?

Copy link
Contributor Author

@Marat-Tim Marat-Tim Apr 24, 2025

Choose a reason for hiding this comment

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

@h1alexbel Are you suggesting that the MarkdownLinter class returns a Stream<Defect.Default>? Then what should I specify in values that are not present in the context of markdownlint (such as severity, version, context, and others)? Should I specify null there?

Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim severity is the same you specify here (WARNING):

defect -> new Defect.Default(
    ...
    Severity.WARNING,
    ...
)

Context can be empty in Defect.Default (see the ctor without context param). About version - you should not set it, it will be automatically resolved in the .version() method of the Defect's implementation.

You can omit other parameters: line and program , while creating them in MarkdownLinter. You should be able to create new defect without those parameters in MarkdownLinter first, and then, in LtInvalidMarkdownComment create Defect with those parameters being set.

All in all, my point is that instead of MarkdownDefect, we can use Defect.Simple in two-steps, but probably we should extend Defect.Simple ctors. WDYT?


Comments in the code must be checked for correctness from the point of view of
[markdownlint](https://github.com/DavidAnson/markdownlint)
(excluding rules
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim its good to mention rules we exclude. However, its better to move this text at the bottom of motive

[MD026](https://github.com/DavidAnson/markdownlint/blob/main/doc/md026.md)
)

Incorrect:
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's add an output, that mdlint will give us for "incorrect" EO snippet

Incorrect:

```eo
# # Main object.
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim to be honest, its not really catchy example of "incorrect" code. Let's use different example to demonstrate that markdown comments are broken. How about this:

# * Item 1
#  * Nested Item 1
#  * Nested Item 2
#   * A misaligned item
[] > foo

This is the violation of MD005

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@h1alexbel This seems to be a problem, in the xmir of this program, such a comment looks like this

<comments>
    <comment line="5">* Item 1\n* Nested Item 1\n* Nested Item 2\n* A misaligned item</comment>
</comments>

/**
* Test for {@link LtMarkdownOnly}.
*
* @since 0.57.0
Copy link
Member

@h1alexbel h1alexbel Apr 24, 2025

Choose a reason for hiding this comment

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

@Marat-Tim let's place a valid @since tag here

@h1alexbel
Copy link
Member

@Marat-Tim also, when you create PR to "close" some issue, mention it in the PR description, please

@Marat-Tim Marat-Tim changed the title markdownlint for check comments feat(#15): markdownlint for check comments Apr 24, 2025
@Marat-Tim Marat-Tim requested a review from h1alexbel April 24, 2025 15:54
@Marat-Tim
Copy link
Contributor Author

@h1alexbel I've corrected all the comments except deleting MarkdownDefect.

Can you clarify exactly whether it needs to be replaced with Defect.Default? And if so, what values should I put in the severity, program, and version fields? Should I set them to null?

Copy link
Member

@h1alexbel h1alexbel left a comment

Choose a reason for hiding this comment

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

@Marat-Tim please check my comments

<version>9.8</version>
<scope>test</scope>
</dependency>
<dependency>
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's move these dependencies upper, before test scope libraries

*
* @since 0.57.0
*/
public interface MarkdownDefect {
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim severity is the same you specify here (WARNING):

defect -> new Defect.Default(
    ...
    Severity.WARNING,
    ...
)

Context can be empty in Defect.Default (see the ctor without context param). About version - you should not set it, it will be automatically resolved in the .version() method of the Defect's implementation.

You can omit other parameters: line and program , while creating them in MarkdownLinter. You should be able to create new defect without those parameters in MarkdownLinter first, and then, in LtInvalidMarkdownComment create Defect with those parameters being set.

All in all, my point is that instead of MarkdownDefect, we can use Defect.Simple in two-steps, but probably we should extend Defect.Simple ctors. WDYT?

@Marat-Tim
Copy link
Contributor Author

@h1alexbel Is using null in such a context acceptable? Of course, we can replace it with empty strings, but still, if someone uses this data, they will get a strange result

final String rule, final Severity severity,
final int line, final String text
) {
this(rule, severity, null, line, text);
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim bad idea to use NULL. Let's use empty string. Also, read this: https://www.yegor256.com/2014/05/13/why-null-is-bad.html

Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim Let's make this ctor private for end-users as well

*
* @since 0.0.47
*/
public final class MarkdownLinter implements Closeable {
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's make this class package-private

this.context.close();
}

private static String getName(final Value names) {
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's add JavaDoc here

* SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
* SPDX-License-Identifier: MIT
*/

Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's remove empty line here

* SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
* SPDX-License-Identifier: MIT
*/

Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's remove empty line here

@@ -0,0 +1,17 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

@Marat-Tim let's add puzzle to integrate eslint into repository

@Marat-Tim Marat-Tim requested a review from h1alexbel May 1, 2025 15:15
Copy link
Member

@h1alexbel h1alexbel left a comment

Choose a reason for hiding this comment

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

@Marat-Tim I think these comments are last

}

/**
* Get the first name starting with MD from the name array.
Copy link
Member

@h1alexbel h1alexbel May 2, 2025

Choose a reason for hiding this comment

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

@Marat-Tim let's update JavaDoc as well, in order to get rid of "Get first name...". Can be simplified just to "MD rule"

@Marat-Tim Marat-Tim requested a review from h1alexbel May 3, 2025 13:43
Copy link
Member

@h1alexbel h1alexbel left a comment

Choose a reason for hiding this comment

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

@Marat-Tim LGTM

@h1alexbel
Copy link
Member

@yegor256 take a look, please

@coderabbitai
Copy link

coderabbitai bot commented Jul 7, 2025

Walkthrough

This change introduces automated Markdown linting for EO language comments using markdownlint via GraalVM JavaScript integration. It adds new Java classes for linting, updates Maven and JavaScript build configurations to support Node.js and markdownlint, provides documentation and tests for the new lint rule, and integrates the check into the existing lint workflow.

Changes

File(s) Change Summary
pom.xml Added GraalVM JS dependencies and frontend-maven-plugin for Node.js/npm and markdownlint setup.
src/main/java/org/eolang/lints/Defect.java Added a new constructor to Defect.Default for simplified defect creation.
src/main/java/org/eolang/lints/LtInvalidMarkdownComment.java Introduced new lint class for validating EO comments with markdownlint.
src/main/java/org/eolang/lints/MarkdownLinter.java Added class to run markdownlint via GraalVM JS and convert results to defects.
src/main/java/org/eolang/lints/WpaLints.java Registered the new markdown comment lint in the WPA lints collection.
src/main/javascript/markdownlint.js Added JS module exposing a global lint function using markdownlint.
src/main/javascript/package.json, src/main/javascript/webpack.config.js Added JS project metadata, dependencies, and Webpack config for bundling markdownlint.
src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md Added documentation and examples for the new markdown comment lint rule.
src/test/java/org/eolang/lints/LtInvalidMarkdownCommentTest.java Added tests verifying detection of markdownlint violations and valid comments in EO sources.

Sequence Diagram(s)

sequenceDiagram
    participant EOFile as EO XML File(s)
    participant LtInvalidMarkdownComment as LtInvalidMarkdownComment
    participant MarkdownLinter as MarkdownLinter (GraalVM JS)
    participant JS as markdownlint.js

    EOFile->>LtInvalidMarkdownComment: Provide XML with comments
    LtInvalidMarkdownComment->>MarkdownLinter: Initialize linter
    loop For each comment in all files
        LtInvalidMarkdownComment->>MarkdownLinter: defects(comment text)
        MarkdownLinter->>JS: lint(comment text)
        JS-->>MarkdownLinter: Linting results (violations)
        MarkdownLinter-->>LtInvalidMarkdownComment: Defect(s) for violations
    end
    LtInvalidMarkdownComment-->>EOFile: Collected defects for all comments
Loading

Suggested reviewers

  • h1alexbel
  • yegor256

Poem

In burrows deep, the rabbits code,
With markdown rules now in their load.
Comments checked, each heading neat,
Linting magic—what a treat!
GraalVM hops in, JavaScript too,
Clean docs and carrots—thanks to you!
🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/test/java/org/eolang/lints/LtInvalidMarkdownCommentTest.java (1)

60-61: Fix assertion message to match test intent.

The assertion message is misleading for this test case which expects no violations.

-            "markdownlint found violation of its rules in comments",
+            "markdownlint should not find violations in correct markdown comments",
src/main/java/org/eolang/lints/LtInvalidMarkdownComment.java (1)

30-37: Document why these markdownlint rules are ignored.

Add documentation explaining the rationale for ignoring these specific rules.

     /**
      * Markdownlint rule names to ignore.
+     * MD041: First line in file should be a top level heading (not applicable to comments)
+     * MD047: Files should end with a single newline character (not applicable to comments)
+     * MD026: Trailing punctuation in heading (too restrictive for comments)
      */
     private static final Set<String> IGNORED = Set.of(
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a4db4e and c6bddc9.

📒 Files selected for processing (10)
  • pom.xml (2 hunks)
  • src/main/java/org/eolang/lints/Defect.java (1 hunks)
  • src/main/java/org/eolang/lints/LtInvalidMarkdownComment.java (1 hunks)
  • src/main/java/org/eolang/lints/MarkdownLinter.java (1 hunks)
  • src/main/java/org/eolang/lints/WpaLints.java (1 hunks)
  • src/main/javascript/markdownlint.js (1 hunks)
  • src/main/javascript/package.json (1 hunks)
  • src/main/javascript/webpack.config.js (1 hunks)
  • src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md (1 hunks)
  • src/test/java/org/eolang/lints/LtInvalidMarkdownCommentTest.java (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/test/java/org/eolang/lints/LtInvalidMarkdownCommentTest.java (1)
src/test/java/matchers/DefectMatcher.java (1)
  • DefectMatcher (20-51)
🔇 Additional comments (11)
src/main/java/org/eolang/lints/WpaLints.java (1)

29-30: LGTM! Clean integration following existing patterns.

The addition of LtInvalidMarkdownComment to the lint list follows the established pattern and correctly integrates the new markdown comment validation into the WPA linting framework.

src/main/javascript/package.json (1)

1-15: No known vulnerabilities in markdownlint ≥0.37.4

Based on our verification, there are no publicly documented CVEs or security advisories affecting markdownlint version 0.37.4 or later. Your use of "markdownlint": "^0.37.4" is considered safe under standard usage.

• If you define custom rules that invoke third-party parsers (e.g. markdown-it), ensure those dependencies remain up-to-date and free of known issues.
• For ongoing assurance, consider adding an automated dependency/vulnerability scanner to your CI pipeline.

src/main/javascript/markdownlint.js (2)

6-8: Well-structured TODO comment for ESLint integration.

The TODO comment correctly identifies the need for ESLint integration to monitor JavaScript code quality, which aligns with the repository's code quality standards.


11-20: Clean and efficient markdownlint integration.

The global lint function implementation is well-structured:

  • Uses synchronous markdownlint API appropriate for Java integration
  • Properly structures the options object
  • Returns results specific to the input text

The implementation appears to address previous review comments about code cleanliness.

src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md (1)

1-104: Comprehensive and well-structured documentation.

The documentation effectively explains the lint rule with:

  • Clear examples of violations and corrections using EO syntax
  • Expected markdownlint output for each violation
  • Explicit listing of ignored rules for transparency
  • Proper references to external markdownlint documentation

The examples cover common markdownlint issues (MD001, MD004, MD018) that developers are likely to encounter.

src/main/java/org/eolang/lints/Defect.java (1)

161-174: Well-implemented constructor addressing previous review feedback.

The new package-private constructor correctly:

  • Uses empty string "" instead of null as recommended in past reviews
  • Maintains package-private visibility for controlled access
  • Properly delegates to the existing 5-parameter constructor
  • Follows established patterns in the codebase

This provides a clean API for creating defects without object names, which is appropriate for the markdownlint integration.

src/main/javascript/webpack.config.js (1)

8-24: LGTM!

The webpack configuration is well-structured for bundling markdownlint for GraalVM JavaScript integration. The webworker target and disabled Node.js core module fallbacks are appropriate choices for this environment.

src/test/java/org/eolang/lints/LtInvalidMarkdownCommentTest.java (1)

21-56: LGTM!

The test correctly validates detection of markdownlint violations, specifically testing for MD001 (heading level increment) errors.

pom.xml (1)

148-158: LGTM!

GraalVM JavaScript dependencies are correctly configured with appropriate scopes.

src/main/java/org/eolang/lints/MarkdownLinter.java (1)

22-103: LGTM!

Well-implemented GraalVM JavaScript integration with proper resource management and error handling. The URL polyfill is a clever solution for GraalVM limitations.

src/main/java/org/eolang/lints/LtInvalidMarkdownComment.java (1)

44-91: LGTM!

Efficient implementation that properly reuses the MarkdownLinter instance across multiple files and correctly calculates line numbers for multi-line comments.

<configuration>
<arguments>install</arguments>
<workingDirectory>${project.build.directory}/javascript</workingDirectory>
<installDirectory>.</installDirectory>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Change installDirectory to avoid polluting project root.

Setting installDirectory to . will install Node.js in the project root, which could lead to unwanted files in version control.

-              <installDirectory>.</installDirectory>
+              <installDirectory>${project.build.directory}</installDirectory>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<installDirectory>.</installDirectory>
<installDirectory>${project.build.directory}</installDirectory>
🤖 Prompt for AI Agents
In pom.xml at line 734, the installDirectory is set to '.', which installs
Node.js in the project root and may clutter version control. Change the
installDirectory to a dedicated subdirectory (e.g., 'node' or 'target/node')
within the project to isolate installed files and avoid polluting the root
directory.

@github-actions github-actions bot added the core Changes are made to core parts of the code base label Jul 7, 2025
@yegor256
Copy link
Member

yegor256 commented Jul 7, 2025

@Marat-Tim somehow, tests are failing here. If you can fix them, we'll merge

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md (3)

1-5: Suppress the Vale “markdownlint” false-positive once, rather than ignoring every CI run

markdownlint is a proper noun, but Vale’s default dictionary does not know it, which currently fails the pipeline.
Add the term to the project dictionary (e.g. .vale/styles/accepted-words.txt) or create a local Vale rule override so we don’t have to fight the checker in the future.


18-20: Trim trailing whitespace to keep the file diff-friendly

There are two lines with a single trailing space at EOL (Sub information about main object.).
Those appear in many editors as visual noise and generate unnecessary git churn.

Diff to apply:

-# Sub information about main object.␠
+# Sub information about main object.

Also applies to: 37-39


8-9: Optionally silence heading-capitalisation warnings for rule IDs

Vale warns that headings like MD001/MD004/MD018 do not use sentence-style capitalisation.
Because these headings are literal rule identifiers, the warning is not actionable.
Consider adding a <!-- vale off --> … <!-- vale on --> wrapper around those rule-ID headings or tweaking .vale.ini to ignore Microsoft.Headings/Google.Headings for this file.

Also applies to: 42-43, 73-74

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71748cd and 413b161.

📒 Files selected for processing (10)
  • pom.xml (3 hunks)
  • src/main/java/org/eolang/lints/Defect.java (1 hunks)
  • src/main/java/org/eolang/lints/LtInvalidMarkdownComment.java (1 hunks)
  • src/main/java/org/eolang/lints/MarkdownLinter.java (1 hunks)
  • src/main/java/org/eolang/lints/WpaLints.java (1 hunks)
  • src/main/javascript/markdownlint.js (1 hunks)
  • src/main/javascript/package.json (1 hunks)
  • src/main/javascript/webpack.config.js (1 hunks)
  • src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md (1 hunks)
  • src/test/java/org/eolang/lints/LtInvalidMarkdownCommentTest.java (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/main/java/org/eolang/lints/LtInvalidMarkdownComment.java
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/main/java/org/eolang/lints/WpaLints.java
  • src/main/javascript/markdownlint.js
  • src/main/java/org/eolang/lints/Defect.java
  • src/main/javascript/package.json
  • src/main/javascript/webpack.config.js
  • src/test/java/org/eolang/lints/LtInvalidMarkdownCommentTest.java
  • src/main/java/org/eolang/lints/MarkdownLinter.java
  • pom.xml
🧰 Additional context used
🪛 GitHub Check: vale
src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md

[warning] 73-73:
[vale] reported by reviewdog 🐶
[Microsoft.Headings] 'MD018' should use sentence-style capitalization.

Raw Output:
{"message": "[Microsoft.Headings] 'MD018' should use sentence-style capitalization.", "location": {"path": "src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md", "range": {"start": {"line": 73, "column": 6}}}, "severity": "INFO"}


[warning] 73-73:
[vale] reported by reviewdog 🐶
[Google.Headings] 'MD018' should use sentence-style capitalization.

Raw Output:
{"message": "[Google.Headings] 'MD018' should use sentence-style capitalization.", "location": {"path": "src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md", "range": {"start": {"line": 73, "column": 6}}}, "severity": "WARNING"}


[warning] 42-42:
[vale] reported by reviewdog 🐶
[Microsoft.Headings] 'MD004' should use sentence-style capitalization.

Raw Output:
{"message": "[Microsoft.Headings] 'MD004' should use sentence-style capitalization.", "location": {"path": "src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md", "range": {"start": {"line": 42, "column": 6}}}, "severity": "INFO"}


[warning] 42-42:
[vale] reported by reviewdog 🐶
[Google.Headings] 'MD004' should use sentence-style capitalization.

Raw Output:
{"message": "[Google.Headings] 'MD004' should use sentence-style capitalization.", "location": {"path": "src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md", "range": {"start": {"line": 42, "column": 6}}}, "severity": "WARNING"}


[warning] 8-8:
[vale] reported by reviewdog 🐶
[Microsoft.Headings] 'MD001' should use sentence-style capitalization.

Raw Output:
{"message": "[Microsoft.Headings] 'MD001' should use sentence-style capitalization.", "location": {"path": "src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md", "range": {"start": {"line": 8, "column": 6}}}, "severity": "INFO"}


[warning] 8-8:
[vale] reported by reviewdog 🐶
[Google.Headings] 'MD001' should use sentence-style capitalization.

Raw Output:
{"message": "[Google.Headings] 'MD001' should use sentence-style capitalization.", "location": {"path": "src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md", "range": {"start": {"line": 8, "column": 6}}}, "severity": "WARNING"}


[failure] 4-4:
[vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'markdownlint'?

Raw Output:
{"message": "[Vale.Spelling] Did you really mean 'markdownlint'?", "location": {"path": "src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md", "range": {"start": {"line": 4, "column": 2}}}, "severity": "ERROR"}


[failure] 1-1:
[vale] reported by reviewdog 🐶
[Vale.Spelling] Did you really mean 'markdownlint'?

Raw Output:
{"message": "[Vale.Spelling] Did you really mean 'markdownlint'?", "location": {"path": "src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md", "range": {"start": {"line": 1, "column": 26}}}, "severity": "ERROR"}

🪛 GitHub Actions: vale
src/main/resources/org/eolang/motives/comments/invalid-markdown-comment.md

[error] 1-1: [Vale.Spelling] Did you really mean 'markdownlint'?


[error] 4-4: [Vale.Spelling] Did you really mean 'markdownlint'?


[warning] 8-8: [Google.Headings] 'MD001' should use sentence-style capitalization.


[warning] 42-42: [Google.Headings] 'MD004' should use sentence-style capitalization.


[warning] 73-73: [Google.Headings] 'MD018' should use sentence-style capitalization.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: mvn (windows-2022, 11)
  • GitHub Check: mvn (macos-15, 11)
  • GitHub Check: mvn (macos-15, 21)
  • GitHub Check: mvn (windows-2022, 21)
  • GitHub Check: ort
  • GitHub Check: mvn (ubuntu-24.04, 21)
  • GitHub Check: mvn (ubuntu-24.04, 11)
  • GitHub Check: jmh
  • GitHub Check: deep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes are made to core parts of the code base

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants