Skip to content

Linter: Fix false positive for to_s in actionview-no-implicit-polymorphic-url - #2813

Merged
marcoroth merged 1 commit into
marcoroth:mainfrom
devtechedge:fix/2802-to-s-not-a-model
Oct 19, 2026
Merged

marcoroth merged 1 commit into
marcoroth:mainfrom
devtechedge:fix/2802-to-s-not-a-model

Conversation

@devtechedge

@devtechedge devtechedge commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2802

…morphic-url`

`isModelReaderCall` treated `ticket.view_url.to_s` as a model reader, so the hint named `to_s_path`.

`to_s` and `to_str` return a String, which `url_for` leaves unchanged.

The rule now skips those two calls.

A `view_url` call without that conversion stays silent.

The new cases expect no offense for `ticket.view_url.to_s` and `ticket.view_url.to_str`.
@github-actions github-actions Bot added linter @herb-tools/linter for HTML+ERB templates typescript TypeScript source across the javascript/ packages linter-rule Individual linter rules and their documentation labels Oct 19, 2026
@devtechedge devtechedge changed the title Linter: Fix false positive for o_s in ctionview-no-implicit-polymorphic-url Linter: Fix false positive for to_s in actionview-no-implicit-polymorphic-url Oct 19, 2026

@marcoroth marcoroth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @devtechedge! 🙏🏼

@marcoroth
marcoroth enabled auto-merge (squash) October 19, 2026 05:48
@marcoroth
marcoroth merged commit a33f2ba into marcoroth:main Oct 19, 2026
18 checks passed
@devtechedge

Copy link
Copy Markdown
Contributor Author

Thank you for merging this, Marco.

I appreciate the quick turnaround on the false positive.

The to_s and to_str cases are covered in the rule tests now.

Happy to follow up if you would like that handled differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linter @herb-tools/linter for HTML+ERB templates linter-rule Individual linter rules and their documentation typescript TypeScript source across the javascript/ packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linter: actionview-no-implicit-polymorphic-url reports link_to with a URL converted by .to_s

2 participants