[openstreetmap/openstreetmap-website] Fix new Herb warning (PR #6914)

Andy Allan notifications at github.com
Fri Mar 20 13:35:59 UTC 2026


gravitystorm left a comment (openstreetmap/openstreetmap-website#6914)

@marcoroth thanks for the additional details!

I don't know if you'd consider this as intended behaviour, but given the following (which is more or less what brought this to our attention:

```
    <div>
      <% if foo %>
        <nav>     <- highlighted
          <ul>      <- highlighted
            <li>     <- highlighted
              foo
            </li>
          </ul>
        </nav>
      <% else %>
        <nav>     <- highlighted
          <ul>      <- highlighted
            <li>      <- highlighted
              bar
            </li>
            <li>
              baz
            </li>
          </ul>
        </nav>
      <% end %>
    </div>
```

I find it perfectly reasonable to move the `nav` and `ul` out of the `if..else`, to get:

```
    <div>
      <nav>
        <ul>
          <% if foo %>
            <li>   <- still highlighted
              foo
            </li>
          <% else %>
            <li>   <- still highlighted
              bar
            </li>
            <li>
              baz
            </li>
          <% end %>
        </ul>
      </nav>
    </div>
```

but I wouldn't consider trying any further refactoring on the remaining hint - I can't see a nice way to resolve that. If it was just one `li` in each branch, fair enough, but when there's a different number of sibling elements it seems reasonable to me to keep them as they are. Does that make sense? Is this somewhere that the hinting should be suppressed?



-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6914#issuecomment-4098015696
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6914/c4098015696 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260320/2a6b247c/attachment.htm>


More information about the rails-dev mailing list