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

Convert malformed-yaml action to Python #255

Merged
merged 74 commits into from
May 1, 2024
Merged

Conversation

tamsinforbes
Copy link
Contributor

@tamsinforbes tamsinforbes commented Apr 15, 2024

👀 Purpose

  • Convert the malformed-yaml action from 💎 Ruby to 🐍 Python

♻️ What's changed

  • ♻️ Created action python-malformed-yaml using Python and Docker with the same functionality as malformed-yaml (if malformed YAML PR fails, changes requested, if good YAML PR OK, if no YAML changes PR OK).
  • ✨ Output the error message from the malformed YAML to make it easier to fix.
  • 🧪 Set up pytest test for main.py functions to detect malformed yaml files
  • 🧪 Set up workflow to run the test

📝 Notes

  • Use requirements.txt over Pipfile as there were problems running Pipfile in Docker container; can revisit
    -To Do
  • Change name of action to malformed-yaml to replace Ruby version
  • Create a new release v18.0.0 documenting breaking changes.

Copy link
Contributor

😱 The following malformed YAML files and related errors were found:

python-malformed-yaml/test/test_yaml_files/bad.yaml:
while scanning a quoted scalar
in "python-malformed-yaml/test/test_yaml_files/bad.yaml", line 2, column 14
found unexpected end of stream
in "python-malformed-yaml/test/test_yaml_files/bad.yaml", line 3, column 1

python-malformed-yaml/test/test_yaml_files/bad.yml:
while scanning a quoted scalar
in "python-malformed-yaml/test/test_yaml_files/bad.yml", line 2, column 6
found unexpected end of stream
in "python-malformed-yaml/test/test_yaml_files/bad.yml", line 3, column 1

🥺 Please correct them and resubmit this PR.

Copy link
Contributor

😱 The following malformed YAML files and related errors were found:

python-malformed-yaml/test/test_yaml_files/bad.yaml:
while scanning a quoted scalar
in "python-malformed-yaml/test/test_yaml_files/bad.yaml", line 2, column 14
found unexpected end of stream
in "python-malformed-yaml/test/test_yaml_files/bad.yaml", line 3, column 1

python-malformed-yaml/test/test_yaml_files/bad.yml:
while scanning a quoted scalar
in "python-malformed-yaml/test/test_yaml_files/bad.yml", line 2, column 6
found unexpected end of stream
in "python-malformed-yaml/test/test_yaml_files/bad.yml", line 3, column 1

🥺 Please correct them and resubmit this PR.

Copy link
Contributor

😱 The following malformed YAML files and related errors were found:

python-malformed-yaml/test/test_yaml_files/bad.yaml:
while scanning a quoted scalar
in "python-malformed-yaml/test/test_yaml_files/bad.yaml", line 2, column 14
found unexpected end of stream
in "python-malformed-yaml/test/test_yaml_files/bad.yaml", line 3, column 1

python-malformed-yaml/test/test_yaml_files/bad.yml:
while scanning a quoted scalar
in "python-malformed-yaml/test/test_yaml_files/bad.yml", line 2, column 6
found unexpected end of stream
in "python-malformed-yaml/test/test_yaml_files/bad.yml", line 3, column 1

🥺 Please correct them and resubmit this PR.

Copy link
Member

Choose a reason for hiding this comment

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

As much as I'd like to, I don't think we can remove the code-formatter yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then I think it will fail every time, as the code formatter notices malformed yamls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See here: the code formatter notices the malformed YAML test files, can't fix them and fails the PR.

Copy link
Member

@jasonBirchall jasonBirchall left a comment

Choose a reason for hiding this comment

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

This is great. Just need to add format-code back in.

@tamsinforbes tamsinforbes merged commit 11e78e3 into main May 1, 2024
4 checks passed
@tamsinforbes tamsinforbes deleted the mal-yaml-to-python branch May 1, 2024 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants