-
Notifications
You must be signed in to change notification settings - Fork 61
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
Adjust Vale rules to ignore links #753
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Tokesh <[email protected]>
Changes AnalysisCommit SHA: 03cbf9d API ChangesSummaryNO CHANGES ReportThe full API changes report is available at: https://github.com/opensearch-project/opensearch-api-specification/actions/runs/12485091459/artifacts/2359970619 API Coverage
|
Signed-off-by: Tokesh <[email protected]>
Signed-off-by: Tokesh <[email protected]>
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.
- Add tests, make sure there's one with 1 link and 2 links to https://github.com/opensearch-project/opensearch-api-specification/tree/main/tools/tests/prepare-for-vale.
- Extract
line.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1')
into a method, similar toprune_vars
, maybe something descriptive likeremove_links
.
Signed-off-by: Tokesh <[email protected]>
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.
One more place where the transformation needs to be applied, see below.
Iterate till unit tests and linter are green (this repo uses a slightly different convention that the default TS with variable_names
).
Add an integration test to https://github.com/opensearch-project/opensearch-api-specification/blob/main/tools/tests/prepare-for-vale/fixtures.
@@ -45,7 +45,7 @@ export default class KeepDescriptions { | |||
} else if (inside_text && line.match(/^[\s]*[\w\\$]*:/)) { | |||
inside_text = false | |||
} else if (inside_text) { | |||
const cleaned_line = line.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') | |||
const cleaned_line = this.remove_links(line) |
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.
You can also have links in descriptions on line 44, so it will need to be handled there as well (and possibly in other cases). Add tests for those of course.
We have remove_links
, prune_vars
and occasionally prune
. Either extract the common parts into a method, or at least make it visible/more readable that we're doing a series of transformations.
var cleaned_line = this.prune(line, /(description|x-deprecation-message):/, ' '))
cleaned_line = this.remove_links(line)
cleaned_line = this.prune_vars(cleaned_line)
fs.writeSync(writer, cleaned_line)
let cleaned_line = this.remove_links(line)
cleaned_line = this.prune_vars(cleaned_line)
fs.writeSync(writer, cleaned_line)
Signed-off-by: Tokesh <[email protected]>
Signed-off-by: Tokesh <[email protected]>
Signed-off-by: Tokesh <[email protected]>
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 way this works is that we remove all text that doesn’t need to be checked.
So, you have to replace the text with an equal number of spaces otherwise the comments from the tool appear in the wrong place on GitHub.
Signed-off-by: Tokesh <[email protected]>
Description
Updated the
process_file
method to remove markdown links, leaving only their text content. This ensures the tool processesdescription
andx-deprecation-message
fields cleanly, aligning with Vale style-checking requirements.Issues Resolved
[#752]
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.