From 34ea8c2ab9183fc342f7e668fc3cdf38d8080bfa Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 2 Apr 2024 21:03:09 +0900 Subject: [PATCH] Suppress typos detections for all short words --- _typos.toml | 20 ++++++++++++++++---- home-manager/common.nix | 8 ++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/_typos.toml b/_typos.toml index b8c5d92a..19fe4989 100644 --- a/_typos.toml +++ b/_typos.toml @@ -1,9 +1,21 @@ -[default.extend-words] -# https://github.com/crate-ci/typos/issues/415 -ba = "ba" +[default] +# https://github.com/crate-ci/typos/blob/v1.19.0/docs/reference.md +# Be careful to handle extend-ignore-* variants +# - extend-ignore-words-re: macthed symbol +# - extend-ignore-identifiers-re: suggesting symbol +# - extend-ignore-re: matching target string +extend-ignore-words-re = [ + # In my experience, false positive detection in typos occurred for short words. + # + # * My typos are increased as the words get longer + # * Too short often conflict with hash strings especially `ba`: https://github.com/crate-ci/typos/issues/415 + # * Added 2 or 3 character abbreviations as wrong: https://github.com/crate-ci/typos/issues/955 + # + # So I guess skipping all these detections makes reasonable behaviors for now and for the future. + "\\A[a-zA-Z]{1,3}\\z", +] [files] extend-exclude = [ "go.mod", - "*.terminal", ] diff --git a/home-manager/common.nix b/home-manager/common.nix index 1f52de68..4978767d 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -165,12 +165,8 @@ + "/examples/.irbrc" ; - # typos does not have feature global config, this is used in git hooks for https://github.com/kachick/dotfiles/issues/412 - xdg.configFile."typos/_typos.toml".text = '' - [default.extend-words] - # https://github.com/crate-ci/typos/issues/415 - ba = "ba" - ''; + # typos does not have global config feature, this is used in git hooks for https://github.com/kachick/dotfiles/issues/412 + xdg.configFile."typos/_typos.toml".source = ../_typos.toml; # https://github.com/nix-community/home-manager/blob/release-23.11/modules/programs/fzf.nix # https://github.com/junegunn/fzf/blob/master/README.md