diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 54b2e85..0000000 --- a/.editorconfig +++ /dev/null @@ -1,29 +0,0 @@ -# Editor configuration, see http://editorconfig.org -root = true - -[*] -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true -charset = utf-8 -indent_style = space -indent_size = 2 - -# Ignore diffs/patches -[*.{diff,patch}] -end_of_line = unset -insert_final_newline = unset -trim_trailing_whitespace = unset -indent_size = unset - -[*.md] -max_line_length = off -trim_trailing_whitespace = false - -[tests/cases/**] -end_of_line = unset -insert_final_newline = unset -trim_trailing_whitespace = unset -charset = unset -indent_style = unset -indent_size = unset diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f95a7f..b7f17aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,9 +17,40 @@ Types of changes - Security in case of vulnerabilities. --> +## [0.4.0] - 2022-02-21 + ### Added -- A text user interface with progress-bars and modern output (requires a TTY). +- A text user interface with a progress-bar + and modern, colorful output (requires a tty). + + When no tty is available + or in non-interactive environments like a CI/CD + or when piping alejandra to other commands (`$ alejandra 2> file`, `$ alejandra | cat`) + the old school program output will be used. + +- A `--exclude` option to the CLI. + +- Refactors to the codebase. We now comply with `clippy`, a Rust linter. + +- A new structure to the codebase and link time optimizations. + + Binaries were reduced in size by 15% + with respect to the previous release + (even with the added features), + performance was improved in the reference machine + from 45 seconds to 35 while formatting Nixpkgs on a single core. + +### Changed + +- The old school program output is now less verbose. + + It prints only the path of files that were changed, + and a summary of the number of errors and files changed during formatting. + +### Removed + +- The `--debug` flag in the CLI. ## [0.3.1] - 2022-02-20 @@ -175,7 +206,8 @@ Types of changes --- -[unreleased]: https://github.com/kamadorueda/alejandra/compare/0.3.1...HEAD +[unreleased]: https://github.com/kamadorueda/alejandra/compare/0.4.0...HEAD +[0.4.0]: https://github.com/kamadorueda/alejandra/compare/0.3.1...0.4.0 [0.3.1]: https://github.com/kamadorueda/alejandra/compare/0.3.0...0.3.1 [0.3.0]: https://github.com/kamadorueda/alejandra/compare/0.2.0...0.3.0 [0.2.0]: https://github.com/kamadorueda/alejandra/compare/0.1.0...0.2.0 diff --git a/Cargo.lock b/Cargo.lock index c0306d5..22fd70e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "alejandra_cli" -version = "0.3.1" +version = "0.4.0" dependencies = [ "alejandra_engine", "atty", @@ -18,7 +18,7 @@ dependencies = [ [[package]] name = "alejandra_engine" -version = "0.3.1" +version = "0.4.0" dependencies = [ "clap", "rand", diff --git a/README.md b/README.md index 329258e..54f4fa2 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,11 @@ You can download a binary for your platform, make it executable (`$ chmod +x`) and have fun! -- [aarch64-unknown-linux-musl](https://github.com/kamadorueda/alejandra/releases/download/0.3.1/alejandra-aarch64-unknown-linux-musl) -- [armv6l-unknown-linux-musleabihf](https://github.com/kamadorueda/alejandra/releases/download/0.3.1/alejandra-armv6l-unknown-linux-musleabihf) -- [armv7l-unknown-linux-musleabihf](https://github.com/kamadorueda/alejandra/releases/download/0.3.1/alejandra-armv7l-unknown-linux-musleabihf) -- [i686-unknown-linux-musl](https://github.com/kamadorueda/alejandra/releases/download/0.3.1/alejandra-i686-unknown-linux-musl) -- [x86_64-unknown-linux-musl](https://github.com/kamadorueda/alejandra/releases/download/0.3.1/alejandra-x86_64-unknown-linux-musl) +- [aarch64-unknown-linux-musl](https://github.com/kamadorueda/alejandra/releases/download/0.4.0/alejandra-aarch64-unknown-linux-musl) +- [armv6l-unknown-linux-musleabihf](https://github.com/kamadorueda/alejandra/releases/download/0.4.0/alejandra-armv6l-unknown-linux-musleabihf) +- [armv7l-unknown-linux-musleabihf](https://github.com/kamadorueda/alejandra/releases/download/0.4.0/alejandra-armv7l-unknown-linux-musleabihf) +- [i686-unknown-linux-musl](https://github.com/kamadorueda/alejandra/releases/download/0.4.0/alejandra-i686-unknown-linux-musl) +- [x86_64-unknown-linux-musl](https://github.com/kamadorueda/alejandra/releases/download/0.4.0/alejandra-x86_64-unknown-linux-musl) Alternatively there is an automated method for some platforms. It needs: @@ -144,7 +144,7 @@ $ /path/to/alejandra --help - Nix with [Flakes](https://nixos.wiki/wiki/Flakes): ```bash - $ nix profile install github:kamadorueda/alejandra/0.3.1 + $ nix profile install github:kamadorueda/alejandra/0.4.0 ``` - Nix stable: @@ -152,10 +152,10 @@ $ /path/to/alejandra --help Pick one depending on your platform: ```bash - $ nix-env -ivA aarch64-darwin -f https://github.com/kamadorueda/alejandra/tarball/0.3.1 - $ nix-env -ivA aarch64-linux -f https://github.com/kamadorueda/alejandra/tarball/0.3.1 - $ nix-env -ivA x86_64-darwin -f https://github.com/kamadorueda/alejandra/tarball/0.3.1 - $ nix-env -ivA x86_64-linux -f https://github.com/kamadorueda/alejandra/tarball/0.3.1 + $ nix-env -ivA aarch64-darwin -f https://github.com/kamadorueda/alejandra/tarball/0.4.0 + $ nix-env -ivA aarch64-linux -f https://github.com/kamadorueda/alejandra/tarball/0.4.0 + $ nix-env -ivA x86_64-darwin -f https://github.com/kamadorueda/alejandra/tarball/0.4.0 + $ nix-env -ivA x86_64-linux -f https://github.com/kamadorueda/alejandra/tarball/0.4.0 ``` Then run Alejandra with: diff --git a/flake.lock b/flake.lock index fef34b4..05873ae 100644 --- a/flake.lock +++ b/flake.lock @@ -18,11 +18,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1645013224, - "narHash": "sha256-b7OEC8vwzJv3rsz9pwnTX2LQDkeOWz2DbKypkVvNHXc=", + "lastModified": 1645347465, + "narHash": "sha256-GoNcKieZf86tFzuVY7+kfEGw0rjgBrdfwRj4l7zOfZw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b66b39216b1fef2d8c33cc7a5c72d8da80b79970", + "rev": "7feed2c0bec4161c83509d18089784cfcef49667", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 63e39ad..377f8ad 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ outputs = inputs: let commit = inputs.self.shortRev or "dirty"; date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101"; - version = "0.3.1+${builtins.substring 0 8 date}.${commit}"; + version = "0.4.0+${builtins.substring 0 8 date}.${commit}"; nixpkgsForHost = host: import inputs.nixpkgs { diff --git a/front/Cargo.lock b/front/Cargo.lock index 20dc0a7..301f0ff 100644 --- a/front/Cargo.lock +++ b/front/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "alejandra_engine" -version = "0.3.1" +version = "0.4.0" dependencies = [ "clap", "rand", @@ -14,7 +14,7 @@ dependencies = [ [[package]] name = "alejandra_front" -version = "0.3.1" +version = "0.4.0" dependencies = [ "alejandra_engine", "console_error_panic_hook", diff --git a/front/Cargo.toml b/front/Cargo.toml index db31328..772257e 100644 --- a/front/Cargo.toml +++ b/front/Cargo.toml @@ -14,7 +14,7 @@ description = "The Uncompromising Nix Code Formatter" edition = "2021" name = "alejandra_front" repository = "https://github.com/kamadorueda/alejandra" -version = "0.3.1" +version = "0.4.0" [profile.release] lto = true diff --git a/front/flake.lock b/front/flake.lock index 418378e..df4a554 100644 --- a/front/flake.lock +++ b/front/flake.lock @@ -8,11 +8,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1645338193, - "narHash": "sha256-BTajZF5xFmO3+MZE29C6JRLSM6PXdoFrpTlaMZr0Ljc=", + "lastModified": 1645424702, + "narHash": "sha256-qxT0Mu7/xnMWDygGhctmvQvG1+xz+mmV692GRBkjDFk=", "owner": "nix-community", "repo": "fenix", - "rev": "f15f0f9fedd87e265e49585463df72c1257f1ae8", + "rev": "882a812300adcd85a5e10dc26e5d7a1d6acc7575", "type": "github" }, "original": { @@ -23,11 +23,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1645013224, - "narHash": "sha256-b7OEC8vwzJv3rsz9pwnTX2LQDkeOWz2DbKypkVvNHXc=", + "lastModified": 1645347465, + "narHash": "sha256-GoNcKieZf86tFzuVY7+kfEGw0rjgBrdfwRj4l7zOfZw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b66b39216b1fef2d8c33cc7a5c72d8da80b79970", + "rev": "7feed2c0bec4161c83509d18089784cfcef49667", "type": "github" }, "original": { @@ -46,11 +46,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1645265362, - "narHash": "sha256-6z88g8cyw6Ae9SxgGUmT+jMuMadrJ4IgVV+UHdK4ook=", + "lastModified": 1645399019, + "narHash": "sha256-O9onJrAJY0TWxEZZcTWuF7SGPypRtSo0ZbpzDLC5+os=", "owner": "rust-analyzer", "repo": "rust-analyzer", - "rev": "1d53f695f0408f47c5cce5cefa471eb0e86b0db7", + "rev": "d6ed146a1caa41c65a831efbc80d79067c8f5955", "type": "github" }, "original": { diff --git a/installers/aarch64-linux.sh b/installers/aarch64-linux.sh index 9f38ff8..a2850ce 100755 --- a/installers/aarch64-linux.sh +++ b/installers/aarch64-linux.sh @@ -2,7 +2,7 @@ releases=https://github.com/kamadorueda/alejandra/releases/download/ target=alejandra-aarch64-unknown-linux-musl -version=0.3.1 +version=0.4.0 curl -o alejandra -L "${releases}/${version}/${target}" diff --git a/installers/x86_64-linux.sh b/installers/x86_64-linux.sh index 1d26f09..e783668 100755 --- a/installers/x86_64-linux.sh +++ b/installers/x86_64-linux.sh @@ -2,7 +2,7 @@ releases=https://github.com/kamadorueda/alejandra/releases/download/ target=alejandra-x86_64-unknown-linux-musl -version=0.3.1 +version=0.4.0 curl -o alejandra -L "${releases}/${version}/${target}" diff --git a/pre-commit.sh b/pre-commit.sh deleted file mode 100644 index 3e365e2..0000000 --- a/pre-commit.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -if git rev-parse --verify HEAD > /dev/null 2>&1; then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=$(${git}/bin/git hash-object -t tree /dev/null) -fi - -diff="git diff-index --name-only --cached $against --diff-filter d" -all_files=($($diff)) - -# Format the entire tree. -treefmt - -# check editorconfig -editorconfig-checker -- "${all_files[@]}" -if [[ $? != '0' ]]; then - printf "%b\n" \ - "\nCode is not aligned with .editorconfig" \ - "Review the output and commit your fixes" >&2 - exit 1 -fi diff --git a/src/alejandra_cli/Cargo.toml b/src/alejandra_cli/Cargo.toml index 9914132..09b5f3b 100644 --- a/src/alejandra_cli/Cargo.toml +++ b/src/alejandra_cli/Cargo.toml @@ -18,4 +18,4 @@ description = "The Uncompromising Nix Code Formatter" edition = "2021" name = "alejandra_cli" repository = "https://github.com/kamadorueda/alejandra" -version = "0.3.1" +version = "0.4.0" diff --git a/src/alejandra_engine/Cargo.toml b/src/alejandra_engine/Cargo.toml index 641dc63..e3aeb90 100644 --- a/src/alejandra_engine/Cargo.toml +++ b/src/alejandra_engine/Cargo.toml @@ -10,4 +10,4 @@ description = "The Uncompromising Nix Code Formatter" edition = "2021" name = "alejandra_engine" repository = "https://github.com/kamadorueda/alejandra" -version = "0.3.1" +version = "0.4.0" diff --git a/src/alejandra_engine/src/version.rs b/src/alejandra_engine/src/version.rs index 737f478..f22e72f 100644 --- a/src/alejandra_engine/src/version.rs +++ b/src/alejandra_engine/src/version.rs @@ -1 +1 @@ -pub const VERSION: &str = "0.3.1"; +pub const VERSION: &str = "0.4.0";