Skip to content

Add linting and validation of all YAML files #27698

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

Merged
merged 4 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# http://tjelvarolsson.com/blog/how-to-continuously-test-your-python-code-on-windows-using-appveyor/
# https://packaging.python.org/en/latest/appveyor/
# https://github.com/rmcgibbo/python-appveyor-conda-example
---

# Backslashes in quotes need to be escaped: \ -> "\\"
branches:
Expand Down Expand Up @@ -38,7 +39,7 @@ environment:
# We always use a 64-bit machine, but can build x86 distributions
# with the PYTHON_ARCH variable
platform:
- x64
- x64

# all our python builds have to happen in tests_script...
build: false
Expand Down Expand Up @@ -79,18 +80,21 @@ test_script:
- if x%TEST_ALL% == xyes conda install -q ffmpeg inkscape miktex
# missing packages on conda-forge for imagemagick
# This install sometimes failed randomly :-(
#- choco install imagemagick
# - choco install imagemagick

# Test import of tkagg backend
- python -c "import matplotlib as m; m.use('tkagg'); import matplotlib.pyplot as plt; print(plt.get_backend())"
- python -c
"import matplotlib as m; m.use('tkagg');
import matplotlib.pyplot as plt;
print(plt.get_backend())"
# tests
- echo The following args are passed to pytest %PYTEST_ARGS%
- pytest %PYTEST_ARGS%

artifacts:
- path: result_images\*
name: result_images
type: zip
type: Zip

on_finish:
- conda install codecov
Expand Down
11 changes: 8 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ commands:
export git_log=$(git log --max-count=1 --pretty=format:"%B" | tr "\n" " ")
echo "Got commit message:"
echo "${git_log}"
if [[ -v CIRCLE_PULL_REQUEST ]] && [[ $git_log =~ (\[skip circle\]|\[circle skip\]|\[skip doc\]|\[doc skip\]) ]]; then
if [[ -v CIRCLE_PULL_REQUEST ]] &&
[[ $git_log =~ (\[skip circle\]|\[circle skip\]|\[skip doc\]|\[doc skip\]) ]]; then
echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}."
circleci-agent step halt;
fi
Expand Down Expand Up @@ -71,8 +72,12 @@ commands:
name: Install custom fonts
command: |
mkdir -p ~/.local/share/fonts
wget -nc https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O ~/.local/share/fonts/Felipa-Regular.ttf || true
wget -nc https://github.com/ipython/xkcd-font/blob/master/xkcd-script/font/xkcd-script.ttf?raw=true -O ~/.local/share/fonts/xkcd-Script.ttf || true
wget -nc \
https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true \
-O ~/.local/share/fonts/Felipa-Regular.ttf || true
wget -nc \
https://github.com/ipython/xkcd-font/blob/master/xkcd-script/font/xkcd-script.ttf?raw=true \
-O ~/.local/share/fonts/xkcd-Script.ttf || true
fc-cache -f -v
- save_cache:
key: fonts-4
Expand Down
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# These are supported funding model platforms
github: [matplotlib, numfocus]
custom: https://numfocus.org/donate-to-matplotlib
11 changes: 5 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Bug Report
description: Report a bug or issue with Matplotlib.
title: "[Bug]: "
Expand All @@ -6,26 +7,24 @@ body:
id: summary
attributes:
label: Bug summary
description: Describe the bug in 1-2 short sentences
placeholder:
value:
description: Describe the bug in 1-2 short sentences
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Code for reproduction
description: |
description: >-
If possible, please provide a minimum self-contained example.
placeholder: Paste your code here. This field is automatically formatted as Python code.
render: python
render: Python
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual outcome
description: |
description: >-
Paste the output produced by the code provided above, e.g.
console output, images/videos produced by the code, any relevant screenshots/screencasts, etc.
validations:
Expand Down
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
blank_issues_enabled: true # default
# Reference:
# https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
---
blank_issues_enabled: true # default
contact_links:
- name: Question/Support/Other
url: https://discourse.matplotlib.org
Expand Down
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Documentation
description: Create a report to help us improve the documentation
title: "[Doc]: "
Expand All @@ -7,9 +8,9 @@ body:
id: link
attributes:
label: Documentation Link
description: |
Link to any documentation or examples that you are referencing.
Suggested improvements should be based on the development version of the docs: https://matplotlib.org/devdocs/
description: >-
Link to any documentation or examples that you are referencing. Suggested improvements should be based
on [the development version of the docs](https://matplotlib.org/devdocs/)
placeholder: https://matplotlib.org/devdocs/...
- type: textarea
id: problem
Expand Down
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
name: Feature Request
description: Suggest something to add to Matplotlib!
title: "[ENH]: "
labels: [New feature]
body:
- type: markdown
attributes:
value: |
Please search the [issues](https://github.com/matplotlib/matplotlib/issues) for relevant feature requests before creating a new feature request.
value: >-
Please search the [issues](https://github.com/matplotlib/matplotlib/issues) for relevant feature
requests before creating a new feature request.
- type: textarea
id: problem
attributes:
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/maintenance.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Maintenance
description: Help improve performance, usability and/or consistency.
title: "[MNT]: "
Expand All @@ -7,7 +8,7 @@ body:
id: summary
attributes:
label: Summary
description: Please provide 1-2 short sentences that succinctly describes what could be improved.
description: Please provide 1-2 short sentences that succinctly describes what could be improved.
validations:
required: true
- type: textarea
Expand Down
7 changes: 4 additions & 3 deletions .github/ISSUE_TEMPLATE/tag_proposal.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
name: Tag Proposal
description: Suggest a new tag or subcategory for the gallery of examples
title: "[Tag]: "
labels: [Tag proposal]
body:
- type: markdown
attributes:
value: |
Please search the [tag glossary]() for relevant tags before creating a new tag proposal.
value: >-
Please search the [tag glossary]() for relevant tags before creating a new tag proposal.
- type: textarea
id: need
attributes:
Expand All @@ -23,5 +24,5 @@ body:
id: solution
attributes:
label: Proposed solution
description: >
description: >-
What should the tag be? All tags are in the format `subcategory: tag`
9 changes: 5 additions & 4 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# codecov used to be able to find this anywhere, now we have to manually
# tell it where to look
---
comment: false

codecov:
notify:
require_ci_to_pass: no
require_ci_to_pass: false

coverage:
status:
Expand All @@ -13,20 +14,20 @@ coverage:
target: 50%
if_no_uploads: error
if_not_found: success
if_ci_failed: failure
if_ci_failed: error
project:
default: false
library:
target: 50%
if_no_uploads: error
if_not_found: success
if_ci_failed: failure
if_ci_failed: error
paths:
- '!lib/.*/tests/.*'
tests:
target: auto
if_no_uploads: error
if_not_found: success
if_ci_failed: failure
if_ci_failed: error
paths:
- 'lib/.*/tests/.*'
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
Expand Down
24 changes: 12 additions & 12 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@

"Documentation: API":
- all:
- changed-files:
- any-glob-to-any-file:
# Also files in lib/**, but we can't be sure those are only documentation.
- 'doc/api/**'
- all-globs-to-all-files:
- '!doc/api/next_api_changes/**'
- changed-files:
- any-glob-to-any-file:
# Also files in lib/**, but we can't be sure those are only documentation.
- 'doc/api/**'
- all-globs-to-all-files:
- '!doc/api/next_api_changes/**'

"Documentation: build":
- changed-files:
Expand All @@ -107,12 +107,12 @@
- 'galleries/tutorials/**'
"Documentation: user guide":
- all:
- changed-files:
- any-glob-to-any-file:
- 'doc/users/**'
- 'galleries/users_explain/**'
- all-globs-to-all-files:
- '!doc/users/next_whats_new/**'
- changed-files:
- any-glob-to-any-file:
- 'doc/users/**'
- 'galleries/users_explain/**'
- all-globs-to-all-files:
- '!doc/users/next_whats_new/**'

"topic: animation":
- changed-files:
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ permissions:

jobs:
build_sdist:
if: |
if: >-
github.event_name == 'push' ||
github.event_name == 'pull_request' && (
(
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
if-no-files-found: error

build_wheels:
if: |
if: >-
github.event_name == 'push' ||
github.event_name == 'pull_request' && (
(
Expand All @@ -101,9 +101,10 @@ jobs:
# If using all `--pre` releases creates issues, the NumPy wheel can be
# installed more targeted.
CIBW_BUILD_FRONTEND: >-
${{ (((github.event_name == 'push' && github.ref == 'refs/heads/main') ||
${{ ((github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'pull_request' && github.base_ref == 'main')) &&
'pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"') ||
'pip; args: --pre
--extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"' ||
'build' }}
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-
delvewheel repair -w {dest_dir} {wheel}
Expand Down Expand Up @@ -146,39 +147,39 @@ jobs:
path: dist/

- name: Build wheels for CPython 3.12
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
Copy link
Member

Choose a reason for hiding this comment

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

Just want to double check that this change does not interfere with dependabot...

my guess is that it is not a problem for dependabot directly... but that it is possible/likely that dependabot will not place two spaces when it updates, and thus cause linting failures as a result.

Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at the implementation commit, the comment regex is (?<comment>\s+#.*), so it should be fine with any number of leading spaces/tabs. Then updating the version is only replacing old with new.

There's also a test case with multiple spaces before and after the #.

with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp312-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for CPython 3.11
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp311-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for CPython 3.10
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp310-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for CPython 3.9
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp39-*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}

- name: Build wheels for PyPy
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
uses: pypa/cibuildwheel@ce3fb7832089eb3e723a0a99cab7f3eaccf074fd # v2.16.5
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
Expand Down Expand Up @@ -212,4 +213,4 @@ jobs:
run: ls dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # v1.8.11
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf # v1.8.11
3 changes: 2 additions & 1 deletion .github/workflows/clean_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ jobs:
- name: Check for branches opened against main
if: github.ref_name == 'main'
run: |
printf 'PR branch should not be main. See https://matplotlib.org/devdocs/devel/development_workflow.html#make-a-new-feature-branch'
echo 'PR branch should not be main.'
echo 'See https://matplotlib.org/devdocs/devel/development_workflow.html#make-a-new-feature-branch'
exit 1
Loading