Skip to content

feat(harper-core): Mark shebangs as unlintable#421

Closed
sohunpatel wants to merge 1 commit intoAutomattic:masterfrom
sohunpatel:master
Closed

feat(harper-core): Mark shebangs as unlintable#421
sohunpatel wants to merge 1 commit intoAutomattic:masterfrom
sohunpatel:master

Conversation

@sohunpatel
Copy link
Copy Markdown

Closes #65.

Changes

  • Adds check to see if the content is a shebang, in the parse function.
  • Add test to comment parser to make sure that comments with shebang are ignored

I am not sure if this is a great solution since this should only apply to comment parsers, but I could not find an elegant solution for that.

@grantlemons
Copy link
Copy Markdown
Collaborator

I think a better solution would be to mask them out in harper-tree-sitter. See fd5ebae.

@elijah-potter
Copy link
Copy Markdown
Collaborator

@grantlemons, @sohunpatel I think the best way to do this would be to create a new implementaion of the Masker trait that ignores lines with shebangs. From there, it'd wrap it around the inner Masker that CommentParser uses internally.

Let me know if you have any questions about any of that.

@elijah-potter elijah-potter added enhancement New feature or request rust Pull requests that update Rust code harper-comments labels Jan 21, 2025
@elijah-potter
Copy link
Copy Markdown
Collaborator

I may tackle this eventually, but it doesn't seem that this PR is getting more attention. Since it is still not in a satisfactory state, I'm going to close it.

@holmanb
Copy link
Copy Markdown
Contributor

holmanb commented Mar 20, 2025

Let me know if you have any questions about any of that.

@elijah-potter How strongly do you feel about this approach? I'm currently testing out a one-line change which modifies harper-comments/src/masker.rs and I think this would be a bit simpler than creating a new Masker implementation, but I suppose what you describe would have cleaner separation.

@elijah-potter
Copy link
Copy Markdown
Collaborator

@holman, that depends on what the one-line change looks like. Why don't you open a draft PR and we can take a look?

@holmanb holmanb mentioned this pull request Mar 20, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request harper-comments rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: ignore shebangs

4 participants