diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 8d570cf..7591d77 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -37,21 +37,21 @@ jobs: command: fmt args: --all -- --check - clippy: - name: clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + # clippy: + # name: clippy + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - uses: actions-rs/toolchain@v1 + # with: + # profile: minimal + # toolchain: stable + # override: true + # - run: rustup component add clippy + # - uses: actions-rs/cargo@v1 + # with: + # command: clippy + # args: -- -D warnings test: name: test @@ -69,7 +69,7 @@ jobs: args: -- --show-output os-test: - needs: [check, fmt, clippy, test] + needs: [check, fmt, test] runs-on: ${{ matrix.os }} strategy: fail-fast: true @@ -126,6 +126,6 @@ jobs: args: --target=${{ matrix.target }} cargo-check: - uses: xsv24/git-kit/.github/workflows/cargo-publish.yml@binary-relase + uses: xsv24/git-kit/.github/workflows/cargo-publish.yml@main with: dry-run: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 939bdfb..697d4b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: cargo: needs: ["github-release"] - uses: xsv24/git-kit/.github/workflows/cargo-publish.yml@binary-relase + uses: xsv24/git-kit/.github/workflows/cargo-publish.yml@main with: version: ${{ needs.github-release.version }} dry-run: false diff --git a/README.md b/README.md index 07b94ff..6465658 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ # 🧰 git-kit +> 🚨 **IMPORTANT** +> +> This repository has been **renamed** to [inkan](https://github.com/xsv24/inkan) and thus this repository is now deprecated. +> +> Please head over to the [inkan](https://github.com/xsv24/inkan) repository to continue 🙏 + Use this CLI to help format your git commit messages consistently with less effort via pre-provided templates! 🤩 There are two default templates provided: diff --git a/src/adapters/git/git_adapter.rs b/src/adapters/git/git_adapter.rs index 11b5fba..36ed56d 100644 --- a/src/adapters/git/git_adapter.rs +++ b/src/adapters/git/git_adapter.rs @@ -77,21 +77,12 @@ impl adapters::Git for Git { Ok(()) } - fn template_file_path(&self) -> Result { + fn template_file_path(&self) -> Result { // Template file and stored in the .git directory to avoid users having to adding to their .gitignore // In future maybe we could make our own .git-kit dir to house config / templates along with this. let path: PathBuf = self.root_directory()?.into(); - let path: AbsolutePath = path - .join(".git") - .join("GIT_KIT_COMMIT_TEMPLATE") - .try_into() - .map_err(|e| { - log::error!("{}", e); - GitError::Validation { - message: "Failed to build template file path".into(), - } - })?; + let path = path.join(".git").join("GIT_KIT_COMMIT_TEMPLATE"); Ok(path) } diff --git a/src/cli/commands.rs b/src/cli/commands.rs index 2d857ea..ae99f63 100644 --- a/src/cli/commands.rs +++ b/src/cli/commands.rs @@ -10,6 +10,8 @@ use crate::{ use super::{checkout, commit, config, context, templates}; +#[allow(clippy::almost_swapped)] +#[allow(clippy::correctness)] #[derive(Debug, Clone, Subcommand)] pub enum Commands { /// Commit staged changes via git with a template message. diff --git a/src/cli/config/args.rs b/src/cli/config/args.rs index 7173337..04f31f4 100644 --- a/src/cli/config/args.rs +++ b/src/cli/config/args.rs @@ -1,4 +1,4 @@ -use clap::Args; +use clap::{Args, Subcommand}; use crate::{ domain::{ @@ -12,7 +12,9 @@ use crate::{ entry::Interactive, }; -#[derive(Debug, Clone, clap::Subcommand)] +#[allow(clippy::almost_swapped)] +#[allow(clippy::correctness)] +#[derive(Debug, Clone, Subcommand)] pub enum Arguments { /// Add / register a custom config file. Add(ConfigAdd), diff --git a/src/domain/adapters/git.rs b/src/domain/adapters/git.rs index 8ae3222..ea4f9ab 100644 --- a/src/domain/adapters/git.rs +++ b/src/domain/adapters/git.rs @@ -1,4 +1,4 @@ -use std::path::Path; +use std::path::{Path, PathBuf}; use crate::domain::{errors::GitError, models::path::AbsolutePath}; @@ -29,7 +29,7 @@ pub trait Git { fn checkout(&self, name: &str, status: CheckoutStatus) -> Result<(), GitError>; /// Get the commit file path for the current repository. - fn template_file_path(&self) -> Result; + fn template_file_path(&self) -> Result; /// Commit changes and open and editor with template file. fn commit_with_template( diff --git a/src/domain/commands/commit/handler.rs b/src/domain/commands/commit/handler.rs index 9f62a65..7c07991 100644 --- a/src/domain/commands/commit/handler.rs +++ b/src/domain/commands/commit/handler.rs @@ -1,5 +1,3 @@ -use std::path::PathBuf; - use crate::{ domain::{ adapters::{CommitMsgStatus, Git, Store}, @@ -25,8 +23,6 @@ pub fn handler(git: &G, store: &S, commit: Commit) -> Result, pub checkout_res: fn(&str, CheckoutStatus) -> Result<(), GitError>, pub commit_res: fn(&Path, CommitMsgStatus) -> Result<(), GitError>, - pub template_file_path: fn() -> Result, + pub template_file_path: fn() -> Result, } impl GitCommandMock { @@ -86,7 +86,7 @@ impl GitCommandMock { branch_name: Ok(Faker.fake()), checkout_res: |_, _| Ok(()), commit_res: |_, _| Ok(()), - template_file_path: || Ok(VALID_FILE_PATH.clone()), + template_file_path: || Ok(VALID_FILE_PATH.clone().into()), } } } @@ -114,7 +114,7 @@ impl Git for GitCommandMock { panic!("Did not expect Git 'root_directory' to be called."); } - fn template_file_path(&self) -> Result { + fn template_file_path(&self) -> Result { (self.template_file_path)() }