Skip to content

fix: shorten spans and remove some fixes #260

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

Merged
merged 20 commits into from
Dec 6, 2024
Merged

Conversation

a-frantz
Copy link
Member

@a-frantz a-frantz commented Nov 27, 2024

Describe the problem or feature in addition to a link to the issues.

closes #243
closes #193

Before submitting this PR, please make sure:

  • You have added a few sentences describing the PR here.
  • You have added yourself or the appropriate individual as the assignee.
  • You have added at least one relevant code reviewer to the PR.
  • Your code builds clean without any errors or warnings.
  • You have added tests (when appropriate).
  • You have updated the README or other documentation to account for these
    changes (when appropriate).
  • You have added an entry to the relevant CHANGELOG.md (see
    "keep a changelog" for more information).
  • Your commit messages follow the conventional commit style.

@a-frantz a-frantz self-assigned this Nov 27, 2024
@a-frantz a-frantz marked this pull request as ready for review November 27, 2024 18:04
@a-frantz
Copy link
Member Author

I somehow managed to gloss over the one rule I specifically called out as an issue in #243 , but that's been corrected now 😅 I believe that now every problematically long span has been shortened.

name.as_str(),
runtime
.syntax()
.first_token()
Copy link
Member

Choose a reason for hiding this comment

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

Does this narrow it down to just the runtime keyword? If so, you should update the expect() statement to make it clear that there is always at least one token, which is the runtime keyword.

self.current_meta_span = Some(
section
.syntax()
.first_token()
Copy link
Member

@claymcleod claymcleod Dec 4, 2024

Choose a reason for hiding this comment

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

Same here on the expect() being clear (change unwrap() to expect()).

self.current_output_span = Some(
section
.syntax()
.first_token()
Copy link
Member

Choose a reason for hiding this comment

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

Same.

None => Some(
section
.syntax()
.first_token()
Copy link
Member

Choose a reason for hiding this comment

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

Same.

missing_trailing_comma(
last_child
.syntax()
.last_token()
Copy link
Member

Choose a reason for hiding this comment

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

Same.

missing_trailing_comma(
last_child
.syntax()
.last_token()
Copy link
Member

Choose a reason for hiding this comment

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

Same.

@@ -261,7 +272,9 @@ impl Visitor for TrailingCommaRule {
} else {
// No comma found, report missing
state.exceptable_add(
missing_trailing_comma(last_child.text_range().to_span()),
missing_trailing_comma(
last_child.last_token().unwrap().text_range().to_span(),
Copy link
Member

Choose a reason for hiding this comment

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

Same.

Copy link
Member

@claymcleod claymcleod left a comment

Choose a reason for hiding this comment

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

In addition to the above, I think you need a CHANGELOG.md entry for the bug that you fixed on the multiple firing of that lint.

Copy link
Collaborator

@peterhuene peterhuene left a comment

Choose a reason for hiding this comment

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

Looks great, just two nit comments!

= fix: use either "/n" or "/r/n" consistently in the file
= fix: ensure that the same line endings (e.g., `/n` or `/r/n`) are used throughout the file
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't these be backslashes?

Copy link
Collaborator

@peterhuene peterhuene Dec 5, 2024

Choose a reason for hiding this comment

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

To fix diagnostics with backslashes in paths on Windows, the test baselines normalize (i.e. indiscriminately replaces all characters in the output) all backslashes to slashes, so it's expected the diagnostics are affected this way.

Copy link
Member Author

@a-frantz a-frantz Dec 5, 2024

Choose a reason for hiding this comment

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

Yes! Good catch nvm, listen to peter lol. I didn't realize this was in the tests.

@a-frantz a-frantz merged commit 613780f into main Dec 6, 2024
16 checks passed
@a-frantz a-frantz deleted the fix/spans_and_fixes branch December 6, 2024 14:46
@a-frantz a-frantz mentioned this pull request Dec 20, 2024
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.

Shorten spans highlighted by lints rewrite or remove existing fix messages
4 participants