diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..16a8552 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,2 @@ +[*.md] +trim_trailing_whitespace = false diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 62909a8..0b0a25d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,8 +4,8 @@ on: pull_request: push: paths-ignore: - - '*.md' - - 'LICENSE*' + - "*.md" + - "LICENSE*" workflow_dispatch: env: @@ -32,9 +32,9 @@ jobs: - name: Cache Rust workspace uses: Swatinem/rust-cache@v2 - name: Cargo check - run: cargo check --features all + run: cargo check --all-targets --all-features - name: Cargo clippy - run: cargo clippy --features all + run: cargo clippy --all-targets --all-features fmt: name: Format @@ -72,7 +72,7 @@ jobs: name: Test strategy: matrix: - platform: [ ubuntu-latest, windows-latest, macos-latest ] + platform: [ubuntu-latest, windows-latest, macos-latest] fail-fast: false runs-on: ${{ matrix.platform }} steps: @@ -159,7 +159,7 @@ jobs: key: ${{ matrix.target }} - name: Cargo build run: > - cargo ${{ matrix.build }} --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }} + cargo ${{ matrix.build }} --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }} --bin ${{ env.CARGO_BIN_NAME }} --features ${{ matrix.features }} - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -226,7 +226,7 @@ jobs: key: ${{ matrix.target }} - name: Cargo build run: > - cargo ${{ matrix.build }} --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }} + cargo ${{ matrix.build }} --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }} --bin ${{ env.CARGO_BIN_NAME }} --features ${{ matrix.features }} - name: Upload artifacts uses: actions/upload-artifact@v4 @@ -258,7 +258,7 @@ jobs: name: Release if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest - needs: [ build-cli, build-gui ] + needs: [build-cli, build-gui] permissions: contents: write steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..922825d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,36 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: check-yaml + - id: check-added-large-files + - repo: local + hooks: + - id: cargo-fmt + name: cargo fmt + description: Run cargo fmt on all project files. + language: system + entry: cargo + args: ["+nightly", "fmt", "--all"] + pass_filenames: false + - id: cargo clippy + name: cargo clippy + description: Run cargo clippy on all project files. + language: system + entry: cargo + args: ["+nightly", "clippy", "--all-targets", "--all-features"] + pass_filenames: false + - id: cargo-deny + name: cargo deny + description: Run cargo deny on all project files. + language: system + entry: cargo + args: ["deny", "check"] + pass_filenames: false + always_run: true diff --git a/README.md b/README.md index 7568784..6ec36bf 100644 --- a/README.md +++ b/README.md @@ -143,15 +143,15 @@ If not specified, objdiff will use the default patterns listed above. `units` _(optional)_: If specified, objdiff will display a list of objects in the sidebar for easy navigation. > `name` _(optional)_: The name of the object in the UI. If not specified, the object's `path` will be used. -> +> > `target_path`: Path to the "target" or "expected" object from the project root. > This object is the **intended result** of the match. -> +> > `base_path`: Path to the "base" or "actual" object from the project root. > This object is built from the **current source code**. -> +> > `metadata.auto_generated` _(optional)_: Hides the object from the object list, but still includes it in reports. -> +> > `metadata.complete` _(optional)_: Marks the object as "complete" (or "linked") in the object list. > This is useful for marking objects that are fully decompiled. A value of `false` will mark the object as "incomplete". @@ -173,6 +173,21 @@ $ cargo install --locked --git https://github.com/encounter/objdiff.git objdiff- The binaries will be installed to `~/.cargo/bin` as `objdiff` and `objdiff-cli`. +## Installing `pre-commit` + +When contributing, it's recommended to install `pre-commit` to automatically run the linter and formatter before a commit. + +[`uv`](https://github.com/astral-sh/uv#installation) is recommended to manage Python version and tools. + +Rust nightly is required for `cargo +nightly fmt` and `cargo +nightly clippy`. + +```shell +$ cargo install --locked cargo-deny +$ rustup toolchain install nightly +$ uv tool install pre-commit +$ pre-commit install +``` + ## License Licensed under either of diff --git a/objdiff-core/config-schema.json b/objdiff-core/config-schema.json index b0a8457..d35d12b 100644 --- a/objdiff-core/config-schema.json +++ b/objdiff-core/config-schema.json @@ -275,4 +275,4 @@ ] } ] -} \ No newline at end of file +}