Browse Source

pre-commit: change the repo and version bump `typos` hook

master
Alex Turbov 1 month ago
parent
commit
15d558016c
No known key found for this signature in database GPG Key ID: 8BEDB7D11F95D5E3
  1. 8
      .pre-commit-config.yaml
  2. 48
      .typos.toml
  3. 7
      Source/cmGeneratorTarget_Sources.cxx

8
.pre-commit-config.yaml

@ -39,6 +39,7 @@ repos:
CMakeLib/testCTestResourceSpec_data/spec13
| RunCMake/CTestResourceAllocation/invalid
)\.json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
# NOTE Exclude tests directory: some test files have no
@ -102,13 +103,14 @@ repos:
- id: rst-inline-touching-normal
- repo: https://github.com/codespell-project/codespell
rev: v2.4.0
rev: v2.4.1
hooks:
- id: codespell
stages: [commit-msg, pre-commit]
- repo: https://github.com/crate-ci/typos
rev: v1.30.0
# NOTE See BUG https://github.com/crate-ci/typos/issues/390
- repo: https://github.com/adhtruong/mirrors-typos
rev: v1.33.1
hooks:
- id: typos
# NOTE Override hook's default args to prevent automatic

48
.typos.toml

@ -5,10 +5,10 @@
check-file = true
check-filename = true
extend-ignore-re = [
# NOTE Allow to mark a block of text to exclude from spellchecking
"(?s)(#|/(/|\\*)|\\.\\.)\\s*(NOQA|noqa):? spellcheck(: *|=| +)off.*?\\n\\s*(#|/(/|\\*)|\\.\\.)\\s*(NOQA|noqa):? spellcheck(: *|=| +)on"
# NOTE Allow to mark block of text to exclude from spellchecking inside C++ or hash-style comments (CMake,Python,&etc.)
"(?s)(#|//)\\s*(NOQA|noqa):? spellcheck(: *|=| +)off.*?\\n\\s*(#|//)\\s*(NOQA|noqa):? spellcheck(: *|=| +)on"
# NOTE Allow to mark a line to exclude from spellchecking
, "(?Rm)^.*(#|/(/|\\*)|\\.\\.)\\s*(NOQA|noqa):? spellcheck(: *|=| +)disable-line$"
, "(?Rm)^.*(#|//)\\s*(NOQA|noqa):? spellcheck(: *|=| +)disable-line$"
# NOTE Stop checking from this line to the end of file
# This line is a marker added by Git to the `COMMIT_EDITMSG`.
, "(?sm)^# ------------------------ >8 ------------------------$.*"
@ -34,7 +34,28 @@ ser = "ser"
restat = "restat"
# SpectreMitigation
Spectre = "Spectre"
# Identifier used in source code (`GlobalTargetInfo`)
gti = "gti"
[files]
ignore-hidden = false
ignore-dot = false
extend-exclude = [
"CONTRIBUTORS.rst"
# Exclude third-party sources.
, "Source/CursesDialog/form/"
, "Source/kwsys/"
, "Source/bindexplib.cxx"
, "Source/cmcldeps.cxx"
, "Source/QtDialog/*.ui"
, "Utilities/cm*"
, "Utilities/ClangTidyModule"
, "Utilities/KWIML"
# FIXME: Fix spelling typos in tests. Exclude for now.
, "Tests"
]
# BEGIN Type-specific settings
[type.cmake.extend-identifiers]
COMMANDs = "COMMANDs"
xCOMMANDx = "xCOMMANDx"
@ -60,20 +81,9 @@ SEH = "SEH"
[type.py.extend-identifiers]
typ = "typ"
[files]
ignore-hidden = false
ignore-dot = false
extend-exclude = [
"CONTRIBUTORS.rst"
# Exclude third-party sources.
, "Source/CursesDialog/form/"
, "Source/kwsys/"
, "Source/bindexplib.cxx"
, "Source/cmcldeps.cxx"
, "Source/QtDialog/*.ui"
, "Utilities/cm*"
, "Utilities/ClangTidyModule"
, "Utilities/KWIML"
# FIXME: Fix spelling typos in tests. Exclude for now.
, "Tests"
[type.rst]
extend-ignore-re = [
# NOTE Allow to mark block of text to exclude from spellchecking as RST comments
"(?s)\\.\\.\\s+(NOQA|noqa):? spellcheck(: *|=| +)off.*?\\n\\.\\.\\s+(NOQA|noqa):? spellcheck(: *|=| +)on"
]
# END Type-specific settings

7
Source/cmGeneratorTarget_Sources.cxx

@ -96,10 +96,11 @@ void addFileSetEntry(cmGeneratorTarget const* headTarget,
}
cmake* cm = headTarget->GetLocalGenerator()->GetCMakeInstance();
for (auto& entryCge : fileSet->CompileFileEntries()) {
auto tpe = cmGeneratorTarget::TargetPropertyEntry::CreateFileSet(
auto targetPropEntry =
cmGeneratorTarget::TargetPropertyEntry::CreateFileSet(
dirs, contextSensitiveDirs, std::move(entryCge), fileSet);
entries.Entries.emplace_back(
EvaluateTargetPropertyEntry(headTarget, config, "", dagChecker, *tpe));
entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
headTarget, config, "", dagChecker, *targetPropEntry));
EvaluatedTargetPropertyEntry const& entry = entries.Entries.back();
for (auto const& file : entry.Values) {
auto* sf = headTarget->Makefile->GetOrCreateSource(file);

Loading…
Cancel
Save