-
-
Notifications
You must be signed in to change notification settings - Fork 285
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Similar to #1141, there's a couple more false-positives when trying to use the p tag helper.
When using a p helper without a block (this is a bit of an edge-case, and could be replaced with a div()):
app/aspects/chats/components/skeleton_message.rb:42:13: C: Rails/Output: Do not write to stdout. Use Rails's logger if you want to log.
p(class: "h-4 bg-gray-200 rounded-full dark:bg-neutral-700", style: "width: 60%;")
And when you provide a block variable:
app/components/ui/blank_state.rb:13:11: C: Rails/Output: Do not write to stdout. Use Rails's logger if you want to log.
p(class: "...", &@content) if @content
Perhaps the cop could be made to be configurable, such that the values in RESTRICT_ON_SEND (currently a const) could be customized, and exclude the p.
Expected behavior
Rubocop Rails/Ouput should not offend when using the p() helper in Phlex.
Actual behavior
#1141 updated it to not flag a p helper provided with a block literal. There are a few more instances
Steps to reproduce the problem
Have a phlex component with this code:
def view_template
content = "hello"
p(&content)
p(class: "placeholder")
endRails/Output will flag both those p methods as errors.
RuboCop version
1.75.4 (using Parser 3.3.8.0, Prism 1.4.0, rubocop-ast 1.44.1, analyzing as Ruby 3.4, running on ruby 3.4.4) [x86_64-linux]
- rubocop-rails 2.31.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working