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

style: use prettier to format toml and yaml files #11237

Merged
merged 8 commits into from
Jan 13, 2024

Conversation

vil02
Copy link
Member

@vil02 vil02 commented Jan 12, 2024

Describe your change:

ruff.yml has some bad indentation. This PR fixes it.

  • Fix a bug or typo in an existing workflow

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.

@vil02 vil02 marked this pull request as ready for review January 12, 2024 17:52
@vil02 vil02 requested a review from cclauss as a code owner January 12, 2024 17:52
@algorithms-keeper algorithms-keeper bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Jan 12, 2024
@cclauss
Copy link
Member

cclauss commented Jan 12, 2024

Let's have machines do this kind of editing so humans can focus on bigger tasks...

Let's add prettier or some other yaml formatter to our .pre-commit-config.yaml file to make yaml formatting automatic.

@vil02
Copy link
Member Author

vil02 commented Jan 12, 2024

I support this idea, although the yaml files in this repository do not seem to change very often. It is not that straightforward: formatters remove comments, yamllint (with default settings) returns lots of other errors and warnings (which are not that important, in my opinion):

./.pre-commit-config.yaml
  1:1       warning  missing document start "---"  (document-start)
  16:8      error    too many spaces after hyphen  (hyphens)
  16:5      error    wrong indentation: expected 6 but found 4  (indentation)
  59:29     warning  too few spaces before comment  (comments)

./.gitpod.yml
  1:1       warning  missing document start "---"  (document-start)

./.github/stale.yml
  4:1       warning  missing document start "---"  (document-start)
  6:81      error    line too long (94 > 80 characters)  (line-length)
  7:81      error    line too long (113 > 80 characters)  (line-length)
  10:81     error    line too long (103 > 80 characters)  (line-length)
  13:81     error    line too long (98 > 80 characters)  (line-length)
  36:81     error    line too long (91 > 80 characters)  (line-length)
  40:81     error    line too long (83 > 80 characters)  (line-length)
  48:81     error    line too long (98 > 80 characters)  (line-length)
  62:81     error    line too long (83 > 80 characters)  (line-length)

./.github/workflows/build.yml
  1:1       warning  missing document start "---"  (document-start)
  3:1       warning  truthy value should be one of [false, true]  (truthy)
  6:25      warning  too few spaces before comment  (comments)

./.github/workflows/project_euler.yml
  1:1       warning  missing document start "---"  (document-start)
  1:1       warning  truthy value should be one of [false, true]  (truthy)
  3:81      error    line too long (88 > 80 characters)  (line-length)
  9:25      warning  too few spaces before comment  (comments)
  25:81     error    line too long (112 > 80 characters)  (line-length)

./.github/workflows/ruff.yml
  2:1       warning  missing document start "---"  (document-start)
  3:1       warning  truthy value should be one of [false, true]  (truthy)

./.github/workflows/directory_writer.yml
  1:81      error    line too long (84 > 80 characters)  (line-length)
  3:1       warning  missing document start "---"  (document-start)
  4:1       warning  truthy value should be one of [false, true]  (truthy)
  19:81     error    line too long (81 > 80 characters)  (line-length)
  20:81     error    line too long (116 > 80 characters)  (line-length)

./.github/ISSUE_TEMPLATE/config.yml
  1:1       warning  missing document start "---"  (document-start)

./.github/ISSUE_TEMPLATE/feature_request.yml
  1:1       warning  missing document start "---"  (document-start)
  8:81      error    line too long (118 > 80 characters)  (line-length)
  9:81      error    line too long (81 > 80 characters)  (line-length)

./.github/ISSUE_TEMPLATE/other.yml
  1:1       warning  missing document start "---"  (document-start)

./.github/ISSUE_TEMPLATE/bug_report.yml
  1:1       warning  missing document start "---"  (document-start)
  8:81      error    line too long (110 > 80 characters)  (line-length)
  46:81     error    line too long (84 > 80 characters)  (line-length)

I can have a look at this problem. However, it seems to be out of scope for this PR.

@cclauss
Copy link
Member

cclauss commented Jan 12, 2024

Linter != formatter. Let’s focus on prettier, not yamllint.

@vil02 vil02 marked this pull request as draft January 13, 2024 08:54
@vil02 vil02 force-pushed the fix_indentation_in_ruff branch from bc7a126 to 3dc5926 Compare January 13, 2024 09:10
@vil02
Copy link
Member Author

vil02 commented Jan 13, 2024

@cclauss Please let me know when you are done...

@vil02 vil02 marked this pull request as ready for review January 13, 2024 09:19
@vil02 vil02 requested a review from cclauss January 13, 2024 10:05
@cclauss
Copy link
Member

cclauss commented Jan 13, 2024

Can you
% git pull
Remove the exclude on 68-71 and then run the following on your local machine?
% pre-commit install
% pre-commit run --all-files

The problem with running this on GitHub Actions is that it does not allow changes to be made to GHA files.

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Nice!

@cclauss cclauss merged commit 13559ae into TheAlgorithms:master Jan 13, 2024
@cclauss cclauss changed the title style: use proper indentation in ruff.yml style: use prettier to format toml and yaml files Jan 13, 2024
@vil02 vil02 deleted the fix_indentation_in_ruff branch January 14, 2024 10:43
sedatguzelsemme pushed a commit to sedatguzelsemme/Python that referenced this pull request Sep 15, 2024
* style: use proper indentation in `ruff.yml`

* chore: run `prettier` on `yml` files

* Update .pre-commit-config.yaml

* Update .pre-commit-config.yaml

* Update .pre-commit-config.yaml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update .pre-commit-config.yaml

* chore: run prettier on workflow files

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@isidroas isidroas mentioned this pull request Jan 25, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants