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

Doc style check action not capturing example files. #432

Open
dipinknair opened this issue Mar 22, 2024 · 1 comment
Open

Doc style check action not capturing example files. #432

dipinknair opened this issue Mar 22, 2024 · 1 comment

Comments

@dipinknair
Copy link
Contributor

Currently doc style actions are run before generating galleries hence we are not checking the docs generated with python files in examples. For example, pymechanical-examples . This will cause issues since examples generated docs might not comply with vale.
Possible solutions can be

  1. Improve actions to read python files (but this is tricky since vale is not taking any commented rst header and reading multi line strings used as arguments for python functions in examples.)
  2. Create a post doc style actions after generating galleries to check files inside doc/source/examples folder to do vale check on them.

Other solutions are open to discussion 😃

@jorgepiloto
Copy link
Member

With the associated pull-request, it is possible now for projects to pass the files to be checked, see https://github.com/errata-ai/vale-action?tab=readme-ov-file#files-default-all

Vale does not support checking for multiple directories. Possible solutions for this situation include:

  • Using a matrix strategy
  • Collecting all the files and passing them in the proper JSON format
      - name: "Install jq"
        run: |
          # Used to format Vale input as a JSON-formatted list of files
          sudo apt install -y jq

      - name: "Collect desired files"
        run: |
          # Find all .rst files excluding those in doc/source/api/
          RST_FILES=$(find doc/source -type f -name "*.rst" ! -path "doc/source/api/*")

          # Find all .py files inside the examples/ directory, excluding those with an underscore
          PY_FILES=$(find examples -type f -name "*.py" ! -name "*_*")

          # Combine both file lists and convert them to a JSON array
          # TODO: include Python files too. See Vale issue
          # https://github.com/errata-ai/vale/issues/858
          # VALE_FILES=$(echo -e "$RST_FILES\n$PY_FILES" | jq -R . | jq -s .)
          VALE_FILES=$(echo -e "$RST_FILES" | jq -R . | jq -s .)
          echo "VALE_FILES=$(echo $VALE_FILES)" >> $GITHUB_ENV

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

No branches or pull requests

2 participants