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

Linting #24

Closed
wants to merge 3 commits into from
Closed

Linting #24

wants to merge 3 commits into from

Conversation

tkphd
Copy link

@tkphd tkphd commented Mar 28, 2023

This PR corrects a few typographical errors, addresses issues raised by MarkdownLint and YamlLint,
harmonizes line wrapping to the "semantic-and-length" style demonstrated in CONTRIBUTING.md,
and appends missing new-lines where needed for POSIX compliance.
To help remove some tedium from maintaining this style, a basic .editorconfig is provided.

@github-actions
Copy link

⚠️ WARNING ⚠️

This pull request contains a mix of workflow files and regular files. This could be malicious. No preview will be created.

regular files:

  • .editorconfig
  • .gitignore
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • LICENSE.md
  • README.md
  • config.yaml
  • episodes/introduction.md
  • index.md
  • instructors/instructor-notes.md
  • learners/reference.md
  • links.md
  • profiles/learner-profiles.md
  • site/README.md

workflow files:

  • .github/workflows/README.md
  • .github/workflows/pr-close-signal.yaml
  • .github/workflows/pr-comment.yaml
  • .github/workflows/pr-post-remove-branch.yaml
  • .github/workflows/pr-preflight.yaml
  • .github/workflows/pr-receive.yaml
  • .github/workflows/sandpaper-main.yaml
  • .github/workflows/update-cache.yaml
  • .github/workflows/update-workflows.yaml

Copy link
Contributor

@zkamvar zkamvar left a comment

Choose a reason for hiding this comment

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

Thank you for this pull request, @tkphd! I really appreciate the time you took to put this together.

Unfortunately, I'm going to have to close this because it mixes workflow files and there some adjustments I would like to see (comments inline).

harmonizes line wrapping to the "semantic-and-length" style demonstrated in [CONTRIBUTING.md]
(https://raw.githubusercontent.com/carpentries/workbench-template-md/main/CONTRIBUTING.md),

The CONTRIBUTING document should not be used as the "semantic-and-length" style at the moment. It has some problems that really need to be addressed (but @carpentries/core-team-curriculum has been running a skeleton crew since November and haven't had much time to adjust that).

and appends missing new-lines where needed for POSIX compliance.

Can you explain this a bit further?

Where To contribute

I also wanted to direct you to the right place to adjust these files, because the template files are all sourced from the {sandpaper} R package.

Content files are generated from these templates: https://github.com/carpentries/sandpaper/tree/main/inst/templates

Workflow files are provisioned from these files: https://github.com/carpentries/sandpaper/tree/main/inst/workflows

I don't have the best workflow for updating the template repositories (workbench-template-md and workbench-template-rmd), as that involves me manually making the changes in the repositories.


# Wrap Markdown at 75 characters
[*.md]
max_line_length = 75
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be good to use the .editorconfig from https://github.com/carpentries/styles, as that is the standard our lessons previously conformed to and also does not trim trailing WS in markdown.

Is there a way to exclude the files inside of .github/workflow/?

@@ -1,3 +1,4 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

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

These three lines are in all of the YAML files and I'm not sure how GitHub will react

Copy link
Author

Choose a reason for hiding this comment

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

GitHub will react just fine, since it conforms to the YAML standard.


# Which carpentry is this (swc, dc, lc, or cp)?
# Which carpentry is this? Choose one of:
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh this is much clearer, thank you!

Comment on lines +106 to 117
body: >
:robot: This is an automated build

This will update ${{ steps.update.outputs.n }} packages in your lesson with the following versions:
This will update ${{ steps.update.outputs.n }} packages
in your lesson with the following versions:


```

${{ steps.update.outputs.report }}

```
Copy link
Contributor

Choose a reason for hiding this comment

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

I worry about this change because ${{ steps.update.outputs.report }} is a mutli-line variable (see example in carpentries/sandpaper-docs#132) and it would collapse into a single line if I left it alone or, if I the function that produces the report, then outdated workflows would have a doubling of the number of lines.

#------------------------------------------------------------
# Values for this lesson.
#------------------------------------------------------------
---
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an artifact of yaml lint or of markdown lint?

Copy link
Author

Choose a reason for hiding this comment

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

YAML lint: the YAML standard requires that each YAML document begins with the --- (comments or magics above are OK).

Copy link
Contributor

Choose a reason for hiding this comment

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

from what I understand, it's not a requirement per-se, but it could optionally be added as a requirement for a given implementation and is left to opinion.

Neither GitHub nor any of the handlers we use enable the document-start requirement, so it would be better to configure the linter to use document-start: disable (as we do in glosario)

Copy link
Author

Choose a reason for hiding this comment

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

While it is not regularly enforced, but it is still part of the YAML standard. Since this repository is a template for others to use, I am in favor of stricter adherence to standards; downstream repositories can relax if they so choose.

Also, and perhaps more convincingly, the "---" makes a tidy delineation between the top-level comment explaining what a file is for, and the implementation and section-specific comments in the data itself. For example, config.yaml currently dives right in to "Values for this lesson" which is unclear. We could (should) lead in, along the lines of

# Configuration and template parameters for your lesson.
# Values modified here will propagate through the website
# when you build it, setting the appropriate
# logo/theme, contact info, and episode structure.
---

# -----------------------
# Values for this lesson.
# -----------------------
...

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you open an issue in {sandpaper} for this? I will revisit after the transition in May.

Copy link
Author

Choose a reason for hiding this comment

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

@tkphd
Copy link
Author

tkphd commented Mar 30, 2023

Thanks for the feedback @zkamvar. I can split the edits between separate workflow and regular file PRs, address your comments in the process, and make PRs against the upstream repo(s) where appropriate.

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

Successfully merging this pull request may close these issues.

2 participants