1
1
Fork
You've already forked ecformat
0
A command line tool to keep files correct in respect of your EditorConfig
  • Rust 99.3%
  • Just 0.4%
  • Handlebars 0.3%
Michael Baumgartner 2292f08204
All checks were successful
/ release_validation (push) Successful in 1m49s
/ release_check (push) Successful in 7m55s
/ release_lint (push) Successful in 9m35s
/ release_test (push) Successful in 8m24s
/ release_targets (aarch64-unknown-linux-gnu) (push) Successful in 10m8s
/ release_targets (x86_64-pc-windows-gnu) (push) Successful in 5m22s
/ release_targets (x86_64-unknown-linux-gnu) (push) Successful in 4m32s
/ release_targets (x86_64-unknown-linux-musl) (push) Successful in 4m47s
/ release_crate_codeberg (push) Successful in 1m58s
/ release_crate_io (push) Successful in 1m55s
/ release_info (push) Successful in 43s
Bump to 0.2.0
2026年06月06日 14:01:30 +02:00
.forgejo Merge branch 'feature/38-status-command' 2026年06月04日 12:38:05 +02:00
.schemata Add REUSE.toml schema 2025年09月22日 10:28:25 +02:00
.vscode Fix spelling and formatting mistakes in comments 2026年05月30日 15:04:50 +02:00
LICENSES Avoid to miss relevant .editorconfig files 2026年06月01日 14:48:35 +02:00
src Fix spelling in comments 2026年06月05日 15:50:48 +02:00
tests Regression test for bug 47 2026年06月05日 14:53:38 +02:00
.codespellrc Linter: Ignore target folder 2026年01月04日 09:34:54 +01:00
.editorconfig Set spelling_language with EditorConfig 2026年06月03日 09:04:51 +02:00
.gitattributes Git: Configure line break handling 2025年09月23日 14:32:06 +02:00
.gitignore Add License informations with REUSE 2025年08月25日 18:38:49 +02:00
.pre-commit-config.yaml Upgrade linters 2026年06月05日 18:57:39 +02:00
.pre-commit-hooks.yaml Verbose pre-commit hooks 2026年02月22日 13:19:30 +01:00
.rustfmt.toml pre-commit: Only process changed file if possible 2025年09月22日 12:21:06 +02:00
.taplo.toml Add REUSE.toml schema 2025年09月22日 10:28:25 +02:00
.yamllint.yaml Add test action 2025年10月04日 16:18:08 +02:00
about.hbs Switch to markdown for cargo-about report 2025年10月01日 16:24:52 +02:00
about.toml Keep license lists in sync 2025年10月03日 19:39:43 +02:00
build.rs Fix cargo-about install 2026年06月06日 12:10:08 +02:00
Cargo.lock Bump to 0.2.0 2026年06月06日 14:01:30 +02:00
Cargo.toml Bump to 0.2.0 2026年06月06日 14:01:30 +02:00
deny.toml Remove solved RUSTSEC from ignore 2026年06月05日 19:29:34 +02:00
Development.md Fix indentation in Markdown files 2026年05月25日 17:37:01 +02:00
justfile Lint action(s) without pre-commit 2025年10月05日 10:57:39 +02:00
README.md Bump to 0.2.0 2026年06月06日 14:01:30 +02:00
REUSE.toml Add License informations with REUSE 2025年08月25日 18:38:49 +02:00
rust-toolchain.toml Update Rust version 2026年06月05日 18:15:12 +02:00

ecformat

A command line tool to keep files correct in respect of your EditorConfig.

Supported EditorConfig properties

The current ecformat version targets the version 0.17.2 of EditorConfig. Only if a property is set in your .editorconfig for a file, ecformat will handle this property on that file during the check, the fix and the status command. When processing file contents, the charset of your EditorConfig is respected. If there is no charset configured for a file, ecformat uses utf-8 as the fallback to process the other properties. For line based processing ecformat respects the end_of_line of your EditorConfig. If this is not set for a file, ecformat uses the default of your platform.

In the section Disable EditorConfig properties of the command helps (see ecformat help check, ecformat help fix or ecformat help status) you can find options to disable the handling of specific properties. In the following you can find details about how ecformat handles the properties of EditorConfig. They are listed in the order as ecformat processes them (e.g., fix first trims trailing whitespace before it may insert a final newline).

charset

ecformat determines the actual encoding of a file from its content. If that mismatch the configured one, the check has an error at that file and fix converts the content into the configured encoding.

end_of_line

ecformat considers all end of lines in a file. If not only the configured style is used, the check has an error at that file and fix changes all end of lines to the configured style.

trim_trailing_whitespace

ecformat only handles this property if it is set to true. If there are any trailing whitespace characters, the check has an error at that file and fix removes all this trailing whitespace characters.

insert_final_newline

ecformat only handles this property if it is set to true. If there is no newline at the end of a file the check has an error at that file and fix adds this missing newline.

Indentation

ecformat handles the properties indent_style, indent_size and tab_width together. For these indentation related properties the handling performance no syntactic parsing of source code. Therefore, the changes of the fix command for non-trivial cases should be used with caution. If they do not fit your needs, you should consider using a formatter specialist for your programming language.

At least indent_style or indent_size needs to be set, otherwise no validation of the settings is possible. However, it is recommended to use always both. If indent_style is set and none of the other two properties, the fix command assumes a default of tab_width = 4. This implies, that it case of indent_style = space a tab is replaced by 4 spaces. Otherwise, if indent_style is missing, the fix command adjusts an indentation using the tab style if at least one tab is part of the line indentation and in space style otherwise.

spelling_language

ecformat supports this property only for the check command. There it only checks that the spelling_langauge values are valid. For this it considers all .editorconfig files that may apply to the considered files. Checking the spelling in your files is out of scope for ecformat.

Installation

Codeberg Release Crate dependency status

You can find the installation options for each version in the respective release on Codeberg.

Rust Crate

Crates.io Version Crates.io Total Downloads

You can install the latest version of the crate from crates.io

cargo install --locked ecformat

Make sure you have the cargo bin directory (default is $HOME/.cargo/bin) in your PATH variable.

If you want to remove ecformat from your machine again, run the following:

cargo uninstall ecformat

It is also possible to use the crate as library in your Rust project (see Crate documentation for usage details). If you only use it in your build scripts, you should add it as a build dependency:

cargo add --build ecformat

As alternative to crates.io, you can use the ecformat Crate package on Codeberg (see there for details).

Pre-commit hooks

pre-commit

There are two pre-commit hooks available for ecformat.

repos:- repo:https://codeberg.org/BaumiCoder/ecformatrev:vx.y.z# Set exact ecformat version x.y.z herehooks:# Entire repository only if a .edtiorconfig file changes# (also recommended for stage manual)- id:ecformat_repoargs:["check","-v"]# default arguments (optional)# Only process the changed files- id:ecformatargs:["check","-v"]# default arguments (optional)

Download binary

The binaries of the versions are available for some common platforms in the ecformat_bin package on Codeberg.

Build from source

Another option is to build from source. If you have Rust installed, clone the repository and checkout the version you want to install.

git checkout tags/vx.y.z

For version x.y.z or download a source code archive from the respective release.

Make sure you have the cargo bin directory (default is $HOME/.cargo/bin) in your PATH variable. Then install the crate with the following command inside the repository / unpacked archive:

cargo install --locked --path .

If you want to remove ecformat from your machine again, run the following:

cargo uninstall ecformat

If you only want to create the binary for your platform, run the following to get it in the directory target/release:

cargo build --locked --release

License

REUSE status

The project is licensed under the Blue Oak Model License 1.0.0. A modern permissive license which is also easier to understand. You can find a brief FAQ on the steward's website.

The project uses REUSE for exact license annotations for every file as some of them have a different license.