Skip to content

chore: add mdformat and prettier for yaml#1865

Closed
njzjz-bot wants to merge 1 commit into
deepmodeling:develfrom
njzjz-bothub:sync-precommit-mdformat
Closed

chore: add mdformat and prettier for yaml#1865
njzjz-bot wants to merge 1 commit into
deepmodeling:develfrom
njzjz-bothub:sync-precommit-mdformat

Conversation

@njzjz-bot

@njzjz-bot njzjz-bot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Sync pre-commit config from deepmd-kit@69eb0c3bb10be0ace823a5240c9fef6d0bb26c08

Changes:

  • Add mdformat for markdown formatting
  • Add mdformat plugins: myst, ruff, web, config, beautysh, gfm-alerts
  • Add prettier for yaml formatting only

Authored by OpenClaw (model: glm-5)

Summary by CodeRabbit

  • Chores
    • Added markdown formatter to pre-commit hooks for improved documentation quality.
    • Added YAML formatter to pre-commit hooks for enhanced configuration file formatting.

Sync pre-commit config from deepmd-kit@69eb0c3bb10be0ace823a5240c9fef6d0bb26c08

Changes:
- Add mdformat for markdown formatting
- Add mdformat plugins: myst, ruff, web, config, beautysh, gfm-alerts
- Add prettier for yaml formatting only

Authored by OpenClaw (model: glm-5)
@coderabbitai

coderabbitai Bot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds two pre-commit hooks to configuration: mdformat for markdown formatting with additional git-based dependencies, and prettier for YAML file formatting. Both hooks are pinned to specific versions.

Changes

Cohort / File(s) Summary
Pre-commit Configuration
.pre-commit-config.yaml
Added mdformat hook (rev 1.0.0) with multiple additional dependencies (mdformat-myst, mdformat-ruff, mdformat-web, mdformat-config, mdformat-beautysh, mdformat-gfm-alerts) and prettier hook (rev v4.0.0-alpha.8) configured for YAML files only.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding mdformat (for Markdown) and prettier (for YAML formatting) to the pre-commit configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.pre-commit-config.yaml:
- Around line 42-61: The YAML has the markdown and yaml hook blocks nested under
the previous repo mapping; move the "- repo: https://github.com/hukkin/mdformat"
and "- repo: https://github.com/pre-commit/mirrors-prettier" entries out to be
top-level list items under the main "repos:" sequence so each "- repo: ..."
starts at the same indentation as other repo entries; ensure their inner "rev:"
and "hooks:" mappings are indented one level under each "- repo" (use 2 spaces
per level) so the mdformat and prettier hooks are valid top-level repo entries.
- Around line 57-61: Update the Prettier hook in the pre-commit config by
changing the mirrors-prettier rev from "v4.0.0-alpha.8" to the stable release
"v3.8.1" for the hook with id "prettier" (the block that currently lists repo:
https://github.com/pre-commit/mirrors-prettier and types_or: [yaml]); this pins
Prettier to the stable version to avoid formatter churn—if you need v4 testing
instead, use a newer v4 alpha (e.g., "v4.0.0-alpha.13") rather than the old
alpha.8.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 663d8d6 and c8d4496.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml

Comment thread .pre-commit-config.yaml
Comment on lines +42 to +61
# markdown
- repo: https://github.com/hukkin/mdformat
rev: 1.0.0
hooks:
- id: mdformat
additional_dependencies:
# - mdformat-myst==0.3.0
# See https://github.com/executablebooks/mdformat-myst/issues/13
- "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst"
- mdformat-ruff==0.1.3
- mdformat-web==0.2.0
- mdformat-config==0.2.1
- mdformat-beautysh==1.0.0
- mdformat-gfm-alerts==2.0.0
# yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [yaml]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix YAML indentation so new repos are top‑level list items.

The markdown/yaml hooks are indented under the previous repo mapping, which makes the YAML invalid (matches the YAMLlint error) and will break pre-commit parsing. Align them with the other top‑level repos entries.

✅ Proposed fix
-  # markdown
-  - repo: https://github.com/hukkin/mdformat
-    rev: 1.0.0
-    hooks:
-      - id: mdformat
-        additional_dependencies:
-          # - mdformat-myst==0.3.0
-          # See https://github.com/executablebooks/mdformat-myst/issues/13
-          - "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst"
-          - mdformat-ruff==0.1.3
-          - mdformat-web==0.2.0
-          - mdformat-config==0.2.1
-          - mdformat-beautysh==1.0.0
-          - mdformat-gfm-alerts==2.0.0
-  # yaml
-  - repo: https://github.com/pre-commit/mirrors-prettier
-    rev: v4.0.0-alpha.8
-    hooks:
-      - id: prettier
-        types_or: [yaml]
+# markdown
+- repo: https://github.com/hukkin/mdformat
+  rev: 1.0.0
+  hooks:
+    - id: mdformat
+      additional_dependencies:
+        # - mdformat-myst==0.3.0
+        # See https://github.com/executablebooks/mdformat-myst/issues/13
+        - "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst"
+        - mdformat-ruff==0.1.3
+        - mdformat-web==0.2.0
+        - mdformat-config==0.2.1
+        - mdformat-beautysh==1.0.0
+        - mdformat-gfm-alerts==2.0.0
+# yaml
+- repo: https://github.com/pre-commit/mirrors-prettier
+  rev: v4.0.0-alpha.8
+  hooks:
+    - id: prettier
+      types_or: [yaml]
📝 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
# markdown
- repo: https://github.com/hukkin/mdformat
rev: 1.0.0
hooks:
- id: mdformat
additional_dependencies:
# - mdformat-myst==0.3.0
# See https://github.com/executablebooks/mdformat-myst/issues/13
- "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst"
- mdformat-ruff==0.1.3
- mdformat-web==0.2.0
- mdformat-config==0.2.1
- mdformat-beautysh==1.0.0
- mdformat-gfm-alerts==2.0.0
# yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [yaml]
# markdown
- repo: https://github.com/hukkin/mdformat
rev: 1.0.0
hooks:
- id: mdformat
additional_dependencies:
# - mdformat-myst==0.3.0
# See https://github.com/executablebooks/mdformat-myst/issues/13
- "git+https://github.com/njzjz-bothub/mdformat-myst@d9c414e#egg=mdformat-myst"
- mdformat-ruff==0.1.3
- mdformat-web==0.2.0
- mdformat-config==0.2.1
- mdformat-beautysh==1.0.0
- mdformat-gfm-alerts==2.0.0
# yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [yaml]
🧰 Tools
🪛 YAMLlint (1.38.0)

[error] 43-43: syntax error: expected , but found ''

(syntax)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.pre-commit-config.yaml around lines 42 - 61, The YAML has the markdown and
yaml hook blocks nested under the previous repo mapping; move the "- repo:
https://github.com/hukkin/mdformat" and "- repo:
https://github.com/pre-commit/mirrors-prettier" entries out to be top-level list
items under the main "repos:" sequence so each "- repo: ..." starts at the same
indentation as other repo entries; ensure their inner "rev:" and "hooks:"
mappings are indented one level under each "- repo" (use 2 spaces per level) so
the mdformat and prettier hooks are valid top-level repo entries.

Comment thread .pre-commit-config.yaml
Comment on lines +57 to +61
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [yaml]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# List recent releases to confirm latest stable vs alpha.
gh release list -R pre-commit/mirrors-prettier --limit 10

Repository: deepmodeling/dpgen

Length of output: 243


🌐 Web query:

Prettier v4 latest stable release vs v4.0.0-alpha.8

💡 Result:

  • Latest stable Prettier (as of Feb 24, 2026): v3.8.1 (published Jan 21, 2026). This is the version you get from the npm latest tag and is recommended for production use. [1]
  • Prettier v4.0.0-alpha.8: a prerelease (alpha) from Dec 20, 2023—meant for testing upcoming v4 changes and more likely to have breaking changes/instability than stable releases. [2]
  • Context: v4 has continued to ship newer alphas after alpha.8 (e.g., v4.0.0-alpha.13 on Nov 18, 2025), so alpha.8 is also quite old compared to the current v4 prerelease line. [3]

Practical choice: use v3.8.1 unless you specifically need to test v4 behavior; if you do, prefer the latest v4 alpha rather than alpha.8. [1][3]

Sources: [1] Snyk (npm prettier versions list), [2] Libraries.io (prettier version timeline incl. 4.0.0-alpha.8), [3] ReleaseAlert (prettier release timeline incl. 4.0.0-alpha.13).


Pin Prettier to the latest stable release (v3.8.1).

v4.0.0-alpha.8 (Dec 2023) is outdated and unstable. It will cause formatter churn and unpredictable behavior. Use v3.8.1 (the current stable release as of Jan 2026) unless there is a specific requirement to test Prettier v4 features—in which case, use a newer v4 alpha (e.g., v4.0.0-alpha.13) rather than the old alpha.8.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.pre-commit-config.yaml around lines 57 - 61, Update the Prettier hook in
the pre-commit config by changing the mirrors-prettier rev from "v4.0.0-alpha.8"
to the stable release "v3.8.1" for the hook with id "prettier" (the block that
currently lists repo: https://github.com/pre-commit/mirrors-prettier and
types_or: [yaml]); this pins Prettier to the stable version to avoid formatter
churn—if you need v4 testing instead, use a newer v4 alpha (e.g.,
"v4.0.0-alpha.13") rather than the old alpha.8.

@njzjz-bot

Copy link
Copy Markdown
Contributor Author

Recreating from njzjz-bot

@njzjz-bot njzjz-bot closed this Feb 24, 2026
@codecov

codecov Bot commented Feb 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.80%. Comparing base (663d8d6) to head (c8d4496).

Additional details and impacted files
@@           Coverage Diff           @@
##            devel    #1865   +/-   ##
=======================================
  Coverage   49.80%   49.80%           
=======================================
  Files          83       83           
  Lines       14988    14988           
=======================================
  Hits         7465     7465           
  Misses       7523     7523           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant