Skip to main content

Commitizen tools plugin with Espressif code style

Project description

Commitizen Espressif style plugin

Commitizen tools plugin with Espressif code style

Release Pre-commit Conventional Commits



Introduction

This is a plugin for Commitizen that makes it easy to create and maintain a well-organized and good-looking CHANGELOG.md.

It also takes care of version bumping and helps you write commit messages that follow Espressif standards.

All of this with minimal config and setup, so your pyproject.toml file stays clean and simple.


Install

Of course, you have already created and activated a Python virtual environment... then:

pip install czespressif

.... and add snippet from Minimal setup - that's it 🤝.

You can also add it to your project dev dependencies (suggested) and run the sync command (pipenv sync, pip-sync, poetry install, ...).

Commitizen itself is in the plugin's dependencies, so pip will take care of everything.

[!WARNING] Don't try to install it system-wide with pipx.

This is a plugin, and that's probably not going to work as you expect.

Build Changelog

If a changelog already exists in your project, make sure you have staged or committed its latest version.

This command turns your old changelog into a nicely organized template based on the Keep Changelog standard.

cz changelog

Bump Release version

Is better to first run:

cz bump --dry-run

This only shows the future version and the part of the changelog that will be updated. When all ok, do the same without --dry-run flag.

Write commit message

In case anyone actually prefers this way of creating commit messages, the command:

cz commit

in this plugin is aligned with the Espressif commit linter and DangerJS linters. You can give it a try...

? Select the type of change you are committing (Use arrow keys)
 » feat                     ✨ A new feature
   fix                      🐛 A bug fix
   change                   🏗️ A change made to the codebase.
   docs                     📖 Documentation only change
   test                     🚦  Adding missing or correcting existing tests
   ci                       ⚙️ Changes to CI configuration files and scripts
   refactor                 🔧 A changeset neither fixing a bug nor adding a feature
   revert                   🔙 Revert one or more commits
   remove                   🗑️ Removing code or files

Example

If you are unsure about the commit message standard, hit:

cz example

This will bring up a complete example of good commit messages and commit schema in the terminal.


Configuration

Config is accepted in pyproject.toml (priority, following example), .cz.toml, .cz.json, cz.json, .cz.yaml, cz.yaml, and cz.toml.

Minimal setup

[!TIP] Try to be minimalistic with custom configs. The best approach is to keep the defaults, so all Espressif projects maintain the same look and feel. Also, you will save yourself troubles with non-standard setups.

[tool.commitizen]
   name            = "czespressif"
   bump_message    = 'change(bump): release $current_version → $new_version [skip-ci]'

Optimal setup

[tool.commitizen]
  name            = "czespressif"
  bump_message    = 'change(bump): release $current_version → $new_version [skip-ci]'

  # see commitizen docs, following are standard configs
  annotated_tag = true
  changelog_merge_prerelease = true
  tag_format = "v$version"
  update_changelog_on_bump = true

Additional configurable parameters

[tool.commitizen]
    ...
    changelog_title = "Our changelog"  # custom text of changelog title
    changelog_header = "This is our changelog.\nAll cool things we do are here.\n\nPlease read it."  # custom text of changelog header
    changelog_footer = "This is the end of our changelog.\n\nMore cool things are coming."  # custom text of changelog footer
    changelog_section_line = false  # default (true); false = removes horizontal lines between releases
    changelog_unreleased = false  # default (true); false = removes section Unreleased, keeps only releases
    changelog_show_authors = false # default (true); false = removes authors of the changes (commit)
    changelog_show_commits = false # default (true); false = removes commit short sha of the changes

    change_type_order = [  # in which order sections goes in changelog; if you use emojis include them | this here is default order
        '🚨 Breaking changes',
        '✨ New features',
        '🐛 Bug fixes',
        '📖 Documentation',
        '🏗️ Changes',
        '🔧 Refactoring',
        '🗑️ Removals',
        '⚙️ CI and project settings',
        '🚦 Testing',
        '🔙 Reverted',
    ]

    change_type_order = [  # same, with disabled emojis | this here is default order
        'Breaking changes',
        'New features',
        'Bug fixes',
        'Documentation',
        'Changes',
        'Refactoring',
        'Removals',
        'CI and project settings',
        'Testing',
        'Reverted',
    ]

    change_type_map = # dependent on mapping in default types, only types with "changelog = True"
    types_in_changelog = ["feat", "fix", "refactor", "style", "ci"] # redefine which types are shown in changelog

    use_emoji = false  # default (true); false = removes emojis from changelog and commit UI (emojis are never added in the commit messages)

    [[tool.commitizen.extra_types]]  # add extra types for 'cz commit' and changelog
        type        = "style"
        heading     = "Code Style"
        emoji       = "🎨"
        description = "Changes that do not affect the meaning of the code (white-space, formatting, etc.)"
        bump        = "PATCH"
        changelog   = true

Contributing

We welcome contributions from the community! Please read the Contributing Guide to learn how to get involved.

License

This repository is licensed under the Apache 2.0 License.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

czespressif-0.2.5.tar.gz (29.6 kB view hashes)

Uploaded Source

Built Distribution

czespressif-0.2.5-py3-none-any.whl (22.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page