diff --git a/.github/ISSUE_TEMPLATE/bug-report-form.yml b/.github/ISSUE_TEMPLATE/bug-report-form.yml new file mode 100644 index 00000000..7ece7485 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report-form.yml @@ -0,0 +1,41 @@ +name: Bug Report Form +description: Form that guides you to create a bug report. +title: "[Bug] " +# Source partially taken from: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: input + id: contact + attributes: + label: Contact Details + description: How can we get in touch with you if we need more information? + placeholder: ex. email@example.com + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what happened! + - type: input + id: version + attributes: + label: Version + description: What version of our software where you running? + placeholder: ex. v1.0.1 or post the git commit hash + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/unimarkup/unimarkup-rs/blob/main/CODE_OF_CONDUCT.md). + options: + - label: I agree to follow this project's Code of Conduct + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..76d04b45 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Project Discussions + url: https://github.com/unimarkup/unimarkup-rs/discussions + about: Please ask and answer questions here. diff --git a/.github/ISSUE_TEMPLATE/frontend-issue.md b/.github/ISSUE_TEMPLATE/frontend-issue.md deleted file mode 100644 index 8b7b35b5..00000000 --- a/.github/ISSUE_TEMPLATE/frontend-issue.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Frontend issue -about: General issue about frontend implementations -title: "[Frontend] " -labels: frontend -assignees: '' - ---- - - diff --git a/.github/ISSUE_TEMPLATE/general-issue.md b/.github/ISSUE_TEMPLATE/general-issue.md deleted file mode 100644 index f07c8905..00000000 --- a/.github/ISSUE_TEMPLATE/general-issue.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: General issue -about: General issue for unimarkup-rs -title: "[General] " -labels: '' -assignees: '' - ---- - - diff --git a/.github/ISSUE_TEMPLATE/middle-end-issue.md b/.github/ISSUE_TEMPLATE/middle-end-issue.md deleted file mode 100644 index a051416d..00000000 --- a/.github/ISSUE_TEMPLATE/middle-end-issue.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Middle end issue -about: General issue about middle end implementations -title: "[Middle end] " -labels: middle end -assignees: '' - ---- - - diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 7460d0f3..a7ac5a92 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -13,16 +13,13 @@ jobs: with: release-type: rust package-name: unimarkup-rs + pull-request-title-pattern: "chore: release${component} ${version}" + # Breaking changes might happen frequently before 1.0.0 => only bump minor + bump-minor-pre-major: true changelog-types: > [ {"type":"feat","section":"Features","hidden":false}, {"type":"fix","section":"Bug Fixes","hidden":false}, - {"type":"ci","section":"CI","hidden":false}, - {"type":"build","section":"Build","hidden":false}, - {"type":"chore","section":"Miscellaneous","hidden":true}, - {"type":"docs","section":"Documentation","hidden":false}, - {"type":"style","section":"Code Style","hidden":true}, - {"type":"refactor","section":"Refactoring","hidden":true}, - {"type":"perf","section":"Performance","hidden":false}, - {"type":"test","section":"Testing","hidden":false} + {"type":"arch","section":"Architecture/Refactor","hidden":false}, + {"type":"chore","section":"Miscellaneous","hidden":true} ] diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 02b16e9a..59d87254 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,38 +10,31 @@ env: CARGO_TERM_COLOR: always jobs: - build: - name: Run Build - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose - - test: - name: Run Tests + format: + name: Check Formatting runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Run tests - run: cargo test --verbose - + - name: Run cargo fmt + run: cargo fmt -- --check + lint: name: Run Linter (clippy) runs-on: ubuntu-latest + needs: format steps: - uses: actions/checkout@v2 - name: Run linter run: cargo clippy -- -D warnings - - format: - name: Check Formatting + + test: + name: Run Tests runs-on: ubuntu-latest + needs: lint steps: - uses: actions/checkout@v2 - - name: Run cargo fmt - run: cargo fmt -- --check + - name: Run tests + run: cargo test --verbose diff --git a/.hooks/commit-msg b/.hooks/commit-msg index 6af496b9..d08e0bf3 100755 --- a/.hooks/commit-msg +++ b/.hooks/commit-msg @@ -3,51 +3,47 @@ # first (and only) argument is whether we abort commit or not print_help() { if $1; then - echo -e "Aborting commit. Your commit message does not follow the Conventional Commits specification.\n" >&2 + echo -e "Aborting commit! Your commit message does not follow the Conventional Commits Specification.\n" >&2 fi echo -e "Commit message structure: \n" >&2 - echo -e "\t[()]: " >&2 + echo -e "\t: " >&2 echo -e "\n\t[]" >&2 echo -e "\n\t[]" >&2 - echo -e "\nWhere '[()]: ' is not longer than 50 characters and is one of:\n" >&2 + echo -e "\nWhere ': ' is not longer than 50 characters and is one of:\n" >&2 - echo -e "- fix: Fix a code bug" >&2 - echo -e "- feat: Add a new feature" >&2 - echo -e "- ci: Changes to CI configuration files and scripts" >&2 - echo -e "- build: Changes that affect the build system or external dependencies" >&2 - echo -e "- chore: Miscellaneous (should only be used for automatically generated commits)" >&2 - echo -e "- docs: Documentation only changes" >&2 - echo -e "- style: Changes that do not affect the semantic of the code" >&2 - echo -e "- refactor: A code change that neither fixes a bug nor adds a feature" >&2 - echo -e "- perf: A code change that improves performance" >&2 - echo -e "- test: Adding tests or correcting existing tests" >&2 - echo -e "- revert: Revert a commit. should be header of reverted commit\n" >&2 + echo -e "- feat \t\t... Use if commit adds a new feature" >&2 + echo -e "- fix \t\t... Use if commit fixes a bug of any kind" >&2 + echo -e "- arch \t\t... Use if commit neither adds features nor fixes bugs (e.g. renaming or restructuring)" >&2 + echo -e "- chore \t... Miscellaneous (should only be used for automatically generated commits)" >&2 - echo -e "NOTE: [(&2 + echo -e "\nNOTE: If your commit fits to types 'feat' and 'fix', try to split your commit." >&2 + + echo -e "NOTE: may be immediately followed by a '!' to indicate breaking changes." >&2 + echo -e "NOTE: Use '!' instead of writing 'BREAKING CHANGE: ' in the '[]'.\n" >&2 echo -e "Examples: \n" >&2 - echo -e "feat(frontend): improve log message" >&2 - echo -e "feat(backend)!: indicate a breaking change" >&2 + echo -e "feat: improve log message on bad request" >&2 + echo -e "feat!: indicate a breaking change" >&2 echo -e "fix: fix some bug" >&2 - echo -e "\nFor more, see: \nhttps://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines and \nhttps://www.conventionalcommits.org/en/v1.0.0/" >&2 + echo -e "\nFor more information, see: \nhttps://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines \nhttps://www.conventionalcommits.org/en/v1.0.0/" >&2 } RED="\033[31m" YELLOW="\033[33m" CLEAR="\033[0m" -if ! head -1 "$1" | grep -qE "^(feat|fix|ci|build|chore|docs|test|style|refactor|perf|revert)(\(.+?\))?[!]?: .{1,}$"; then +if ! head -1 "$1" | grep -qE "^(feat|fix|arch|chore)[!]?: .{1,}$"; then echo -e "${RED}\nERROR: Given commit type is wrong!${CLEAR}\n" >&2 print_help true exit 1 fi if ! head -1 "$1" | grep -qE "^.{1,50}$"; then - echo -e "${YELLOW}\nWARNING: '[()]: ' should not have more than 50 characters!${CLEAR}\n" >&2 + echo -e "${YELLOW}\nWARNING: ': ' should not have more than 50 characters!${CLEAR}\n" >&2 print_help false fi \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..30c80605 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +[@HatzlManuel](https://twitter.com/HatzlManuel). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 07c10059..6cd8c04b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,103 +1,135 @@ # Contributing to unimarkup-rs -Thank you for considering to contribute to unimarkup-rs, it means a lot to us! -Below are the most important guidelines to get you started. +Thank you for considering contributing to `unimarkup-rs`, it means a lot to us!\ +Below are the most important topics to get you started. -- [Commit-Message-Guidelines](#commit-message-guidelines) +- [Discussions](#discussions) +- [Issue/PR Labels](#issuepr-labels) +- [Development Setup](#development-setup) +- [Commit Message Convention](#commit-message-convention) -## Commit Message Guidelines +## Discussions -We have very precise rules over how our git commit messages can be formatted. This leads to **more -readable messages** that are easy to follow when looking through the **project history**. But also, -we use the git commit messages to **generate the unimarkup-rs change log**. +We use [GitHub Discussions](https://github.com/unimarkup/unimarkup-rs/discussions) for exchanges with the community. +It is a good place to start if you have any questions. + +## Issue/PR Labels + +There are two labels to help possible contributors to get involved: + +- [good-first-issue](https://github.com/unimarkup/unimarkup-rs/labels/good-first-issue) ... This label is used to mark issues that should be easy to implement **without** extensive understanding of the project +- [help-needed](https://github.com/unimarkup/unimarkup-rs/labels/help-needed) ... This label is used to mark issues, where project members need help to resolve it + +For better asynchronous communication, we use the following labels: + +- [waiting-on-assignee](https://github.com/unimarkup/unimarkup-rs/labels/waiting-on-assignee) ... This label is used to indicate that the author or reviewer is awaiting response from the assignee +- [waiting-on-author](https://github.com/unimarkup/unimarkup-rs/labels/waiting-on-author) ... This label is used to indicate that the assignee or reviewer is awaiting response from the author +- [waiting-on-reviewer](https://github.com/unimarkup/unimarkup-rs/labels/waiting-on-reviewer) ... This label is used to indicate that the assignee or author is awaiting response from the reviewer + +To keep track of feature requests, we use the following labels: + +- [declined](https://github.com/unimarkup/unimarkup-rs/labels/declined) ... This label is used to mark issues/PRs that they won't be considered/implemented further +- [req-ready](https://github.com/unimarkup/unimarkup-rs/labels/req-ready) ... This label is used to mark `[REQ]` issues that they have enough information to be implemented + +## Development Setup + +We use the following tools for development: + +1. [rustup](https://rustup.rs/) to install the Rust toolchain (cargo, clippy, rustc, rustfmt etc) +2. [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) as a Language Server to be used with LSP +3. `clippy` as linter. i.e. for VS Code this setting is in the `rust-analyzer` extension settings (Change `cargo check` command to `clippy`) +4. Optional: Enable auto-formatting of the code, by using `rustfmt` default settings + +Add-ons for testing: + +- [insta](https://github.com/mitsuhiko/insta) for snapshot testing +- [nextest](https://github.com/nextest-rs/nextest) for better formatted test output + +## Commit Message Convention + +We have our own convention for git commit messages that are inspired by [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).\ +This leads to more **readable** messages that are easy to follow when looking through the [project's history](https://github.com/unimarkup/unimarkup-rs/commits/main). +In addition, we use git commit messages to automatically generate a **change log** using [release-please](https://github.com/googleapis/release-please) from Google. +As a result, commit messages not following our convention won't appear in the generated change log. + +**Note:** We use `squash merging` for pull requests, so we are able to correct your commit messages, but please try to stick to the convention to make merging easier for us. ### Commit Message Format -Each commit message consists of a **header**, a **body** and a **footer**. The header has a special -format that includes a **type**, a **scope** and a **subject**: +Each commit message consists of a **header**, a **body**, and a **footer**.\ +The header itself consists of a **type** and a **subject**: ~~~ -(): +: