Skip to content
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

Add "no-curly-quotes" rule to the codebase. #56

Merged
merged 12 commits into from
Nov 20, 2024
Merged

Conversation

EliSchleifer
Copy link
Member

@EliSchleifer EliSchleifer commented Nov 19, 2024

Adds support for nocurlyquotes that will find instances of curlyquotes in a file and replace with correct non-curly form. We had instances of this in our code base and it caused some issues with marketing site.

Fun little rule. Interestingly - this rule exposes a bug in how we apply on trunk check sarif fixes for utf-8 non-ascii characters. For now this rule will stay disabled until we have a fix.

Fix bug where multiple fixes in a single issue were being turned into multiple issues (which is not what the spec or code was intending to do).

Copy link
Collaborator

@TylerJang27 TylerJang27 left a comment

Choose a reason for hiding this comment

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

Couple notes. Sanity checking as well that this is intended to be enabled for all files and then users can ignore ranges as desired?

Comment on lines 23 to 25
if run.is_upstream() {
return Ok(vec![]);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's wrong with running this on the upstream and having it behave like a normal linter? This shouldn't need upstream awareness like ICTC does...

Copy link
Member Author

Choose a reason for hiding this comment

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

I had disabled that for testing - good catch
shoudve put in a donotand

path: path.to_str().unwrap().to_string(),
range: Some(Range {
start: Position {
line: i as u64,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are the replacements 1-indexed and the diagnostics are 0-indexed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If not, the test you added asserts the message, not the diagnostic location

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch - I shoud standardize this in the diagnostics.rs file where we make every 1 index assuming input is 0 except for startLine and endLine...whoops.

Copy link

trunk-io bot commented Nov 20, 2024

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@EliSchleifer EliSchleifer merged commit c0a6df5 into main Nov 20, 2024
4 checks passed
@EliSchleifer EliSchleifer deleted the eli/curly-quotes branch November 20, 2024 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants