Resolve issues causing check failures#

All checks in the CI/CD process must pass before a PR can be approved and merged. Even if you remember to run pre-commit and Vale locally and resolve all issues, when you push your changes to the PR, checks in the CI/CD process can still fail.

For information on continuous integration and the required workflows that run checks on a PR for a PyAnsys library, see Continuous integration.

When a check in the CI/CD process fails, you can click Details to the right of the check to view its log. You are taken to the bottom of the log, where you can see the total number of warnings and errors.

While you can scroll the log to find these warnings and errors, the log can be quite long. Use the Search logs option in the upper right of the window to search first for warning and then for error. (This sequence is recommended because warnings and errors are often related.)

The first occurrence of warning in the log is a hint about how to suppress a warning about the name of the initial branch of the repository. This is not a warning included in the count to resolve and can be safely ignored. Subsequent occurrences of warning, and then error, reveal the issues, with the filenames and lines where you must resolve them.

Your objective should always be to eliminate or mitigate issues before creating or pushing changes to a PR. For example, running pre-commit and Vale locally lets you proactively resolve typos and trailing whitespaces. However, oftentimes, you must resolve issues that cause the checks run by the CI/CD process to fail.

Resolve typos#

In PyAnsys projects, two tools in the CI/CD process check for typos, codespell and Vale. codespell is one of the code style tools that pre-commit is configured to run. If you always run pre-commit and Vale before creating or pushing changes to a PR, these two checks in the CI/CD process should not fail.

Note

If the Vale check on a PR fails, the Documentation style check also fails. Resolving the Vale issues might be all you need to do to get the Documentation style check to pass successfully.

Resolve trailing whitespaces#

If you forget to run pre-commit locally, when you create or push changes to a PR, the CI/CD process is likely to raise errors about trailing whitespaces. Rather than locating and resolving these errors manually, run pre-commit locally to have it find and automatically trim these trailing whitespaces for you. Then, commit and push the files that pre-commit has modified to the PR.

Resolve formatting issues#

When you push changes to a PR, you might see one of the documentation checks fail, even if you ran pre-commit locally and all configured tools ran successfully. Documentation check failures are usually the result of formatting issues and incorrect links, resulting in warnings and errors like these:

WARNING: Inline emphasis start-string without end-string.
WARNING: Inline literal start-string without end-string.
WARNING: document isn't included in any toctree
WARNING: Literal block ends without a blank line; unexpected unindent.
WARNING: Enumerated list ends without a blank line, unexpected unindent.
WARNING: undefined label: 'py_file_formatting'
WARNING: Duplicate explicit target name: "py_code_comments".
ERROR: Unexpected indentation.
ERROR: Unknown interpreted text role "files".
ERROR: Indirect hyperlink target "numpydoc docstrings" refers to target "dev_guide_numpy_docstrings", which does not exist.
ERROR: Unknown target name: "dev_guide_numpy_docstrings".

For each warning and error, a filename and line is indicated. You must go to these locations and make the changes necessary to resolve the warnings and errors. Actions that you might take include these:

  • Add missing start or end strings to various types of format tags.

  • Add a new RST file to the appropriate index.rst file.

  • Indent all lines in a literal block correctly.

  • Add blank lines both before and after a list or literal block.

  • Correct links to internal labels and external targets.

Resolve mismatched message strings#

As indicated in Message strings, you want to ensure that the message strings in PY files provide clear and understandable information or instructions to users. Sometimes, editing a message string can cause a test on the PR to fail. This occurs when a test checks for the occurrence of a particular message string, but this message string is no longer found in the PY file.

When a test on a PR fails, you can click Details to the right of this test to see the log. An error indicates that the message string in the test does not match a message string in the PY file.

Tip

To quickly find the error, you can use the Search logs option in the upper right of the window to search for match=.

To resolve the error, you must open the indicated test file and edit the message string in it to match the message string in the PY file.