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

Initial commit of a Bash script to extract YAML front matter #408

Draft
wants to merge 7 commits into
base: staging
Choose a base branch
from

Conversation

wesley-dean-gsa
Copy link
Contributor

All this does is import a script to extract YAML front matter from a Markdown file. It doesn't do any linting.

security considerations

None come to mind.

@wesley-dean-gsa wesley-dean-gsa requested a review from a team as a code owner September 30, 2024 18:19
@wesley-dean-gsa wesley-dean-gsa linked an issue Sep 30, 2024 that may be closed by this pull request
@wesley-dean-gsa wesley-dean-gsa changed the base branch from main to staging September 30, 2024 18:19
@ximekilgsa
Copy link
Contributor

@wesley-dean-gsa Can we chat about this? Just looking to understand what this does, if it's not linting, since we already have the YAML being rendered correctly

@wesley-dean-gsa
Copy link
Contributor Author

@wesley-dean-gsa Can we chat about this? Just looking to understand what this does, if it's not linting, since we already have the YAML being rendered correctly

Correct, it's not linting -- it's just extracting the front matter. The linting of the YAML will be done by a YAML linter and that'll be in a subsequent step.

This accomplishes step 3 of the below:

  1. match a .md file
  2. create a temporary file (mktemp)
  3. extract the front matter from that file and write it to the temporary file
  4. lint the temporary file with yamllint
  5. use sed to rewrite the filename of the linter from the temporary file back to the original filename so the errors correspond to the real file and not the temporary one
  6. remove the temporary file

Step 1 is accomplished by the CI/CD pipeline (MegaLinter, specifically). Steps 2, 4, 5, and 6 have not been written yet.

@wesley-dean-gsa wesley-dean-gsa marked this pull request as draft September 30, 2024 20:40
Copy link

github-actions bot commented Sep 30, 2024

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 4 0 0.07s
✅ BASH shellcheck 5 0 0.18s
✅ BASH shfmt 5 0 0 0.25s
⚠️ CSS scss-lint 2 1 3.61s
✅ JAVASCRIPT prettier 6 0 0 1.21s
✅ JSON jsonlint 7 0 0.23s
✅ JSON npm-package-json-lint yes no 0.48s
✅ JSON prettier 7 0 0 1.34s
✅ JSON v8r 7 0 10.52s
⚠️ MARKDOWN markdownlint 31 0 8 2.09s
✅ MARKDOWN markdown-link-check 31 0 15.1s
✅ MARKDOWN markdown-table-formatter 31 0 0 0.51s
✅ REPOSITORY checkov yes no 15.07s
✅ REPOSITORY gitleaks yes no 0.29s
✅ REPOSITORY git_diff yes no 0.21s
✅ REPOSITORY grype yes no 14.8s
✅ REPOSITORY secretlint yes no 3.03s
⚠️ REPOSITORY trivy yes 1 2.35s
✅ REPOSITORY trivy-sbom yes no 1.1s
✅ REPOSITORY trufflehog yes no 3.79s
⚠️ SPELL cspell 31 32 4.27s
✅ YAML prettier 16 0 0 1.34s
✅ YAML v8r 12 0 13.25s
✅ YAML yamllint 16 0 0.5s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@wesley-dean-gsa
Copy link
Contributor Author

This adds a script to actually do YAML linting on the Markdown front matter. It's not set to run against anything, but at least it's a tool that exists. We'll get it integrated in the next step.

@wesley-dean-gsa
Copy link
Contributor Author

I'm not sure if this is the direction to take any more. If we replace the Markdown files in pages/jointts/positions/ with YAML, then this becomes a non-issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Find a way to lint YAML front matter in Markdown
2 participants