Skip to content

Added CodeDescription to LSPReporter and changed docs links to use HTTPS - #1411

Merged
david-yz-liu merged 11 commits into
pyta-uoft:masterfrom
angelayzheng:lsp-reporter-code-description
Oct 18, 2026
Merged

david-yz-liu merged 11 commits into
pyta-uoft:masterfrom
angelayzheng:lsp-reporter-code-description

Conversation

@angelayzheng

@angelayzheng angelayzheng commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Proposed Changes

Added a new CodeDescription field to LSPReporter, which contains a URL to the corresponding documentation section for each diagnostic message. It currently uses the same link as the python_ta.doc function.

In VS Code, the CodeDescription is displayed as a clickable hyperlink in the error code, as shown in the screenshots below.

Additionally, changed all documentation URLs and accompanying tests to use HTTPS instead of the previous HTTP.

Screenshots of your changes (if applicable)

Without CodeDescription:

image

With CodeDescription:

image

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
✨ New feature (non-breaking change that adds functionality) x
🐛 Bug fix (non-breaking change that fixes an issue)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📚 Documentation update (change that only updates documentation)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • I have updated the project Changelog (this is required for all changes).
  • If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

Not all of the error codes that are caught by PythonTA have a corresponding documentation section on the PythonTA website. For example, C0114: Missing module docstring currently links to this URL: https://www.cs.toronto.edu/~david/pyta/checkers/index.html#c0114 (which brings you to the top of the page since the heading does not exist), whereas the correct Pylint documentation is here: https://pylint.readthedocs.io/en/latest/user_guide/messages/convention/missing-module-docstring.html

What is the desired behaviour when there is no PythonTA documentation section? I think it would be confusing to link to a nonexistent section, but this is following the current behaviour of the python_ta.doc function. I also understand if implementing a check for whether the section exists is outside the scope of this feature.

Additionally, which documentation pages (if any) should I update as part of this feature?

@coveralls

coveralls commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 39088830895

Coverage increased (+0.002%) to 91.587%

Details

  • Coverage increased (+0.002%) from the base build.
  • Patch coverage: 3 of 3 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4172
Covered Lines: 3821
Line Coverage: 91.59%
Coverage Strength: 21.25 hits per line

💛 - Coveralls

@david-yz-liu david-yz-liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @angelayzheng! In response to your questions:

  • The PythonTA documentation should include information for all pylint errors that we enable by default, so if there are missing ones we should resolve that in a future PR.
  • Even though this is an addition to the reporter, because we don't have documentation on each reporter don't worry about updating the documentation for this change.

severity=_lsp_severity(msg.category),
code=msg.msg_id,
code_description=types.CodeDescription(
href=f"{python_ta.HELP_URL}#{msg.msg_id.lower()}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is good, but shouldn't duplicate logic. Instead, please create a new python_ta.util function to return the URL and use it both here and for the main doc function.

At the same time, please also modify the HELP_URL to use https instead of http; add an extra CHANGELOG entry for this under "Enhancements".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you for your feedback! I've created a new helper function, get_documentation_url, with the shared behaviour. I've also updated the HELP_URL to use https instead of http, along with the corresponding tests, snapshots, and CHANGELOG.

I did delete two outdated snapshot files that are no longer used (I found them when I was searching for the old http HELP_URL): no_watch_html_server_snapshot.html‎ and watch_html_server_snapshot.html‎. These snapshots' tests were moved in commit 4b2dac0 but weren't deleted at the time.

I believe the repository likely contains additional outdated snapshots, but I assume that this would be part of a different refactoring PR. Please let me know if you think these two snapshots should not be deleted as part of my current PR.

@angelayzheng angelayzheng changed the title Added CodeDescription to LSPReporter Added CodeDescription to LSPReporter and changed docs links to use HTTPS Oct 17, 2026

@david-yz-liu david-yz-liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like there are two snapshot files that have been deleted, which you should regenerate:

  • packages/python-ta/tests/test_reporters/snapshots/test_html_server/test_open_html_in_browser_no_watch/no_watch_html_server_snapshot.html
  • packages/python-ta/tests/test_reporters/snapshots/test_html_server/test_open_html_in_browser_watch/watch_html_server_snapshot.html

@@ -0,0 +1,20 @@
"""Tests for PythonTA documentation URL generation."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is good but to keep files organized, please put this under tests/test_util/test_documentation.py.

@angelayzheng

angelayzheng commented Oct 17, 2026 •

Copy link
Copy Markdown
Member Author

It looks like there are two snapshot files that have been deleted, which you should regenerate:

  • packages/python-ta/tests/test_reporters/snapshots/test_html_server/test_open_html_in_browser_no_watch/no_watch_html_server_snapshot.html
  • packages/python-ta/tests/test_reporters/snapshots/test_html_server/test_open_html_in_browser_watch/watch_html_server_snapshot.html

Hi @david-yz-liu, I explained why I deleted these two files in my reply to your previous comment. Could you please review that and let me know if these can be kept as deleted? Thanks!

@david-yz-liu

Copy link
Copy Markdown
Contributor

@angelayzheng thanks for the explanation; you can remove these files in a separate PR, but it shouldn't be part of this one.

@angelayzheng

Copy link
Copy Markdown
Member Author

@david-yz-liu thanks! I've moved test_documentation.py to tests/test_util and restored the two snapshot files that were previously deleted.

@david-yz-liu david-yz-liu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work, @angelayzheng!

@david-yz-liu
david-yz-liu merged commit 75066d5 into pyta-uoft:master Oct 18, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants