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

Add a linter to check the images' alt text #718

Merged
merged 5 commits into from
Dec 12, 2024

Conversation

arnaucasau
Copy link
Contributor

In order to meet the IBM Accessibility Requirements for the API docs, we need to ensure that all images have appropriate alt text so that users can understand any meaningful visuals. The alt text should serve the same purpose as the images on the page, conveying the same meaning rather than describing visual characteristics. In addition, if an image contains important words for understanding the content, the alt text should include those words as well.

This PR adds a linter to check that all images have alt text. The current invalid images, if any, have been included in an allowlist that will help us to not break CI before the text is added.

If the script detects an image without alt text, it will show an error indicating the file where the image is located and the line where we are using a sphinx directive like .. image:: or .. plot:: that generates an image. Example:

💔 Some images are missing the alt text

Errors found in qiskit_ibm_runtime/fake_provider/__init__.py:
- Error in line 34: .. plot::

Alt text is crucial for making documentation accessible to all users. It should serve the same purpose as the images on the page, conveying the same meaning rather than describing visual characteristics. When an image contains words that are important to understanding the content, the alt text should include those words as well.

To fix the error, the :alt: [Your text here] option must be added under the lines indicated in the error messages. However, If the .. plot:: directive is used, but no image is generated, you can use the option :nofigs:.

@coveralls
Copy link

coveralls commented Dec 3, 2024

Pull Request Test Coverage Report for Build 12259882585

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 12187119898: 0.0%
Covered Lines: 2330
Relevant Lines: 2330

💛 - Coveralls

Eric-Arellano
Eric-Arellano previously approved these changes Dec 3, 2024
@arnaucasau arnaucasau marked this pull request as draft December 5, 2024 08:43
@arnaucasau arnaucasau marked this pull request as ready for review December 10, 2024 15:59
@garrison garrison added the stable backport potential Suitable to be backported to most recent stable branch by Mergify label Dec 12, 2024
@garrison garrison enabled auto-merge (squash) December 12, 2024 01:25
@garrison garrison disabled auto-merge December 12, 2024 01:27
@garrison garrison merged commit 80b2a50 into Qiskit:main Dec 12, 2024
10 of 11 checks passed
mergify bot pushed a commit that referenced this pull request Dec 12, 2024
* Create linter and allowlist

* refactor linter and add it to CI

* refactor loop

* use VCS to install the linter

(cherry picked from commit 80b2a50)
garrison pushed a commit that referenced this pull request Dec 12, 2024
* Create linter and allowlist

* refactor linter and add it to CI

* refactor loop

* use VCS to install the linter

(cherry picked from commit 80b2a50)

Co-authored-by: Arnau Casau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable backport potential Suitable to be backported to most recent stable branch by Mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants