Skip to content

Commit

Permalink
Fix false positives against catalog headers expressed with markdown i…
Browse files Browse the repository at this point in the history
…nstead of html, at the cost of a very unreadable regular expression.

This matches the following header:
([![Community Plus header](https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)

In addition to the prior header:
<a href="https://opensource.newrelic.com/oss-category/#community-plus"><picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Community_Plus.png"><source media="(prefers-color-scheme: light)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"><img alt="New Relic Open Source community plus project banner." src="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"></picture></a>

Apologies to future devs who have to strain their eyes to read the regular expression. It is fundamentally (A)|(B), where the contents of A and B are escaped.
  • Loading branch information
lucasgonze committed Sep 29, 2023
1 parent 53d9af9 commit ef9f302
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions repolinter-rulesets/community-plus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ rules:
nocase: true
lineCount: 5
patterns:
- '<a href="https:\/\/opensource\.newrelic\.com\/oss-category\/#community-plus"><picture><source media="\(prefers-color-scheme: dark\)" srcset="https:\/\/github\.com\/newrelic\/opensource-website\/raw\/main\/src\/images\/categories\/dark\/Community_Plus\.png"><source media="\(prefers-color-scheme: light\)" srcset="https:\/\/github\.com\/newrelic\/opensource-website\/raw\/main\/src\/images\/categories\/Community_Plus\.png"><img alt="New Relic Open Source community plus project banner\." src="https:\/\/github\.com\/newrelic\/opensource-website\/raw\/main\/src\/images\/categories\/Community_Plus\.png"><\/picture><\/a>'
- https:\/\/opensource\.newrelic\.com\/oss-category\/#community-plus
-(<a href="https:\/\/opensource\.newrelic\.com\/oss-category\/#community-plus"><picture><source media="\(prefers-color-scheme: dark\)" srcset="https:\/\/github\.com\/newrelic\/opensource-website\/raw\/main\/src\/images\/categories\/dark\/Community_Plus\.png"><source media="\(prefers-color-scheme: light\)" srcset="https:\/\/github\.com\/newrelic\/opensource-website\/raw\/main\/src\/images\/categories\/Community_Plus\.png"><img alt="New Relic Open Source community plus project banner\." src="https:\/\/github\.com\/newrelic\/opensource-website\/raw\/main\/src\/images\/categories\/Community_Plus\.png"><\/picture><\/a>)|(\(\[\!\[Community Plus header\]\(https\:\/\/github\.com\/newrelic\/opensource\-website\/raw\/main\/src\/images\/categories\/Community_Plus\.png\)\]\(https\:\/\/opensource\.newrelic\.com\/oss\-category\/\#community\-plus\))
human-readable-pattern: Open source Community Plus header (see https://opensource.newrelic.com/oss-category)
flags: i
succeed-on-non-existent: false
Expand Down

0 comments on commit ef9f302

Please sign in to comment.