diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 0000000..d3d7f0c --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1 @@ +{ "extends": ["@commitlint/config-conventional"] } diff --git a/.github/ISSUE_TEMPLATE/BUG.md b/.github/ISSUE_TEMPLATE/BUG.md new file mode 100644 index 0000000..d47b126 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG.md @@ -0,0 +1,20 @@ +--- +name: "πŸ› Bug Report" +about: "Report an unexpected problem or unintended behavior." +title: "[Bug]" +labels: "bug" +--- + + + +## Steps To Reproduce + +1. Step 1 +2. Step 2 + +## The current behavior + +## The expected behavior diff --git a/.github/ISSUE_TEMPLATE/DOCUMENTATION.md b/.github/ISSUE_TEMPLATE/DOCUMENTATION.md new file mode 100644 index 0000000..d9281a0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/DOCUMENTATION.md @@ -0,0 +1,18 @@ +--- +name: "πŸ“œ Documentation" +about: "Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...)." +title: "[Documentation]" +labels: "documentation" +--- + + + +## Documentation + + + + + + + +## Proposal diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md new file mode 100644 index 0000000..dc9a49c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -0,0 +1,20 @@ +--- +name: "✨ Feature Request" +about: "Suggest a new feature idea." +title: "[Feature]" +labels: "feature request" +--- + + + +## Description + + + +## Describe the solution you'd like + + + +## Describe alternatives you've considered + + diff --git a/.github/ISSUE_TEMPLATE/IMPROVEMENT.md b/.github/ISSUE_TEMPLATE/IMPROVEMENT.md new file mode 100644 index 0000000..e50e289 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/IMPROVEMENT.md @@ -0,0 +1,20 @@ +--- +name: "πŸ”§ Improvement" +about: "Improve structure/format/performance/refactor/tests of the code." +title: "[Improvement]" +labels: "improvement" +--- + + + +## Type of Improvement + + + + + + + + + +## Proposal diff --git a/.github/ISSUE_TEMPLATE/QUESTION.md b/.github/ISSUE_TEMPLATE/QUESTION.md new file mode 100644 index 0000000..df6acdc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/QUESTION.md @@ -0,0 +1,8 @@ +--- +name: "πŸ™‹ Question" +about: "Further information is requested." +title: "[Question]" +labels: "question" +--- + +### Question diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..247d99e --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ + + +# What changes this PR introduce? + +## List any relevant issue numbers + +## Is there anything you'd like reviewers to focus on? diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b598aec..f71406a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,13 +12,18 @@ env: jobs: ci: runs-on: "ubuntu-latest" + strategy: + matrix: + rust-version: ["1.74.0", "stable"] steps: - - uses: "actions/checkout@v4" - - uses: "dtolnay/rust-toolchain@stable" - with: - components: "clippy, rustfmt" - - run: "rustc --version" + - uses: "actions/checkout@v4.1.1" + - uses: "dtolnay/rust-toolchain@master" + with: + toolchain: "${{ matrix.rust-version }}" + components: "clippy, rustfmt" + + - run: "rustc --version" - run: "cargo build --verbose" - run: "cargo test --verbose" - run: "cargo clippy --verbose -- -D warnings" @@ -27,14 +32,35 @@ jobs: lint-markdown: runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v4" - - uses: "DavidAnson/markdownlint-cli2-action@v14" + - uses: "actions/checkout@v4.1.1" + + - uses: "DavidAnson/markdownlint-cli2-action@v15.0.0" with: - globs: "**/*.md" config: ".markdownlint-cli2.jsonc" + globs: "**/*.md" lint-commit: runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v4" - - uses: "wagoid/commitlint-github-action@v5" + - uses: "actions/checkout@v4.1.1" + + - uses: "wagoid/commitlint-github-action@v5.4.5" + with: + configFile: ".commitlintrc.json" + failOnWarnings: true + + lint-general: + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v4.1.1" + + - name: "Setup Node.js" + uses: "actions/setup-node@v4.0.1" + with: + node-version: "20.11.0" + + - run: "npm install --global editorconfig-checker@5.1.2" + - run: "npm install --global prettier@3.2.4" + + - run: "editorconfig-checker" + - run: "prettier . --check" diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc index f59f82e..08735ec 100644 --- a/.markdownlint-cli2.jsonc +++ b/.markdownlint-cli2.jsonc @@ -2,6 +2,7 @@ "config": { "default": true, "no-inline-html": false, + "no-duplicate-heading": false, /* Disables rules that may conflict with Prettier */ /* Reference: https://github.com/DavidAnson/markdownlint/blob/main/style/prettier.json */ @@ -26,7 +27,7 @@ "no-trailing-spaces": false, "ol-prefix": false, "strong-style": false, - "ul-indent": false + "ul-indent": false, }, - "globs": ["**/*.md"] + "globs": ["**/*.md"], } diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..86c23c7 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "semi": false +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..2571f37 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "editorconfig.editorconfig", + "esbenp.prettier-vscode", + "davidanson.vscode-markdownlint", + "rust-lang.rust-analyzer", + "tamasfe.even-better-toml" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..72dae6b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,18 @@ +{ + "rust-analyzer.check.command": "clippy", + "[rust]": { + "editor.defaultFormatter": "rust-lang.rust-analyzer", + "editor.tabSize": 4, + "editor.formatOnSave": true + }, + "[toml]": { + "editor.defaultFormatter": "tamasfe.even-better-toml", + "editor.formatOnSave": true + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "prettier.configPath": ".prettierrc.json", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll": "explicit" + } +} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..8a0c550 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# 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 +. +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][v2.0]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][mozilla coc]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][faq]. Translations are available +at [https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html +[mozilla coc]: https://github.com/mozilla/diversity +[faq]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..16927e3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,32 @@ +# πŸ’‘ Contributing + +Thanks a lot for your interest in contributing to **FileFormats**! πŸŽ‰ + +## Code of Conduct + +**FileFormats** adopted the [Contributor Covenant](https://www.contributor-covenant.org/) as its Code of Conduct, and we expect project participants to adhere to it. Please read [the full text](./CODE_OF_CONDUCT.md) so that you can understand what actions will and will not be tolerated. + +## Open Development + +All work on **FileFormats** happens directly on this repository. Both core team members and external contributors send pull requests which go through the same review process. + +## Types of contributions + +- Reporting a bug. +- Suggest a new feature idea. +- Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...). +- Improve structure/format/performance/refactor/tests of the code. + +## Pull Requests + +- **Please first discuss** the change you wish to make via [issue](https://git.theoludwig.fr/FileFormats/fileformats/issues) before making a change. It might avoid a waste of your time. + +- Ensure your code respect linting. + +- Make sure your **code passes the tests**. + +If you're adding new features to **FileFormats**, please include tests. + +## Commits + +The commit message guidelines adheres to [Conventional Commits](https://www.conventionalcommits.org/) and [Semantic Versioning](https://semver.org/) for releases. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..54e2fb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) ThΓ©o LUDWIG + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index ec8b5a6..a944a16 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,25 @@

FileFormats

- Documentation and Rust Implementation to learn how most famous file formats store data. + Documentation and Rust Implementation to learn how most famous file formats store data.

- FileFormats Logo + CONTRIBUTING + Licence MIT + Contributor Covenant +
+ Rust + Conventional Commits +

+ +

+ FileFormats Logo

--- -## About +## πŸ“œ About - [Documentation](./documentation/): Explains the theory for each file format, the advantages and disadvantages compared to other file formats in the same category, why it is stored in that way, and the **User Manual** for the implementation. - [`fileformats` Implementation](./src/): **Command-Line Interface and Rust Library** to cover most common features of each file format, and understand practically how the theory works. The features of the implementation include, but is not limited to, **read, write, convert, and compare** between file formats. @@ -19,10 +28,31 @@ ### Prerequisites -- [Rust](https://www.rust-lang.org/tools/install) >= v1.74.0 -- [cargo-run-bin](https://crates.io/crates/cargo-run-bin) >= v1.6.0 (`cargo install cargo-run-bin`) +#### Rust Toolchain -### Commands +The current Minimum Supported [Rust](https://www.rust-lang.org/) Version (MSRV) is **v1.74.0**. + +The project is **tested** against the following Rust versions: + +- **Minimum Supported Rust Version (MSRV): v1.74.0** +- **Latest Stable Version** + +#### Rust Globally Installed Crate + +[cargo-run-bin](https://crates.io/crates/cargo-run-bin) >= v1.7.2 (`cargo install cargo-run-bin`) + +#### External Linting Tools (optional) + +**External linting tools** are used to ensure a consistent code style and commit message format. They are **used in the Continuous Integration (CI)** pipeline and **can be optionally used locally**. + +They have to be installed using [Node.js](https://nodejs.org/) >= v20.0.0 and [npm](https://www.npmjs.com/) >= v10.0.0. + +- [editorconfig-checker](https://editorconfig-checker.github.io/) (`npm install --global editorconfig-checker@5.1.2`) +- [Prettier](https://prettier.io/) v3.2.4 (`npm install --global prettier@3.2.4`) +- [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) v0.12.1 (`npm install --global markdownlint-cli2@0.12.1`) +- [commitlint](https://commitlint.js.org/#/) v18.6.0 (`npm install --global @commitlint/cli@18.6.0 @commitlint/config-conventional@18.6.0`) + +### Usage ```sh # Run `fileformats` CLI @@ -36,4 +66,20 @@ cargo build cargo test cargo clippy --verbose -- -D warnings cargo fmt -- --check + +# External Linting Tools Usage (optional) +editorconfig-checker +prettier . --check +markdownlint-cli2 +echo 'chore: try commitlint' | commitlint ``` + +## πŸ’‘ Contributing + +Anyone can help to improve the project, submit a Feature Request, a bug report or even correct a simple spelling mistake. + +The steps to contribute can be found in the [CONTRIBUTING.md](./CONTRIBUTING.md) file. + +## πŸ“„ License + +[MIT](./LICENSE)