From cb15b12984c1ebe185491a5b20532ac0623cdc72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Thu, 26 Sep 2024 05:28:35 +0200 Subject: [PATCH] style: switch to nixfmt rfc style, format tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- .github/dependabot.yml | 1 - .github/workflows/apt.yml | 6 +- .github/workflows/conventional-commits.yml | 7 +- .github/workflows/flake.yml | 7 +- .github/workflows/no-merge-commits.yml | 5 +- .github/workflows/unit-tests-bsd.yml | 97 ++++++++++------------ .github/workflows/unit-tests.yml | 20 +---- .github/workflows/winget.yml | 28 +++---- docs/theme.yml | 3 - powertest.yaml | 52 +++++++++--- treefmt.nix | 17 ++-- 11 files changed, 121 insertions(+), 122 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 48fc2351..245c7bdc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,7 +9,6 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" - - package-ecosystem: "github-actions" # Workflow files stored in the # default location of `.github/workflows` diff --git a/.github/workflows/apt.yml b/.github/workflows/apt.yml index ce262284..3a16db68 100644 --- a/.github/workflows/apt.yml +++ b/.github/workflows/apt.yml @@ -3,20 +3,18 @@ on: schedule: - cron: '0 0 * * *' push: - branches: [ main ] + branches: [main] paths: - 'deb.asc' - '.github/workflows/apt.yml' pull_request: - branches: [ main ] + branches: [main] paths: - 'deb.asc' - '.github/workflows/apt.yml' - concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true - jobs: apt_installation: runs-on: ubuntu-latest diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml index 3e755b2e..54ca6390 100644 --- a/.github/workflows/conventional-commits.yml +++ b/.github/workflows/conventional-commits.yml @@ -1,15 +1,12 @@ name: Conventional Commits - on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] - + branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true - jobs: conventional-commits: runs-on: ubuntu-latest diff --git a/.github/workflows/flake.yml b/.github/workflows/flake.yml index 322d99ce..aff38e52 100644 --- a/.github/workflows/flake.yml +++ b/.github/workflows/flake.yml @@ -1,7 +1,7 @@ on: workflow_dispatch: pull_request: - branches: [ main ] + branches: [main] paths: - '.github/workflows/flake.yml' - 'src/**' @@ -20,11 +20,9 @@ on: - "flake.*" - "*.nix" - "*.rs" - concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true - jobs: flake-checker: name: Flake Checker @@ -33,7 +31,6 @@ jobs: - uses: actions/checkout@v4 - name: Check Nix flake inputs uses: DeterminateSystems/flake-checker-action@v9 - check: name: Check Nix Flake runs-on: ubuntu-22.04 @@ -45,10 +42,8 @@ jobs: uses: DeterminateSystems/magic-nix-cache-action@main - name: Nix Flake Check run: nix flake check --all-systems -L - build: name: Build Nix package - # if cross compilation is desired add 'aarch64-linux', 'x86_64-darwin' and 'aarch64-darwin' and fix the flake to support cross compilation. strategy: matrix: diff --git a/.github/workflows/no-merge-commits.yml b/.github/workflows/no-merge-commits.yml index af675b46..b3c844af 100644 --- a/.github/workflows/no-merge-commits.yml +++ b/.github/workflows/no-merge-commits.yml @@ -1,13 +1,10 @@ name: No Merge Commits - on: pull_request: - branches: [ main ] - + branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true - jobs: no-merge-commits: runs-on: ubuntu-latest diff --git a/.github/workflows/unit-tests-bsd.yml b/.github/workflows/unit-tests-bsd.yml index 8cc57812..5ae37c9a 100644 --- a/.github/workflows/unit-tests-bsd.yml +++ b/.github/workflows/unit-tests-bsd.yml @@ -1,50 +1,46 @@ name: Unit tests (BSD) - on: push: - branches: [ main ] + branches: [main] paths: - '.github/workflows/unit-tests-bsd.yml' - 'src/**' - 'Cargo.*' - build.rs pull_request: - branches: [ main ] + branches: [main] paths: - '.github/workflows/unit-tests-bsd.yml' - 'src/**' - 'Cargo.*' - build.rs - concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true - jobs: unit-tests-freebsd: - runs-on: ubuntu-22.04 - timeout-minutes: 20 - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Compile - uses: vmactions/freebsd-vm@v1 - with: - release: '14.1' - usesh: true - prepare: | - pkg install -y rust git - cargo install cargo-hack - git config --global --add safe.directory /home/runner/work/eza/eza - run: | - set -e - export CARGO_TERM_COLOR="always" - export RUSTFLAGS="--deny warnings" - cargo fmt --check - cargo clippy -- -D warnings - cargo hack test - + runs-on: ubuntu-22.04 + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Compile + uses: vmactions/freebsd-vm@v1 + with: + release: '14.1' + usesh: true + prepare: | + pkg install -y rust git + cargo install cargo-hack + git config --global --add safe.directory /home/runner/work/eza/eza + run: | + set -e + export CARGO_TERM_COLOR="always" + export RUSTFLAGS="--deny warnings" + cargo fmt --check + cargo clippy -- -D warnings + cargo hack test unit-tests-netbsd: runs-on: ubuntu-22.04 timeout-minutes: 20 @@ -72,27 +68,26 @@ jobs: cargo fmt --check cargo clippy -- -D warnings cargo hack test - unit-tests-openbsd: - runs-on: ubuntu-22.04 - timeout-minutes: 20 - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Compile - uses: vmactions/openbsd-vm@v1 - with: - release: '7.4' - usesh: true - prepare: | - pkg_add rust rust-rustfmt rust-clippy git - cargo install cargo-hack - git config --global --add safe.directory /home/runner/work/eza/eza - run: | - set -e - export CARGO_TERM_COLOR="always" - export RUSTFLAGS="--deny warnings" - cargo fmt --check - cargo clippy -- -D warnings - cargo hack test + runs-on: ubuntu-22.04 + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Compile + uses: vmactions/openbsd-vm@v1 + with: + release: '7.4' + usesh: true + prepare: | + pkg_add rust rust-rustfmt rust-clippy git + cargo install cargo-hack + git config --global --add safe.directory /home/runner/work/eza/eza + run: | + set -e + export CARGO_TERM_COLOR="always" + export RUSTFLAGS="--deny warnings" + cargo fmt --check + cargo clippy -- -D warnings + cargo hack test diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 5aae2a79..18b41d3c 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,59 +1,47 @@ name: Unit tests - on: push: - branches: [ main ] + branches: [main] paths: - '.github/workflows/unit-tests.yml' - 'src/**' - 'Cargo.*' - build.rs pull_request: - branches: [ main ] + branches: [main] paths: - '.github/workflows/unit-tests.yml' - 'src/**' - 'Cargo.*' - build.rs - concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} cancel-in-progress: true - env: CARGO_TERM_COLOR: always RUSTFLAGS: --deny warnings - jobs: unit-tests: runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.rust == 'nightly' }} - strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] rust: [1.70.0, stable, beta, nightly] - steps: - name: Checkout repository uses: actions/checkout@v4 - - run: rustup toolchain install ${{ matrix.rust }} --profile minimal - uses: Swatinem/rust-cache@v2 - - name: Install cargo-hack uses: nick-fields/retry@v3 with: timeout_minutes: 5 max_attempts: 5 command: cargo install cargo-hack - - name: Run rustfmt checks run: cargo fmt --check - - name: Run clippy lints - run: cargo clippy -- -D warnings - + run: cargo clippy -- -D warnings - name: Run unit tests - run: cargo hack test + run: cargo hack test diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index 9bd48eca..430323cc 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -1,15 +1,13 @@ -name: Publish to Winget - -on: - release: - types: [released] - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: vedantmgoyal2009/winget-releaser@v2 - with: - identifier: eza-community.eza - installers-regex: '-pc-windows-gnu\.zip$' - token: ${{ secrets.WINGET_TOKEN }} +name: Publish to Winget +on: + release: + types: [released] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: vedantmgoyal2009/winget-releaser@v2 + with: + identifier: eza-community.eza + installers-regex: '-pc-windows-gnu\.zip$' + token: ${{ secrets.WINGET_TOKEN }} diff --git a/docs/theme.yml b/docs/theme.yml index 57410ef8..f1f2c4a0 100644 --- a/docs/theme.yml +++ b/docs/theme.yml @@ -32,16 +32,13 @@ perms: foreground: Red other_execute: foreground: Green - filenames: # Just change the icon glyph Cargo.toml: {icon: {glyph: 🦀}} Cargo.lock: {icon: {glyph: 🦀}} - extensions: # Change the filename color and icon # NOTE: not all unicode glyphs support color changes rs: {filename: {foreground: Red}, icon: {glyph: 🦀}} - # Change the icon glyph and color nix: {icon: {glyph: ❄, style: {foreground: White}}} diff --git a/powertest.yaml b/powertest.yaml index 8889db07..ac2d1851 100644 --- a/powertest.yaml +++ b/powertest.yaml @@ -4,15 +4,13 @@ binary: eza gen_binary: target/debug/eza args: tests/test_dir commands: - # Meta options - ? - null + ? - null # Meta options - --help : ? - -v - --version : - # Display Options - ? - -1 + ? - -1 # Display Options - --oneline : ? - -l @@ -65,8 +63,10 @@ commands: - never ? - null - --no-quotes + : ? - null - --hyperlink + : ? - null - --absolute : values: @@ -81,14 +81,16 @@ commands: - 200 ? - null - --smart-group - - # Filtering and Sorting Options - ? - -a + : + ? - -a # Filtering and Sorting Options - --all + : ? - -A - --almost-all + : ? - -d - --list-dirs + : ? - -L - --level : prefix: --tree @@ -100,6 +102,7 @@ commands: - 5 ? - -r - --reverse + : ? - -s - --sort : short: -s @@ -129,42 +132,54 @@ commands: - type ? - null - --group-directories-first + : ? - -D - --only-dirs + : ? - -f - --only-files + : ? - -f - --only-files - ? # TODO: add more globs - - -I + : + ? - -I # TODO: add more globs - --ignore-glob : prefix: -l values: - "*.toml" ? - null - --git-ignore - - # Long View Options - ? - -b + : + ? - -b # Long View Options - --binary + : ? - -B - --bytes + : ? - -g - --group + : ? - -h - --header + : ? - -H - --links + : ? - -i - --inode + : ? - -m - --modified + : ? - -M - --mounts + : ? - -n - --numeric + : ? - -S - --blocksize + : ? - -t - --time : prefix: -l @@ -175,10 +190,13 @@ commands: #- created ? - -u - --accessed + : ? - -U - --created + : ? - null - --changed + : ? - null - --time-style : long: time-style @@ -190,21 +208,31 @@ commands: - relative ? - null - --total-size + : ? - null - --no-permissions + : ? - -o - --octal-permissions + : ? - null - --no-filesize + : ? - null - --no-user + : ? - null - --git + : ? - null - --no-git + : ? - null - --git-repos + : ? - -@ - --extended + : ? - -Z - --context + : diff --git a/treefmt.nix b/treefmt.nix index 7313532d..cad790f6 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -1,7 +1,7 @@ { projectRootFile = "Cargo.toml"; programs = { - alejandra.enable = true; # nix + nixfmt.enable = true; # nix statix.enable = true; # nix static analysis deadnix.enable = true; # find dead nix code rustfmt.enable = true; # rust @@ -11,10 +11,17 @@ }; settings = { formatter = { - shellcheck.includes = ["*.sh" "./completions/bash/eza"]; - rustfmt.excludes = ["src/options/flags.rs"]; - taplo.excludes = ["tests/ptests/*.toml"]; - yamlfmt.excludes = ["./powertest.yaml"]; + shellcheck = { + includes = [ + "*.sh" + "./completions/bash/eza" + ]; + excludes = [ ".envrc" ]; + }; + + rustfmt.excludes = [ "src/options/flags.rs" ]; + taplo.excludes = [ "tests/ptests/*.toml" ]; + yamlfmt.excludes = [ "./powertest.yaml" ]; }; }; }