Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.
/ autopretty Public archive

Sample Copier template to properly reformat and lint your code

License

Notifications You must be signed in to change notification settings

copier-org/autopretty

Repository files navigation

Autopretty - the automated code prettifier

Are you tired of configuring .pre-commit-config.yaml all over your projects, and keeping those up-to-date?

Me too. 🤦‍

Thus, here's autopretty. It uses Copier to keep your projects updated with the latest code formatters and linters.

1st usage

  1. Install Copier
  2. Install pre-commit
  3. Enter your project folder: cd my-project
  4. Make it a git repo: git init
  5. Run copier copy https://github.com/copier-org/autopretty.git .
  6. Answer questions
  7. Activate pre-commit: pre-commit install
  8. Commit: git commit -am 'Apply autoprettier' (repeat if pre-commit reformats anything and makes the update fail)
  9. Update your code pre-commit run -a
  10. Commit: git commit -am 'Run pre-commit'

Get updates

  1. Enter your project folder: cd my-project
  2. Update: copier -a .copier-answers.autopretty.yml update
  3. Answer questions, if anything changed
  4. Commit: git commit -am 'Update autoprettier' (repeat if pre-commit reformats anything and makes the update fail)
  5. Update your code pre-commit run -a
  6. Commit: git commit -am 'Run pre-commit'

Notes for template maintainers

This template is self-applied, and as you can imagine, there are some 🐔+🥚 situations.

To update it:

  1. Publish a new release on Github
  2. git fetch --tags
  3. copier -a .copier-answers.autopretty.yml --prereleases update

In case you want to self-test a new release locally:

  1. git tag v0.1.0a99 ... or the version that you will release.
  2. copier -a .copier-answers.autopretty.yml --prereleases update
  3. Once you're happy: git tag -d v0.1.0a99
  4. Open PR.
  5. Merge it.
  6. Release.
  7. Do the proper update.

At some point, this should be automated easily.