Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect links to rule docs #867

Closed
pdehaan opened this issue Jan 14, 2022 · 2 comments · Fixed by #878
Closed

Incorrect links to rule docs #867

pdehaan opened this issue Jan 14, 2022 · 2 comments · Fixed by #878
Labels
core Relates to HTMLHint's core APIs and features good first issue Good for newcomers PR needed released

Comments

@pdehaan
Copy link

pdehaan commented Jan 14, 2022

Describe the bug

Also spotted that my JSON output when using the API gives me links like "https://github.com/thedaviddias/HTMLHint/wiki/alt-require", which seems to redirect to generic https://github.com/htmlhint/HTMLHint homepage.
Not sure if those should redirect to the rules/*.md files directly (a la https://github.com/htmlhint/HTMLHint/blob/master/docs/user-guide/rules/alt-require.md) or the website pages at https://htmlhint.com/docs/user-guide/rules/alt-require. I think the latter is preferred, but probably requires #698.

    {
      "type": "warning",
      "message": "An alt attribute must be present on <img> elements.",
      "raw": "<img src=\"/img/svg/vpn.svg\">",
      "evidence": "    \t\t\t\t\t<figure><img src=\"/img/svg/vpn.svg\">",
      "line": 75,
      "col": 22,
      "rule": {
        "id": "alt-require",
        "description": "The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",
        "link": "https://github.com/thedaviddias/HTMLHint/wiki/alt-require"
      }
    },

To Reproduce
Lint some stuff using the API or just use the json formatter.

npx htmlhint https://monitor.firefox.com/ --rules=alt-require --format=json
[
  {
    "file": "https://monitor.firefox.com/",
    "messages": [
      {
        "type": "warning",
        "message": "An alt attribute must be present on <img> elements.",
        "raw": "<img src=\"/img/svg/laptop.svg\">",
        "evidence": "    \t\t\t\t\t<figure><img src=\"/img/svg/laptop.svg\">",
        "line": 65,
        "col": 22,
        "rule": {
          "id": "alt-require",
          "description": "The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",
          "link": "https://github.com/thedaviddias/HTMLHint/wiki/alt-require"
        }
      },
      {
        "type": "warning",
        "message": "An alt attribute must be present on <img> elements.",
        "raw": "<img src=\"/img/svg/globe.svg\">",
        "evidence": "    \t\t\t\t\t<figure><img src=\"/img/svg/globe.svg\">",
        "line": 70,
        "col": 22,
        "rule": {
          "id": "alt-require",
          "description": "The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",
          "link": "https://github.com/thedaviddias/HTMLHint/wiki/alt-require"
        }
      },
      {
        "type": "warning",
        "message": "An alt attribute must be present on <img> elements.",
        "raw": "<img src=\"/img/svg/vpn.svg\">",
        "evidence": "    \t\t\t\t\t<figure><img src=\"/img/svg/vpn.svg\">",
        "line": 75,
        "col": 22,
        "rule": {
          "id": "alt-require",
          "description": "The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",
          "link": "https://github.com/thedaviddias/HTMLHint/wiki/alt-require"
        }
      }
    ],
    "time": 231
  }
]

Expected behavior
Rule links in JSON reporter/formatter should redirect to documentation.

Screenshots
n/a

Desktop (please complete the following information):

  • OS: macOS 12.1
  • Browser: Node 17.x
  • Version: n/a

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@nschonni
Copy link
Contributor

Looks like the source line is

link: `https://github.com/thedaviddias/HTMLHint/wiki/${rule.id}`,

@nschonni nschonni added core Relates to HTMLHint's core APIs and features good first issue Good for newcomers PR needed labels Jan 14, 2022
is2ei added a commit to is2ei/HTMLHint that referenced this issue Jan 23, 2022
nschonni pushed a commit that referenced this issue Jan 23, 2022
github-actions bot pushed a commit that referenced this issue Jan 23, 2022
## [1.1.1](v1.1.0...v1.1.1) (2022-01-23)

### Bug Fixes

* correct links to rule docs ([6a95ae6](6a95ae6)), closes [#867](#867)
@thedaviddias
Copy link
Member

🎉 This issue has been resolved in version 1.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Relates to HTMLHint's core APIs and features good first issue Good for newcomers PR needed released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants