Repository navigation
Format recipes - #20
Open
bouweandela wants to merge 10 commits into
Open
bouweandela wants to merge 10 commits into
bouweandela wants to merge 10 commits into
Conversation
Format recipes with esmvalcore.recipe.format_recipe, editing only the lines that change. Recipes with comments are not formatted, because formatting would remove the comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #20 +/- ##
==========================================
- Coverage 93.71% 93.50% -0.22%
==========================================
Files 21 22 +1
Lines 2339 2416 +77
Branches 350 356 +6
==========================================
+ Hits 2192 2259 +67
- Misses 110 120 +10
Partials 37 37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Only format files that are ESMValTool recipes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recipes usually start with comments that identify them, followed by the document start marker. These no longer prevent a recipe from being formatted, and formatting keeps them and the marker unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Format Document command can use another extension that formats YAML files, so the new Format Recipe command asks the language server directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
That branch builds on recipe-json-schema, keeps the paragraphs and lists of folded descriptions, and keeps the comments before the document start, so the server no longer needs to handle those comments itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Format Document formats a recipe with
esmvalcore.recipe.format_recipe(ESMValGroup/ESMValCore#3261), which puts the sections of the recipe and the facets of the datasets and variables in a standard order. Only the lines that change are edited, so the editor keeps the cursor position elsewhere.Like the other features, formatting is only offered for ESMValTool recipes, not for other files named like recipes.
format_reciperemoves comments, so recipes with comments are not formatted and the editor shows a warning instead; otherwise format-on-save would silently delete them. Recipes that are not valid YAML are not formatted either.Tested with
pixi run test,pixi run test-vscode, andpixi run pre-commit run --all-files.🤖 Generated with Claude Code