ci: Extend spellcheck job with 'typos' tool
Unlike the `codespell`, `typos` is capable of finding typos in combined identifiers (`CamelCase` or `snake_case`).
This commit is contained in:
parent
d11552c2d9
commit
c3777c1536
@ -8,6 +8,7 @@ builtin = clear,rare,en-GB_to_en-US
|
||||
# Skip paths matching fnmatch glob patterns.
|
||||
skip =
|
||||
.git,
|
||||
.typos.toml,
|
||||
build,
|
||||
Copyright.txt,
|
||||
CTestCustom.cmake.in,
|
||||
@ -20,6 +21,7 @@ skip =
|
||||
Utilities/cm*,
|
||||
*.pfx,
|
||||
|
||||
# noqa: spellcheck off
|
||||
ignore-words-list =
|
||||
aci,
|
||||
ags,
|
||||
@ -56,3 +58,4 @@ ignore-words-list =
|
||||
varn,
|
||||
vas,
|
||||
wee,
|
||||
# noqa: spellcheck on
|
||||
|
17
.gitlab/ci/typos.bash
Executable file
17
.gitlab/ci/typos.bash
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
result=0
|
||||
|
||||
echo "Running 'typos' on source code..."
|
||||
typos || result=1
|
||||
|
||||
if [ -n "$CI_MERGE_REQUEST_DIFF_BASE_SHA" ]; then
|
||||
for COMMIT in $(git rev-list "^$CI_MERGE_REQUEST_DIFF_BASE_SHA" "$CI_COMMIT_SHA"); do
|
||||
echo "Running 'typos' on commit message of $COMMIT..."
|
||||
git show --format=%B -s "$COMMIT" | typos - || result=1
|
||||
done
|
||||
fi
|
||||
|
||||
exit $result
|
@ -585,6 +585,7 @@
|
||||
extends: .fedora41
|
||||
script:
|
||||
- .gitlab/ci/codespell.bash
|
||||
- .gitlab/ci/typos.bash
|
||||
interruptible: true
|
||||
|
||||
.cmake_build_linux:
|
||||
|
67
.typos.toml
Normal file
67
.typos.toml
Normal file
@ -0,0 +1,67 @@
|
||||
# The manual about all configuration options is here:
|
||||
# https://github.com/crate-ci/typos/blob/master/docs/reference.md
|
||||
|
||||
[default]
|
||||
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 a line to exclude from spellchecking
|
||||
, "(?Rm)^.*(#|/(/|\\*)|\\.\\.)\\s*(NOQA|noqa):? spellcheck(: *|=| +)disable-line$"
|
||||
]
|
||||
locale = "en-us"
|
||||
|
||||
# Add repo-wide false positives here in the form of `word = "word"`.
|
||||
# Check the manual for details.
|
||||
[default.extend-words]
|
||||
HPE = "HPE"
|
||||
# British spelling of `XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER` property name.
|
||||
BEHAVIOUR = "BEHAVIOUR"
|
||||
# Misspelled `Fortran_BUILDING_INSTRINSIC_MODULES` property name kept for compatibility: `INSTRINSIC` should be `INTRINSIC`.
|
||||
INSTRINSIC = "INSTRINSIC"
|
||||
# This is a file extension for `cobertura-merge`
|
||||
ser = "ser"
|
||||
# The Ninja option name
|
||||
restat = "restat"
|
||||
# SpectreMitigation
|
||||
Spectre = "Spectre"
|
||||
|
||||
[type.cmake.extend-identifiers]
|
||||
COMMANDs = "COMMANDs"
|
||||
xCOMMANDx = "xCOMMANDx"
|
||||
|
||||
[type.cmake.extend-words]
|
||||
# Some compiler's options trigger false-positives
|
||||
Fo = "Fo"
|
||||
ot = "ot"
|
||||
# Part of compiler executable name, e.g., `arm-unknown-nto-qnx6`, but also could be in a literal string.
|
||||
nto = "nto"
|
||||
|
||||
[type.cpp.extend-identifiers]
|
||||
APPENDed = "APPENDed"
|
||||
|
||||
[type.json.extend-identifiers]
|
||||
# Some compiler options from `Templates/MSBuild/FlagTables/*.json` trigger too many false-positives.
|
||||
Fo = "Fo"
|
||||
fo = "fo"
|
||||
Ot = "Ot"
|
||||
SEH = "SEH"
|
||||
|
||||
[files]
|
||||
ignore-hidden = false
|
||||
ignore-dot = false
|
||||
extend-exclude = [
|
||||
"Copyright.txt"
|
||||
# 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"
|
||||
]
|
@ -105,6 +105,8 @@ iteration variables as follows:
|
||||
- if any of the lists are shorter, the corresponding iteration
|
||||
variable is not defined for the current iteration.
|
||||
|
||||
.. noqa: spellcheck off
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
list(APPEND English one two three four)
|
||||
@ -129,6 +131,8 @@ yields::
|
||||
-- en=three, ba=tiga
|
||||
-- en=four, ba=
|
||||
|
||||
.. noqa: spellcheck on
|
||||
|
||||
See Also
|
||||
^^^^^^^^
|
||||
|
||||
|
@ -163,11 +163,15 @@ The following characters have special meaning in regular expressions:
|
||||
:command:`if(MATCHES)`, save subgroup matches in the variables
|
||||
:variable:`CMAKE_MATCH_<n>` for ``<n>`` 0..9.
|
||||
|
||||
.. noqa: spellcheck off
|
||||
|
||||
``*``, ``+`` and ``?`` have higher precedence than concatenation. ``|``
|
||||
has lower precedence than concatenation. This means that the regular
|
||||
expression ``^ab+d$`` matches ``abbd`` but not ``ababd``, and the regular
|
||||
expression ``^(ab|cd)$`` matches ``ab`` but not ``abd``.
|
||||
|
||||
.. noqa: spellcheck on
|
||||
|
||||
CMake language :ref:`Escape Sequences` such as ``\t``, ``\r``, ``\n``,
|
||||
and ``\\`` may be used to construct literal tabs, carriage returns,
|
||||
newlines, and backslashes (respectively) to pass in a regex. For example:
|
||||
|
@ -3,6 +3,11 @@ VS_SHADER_OBJECT_FILE_NAME
|
||||
|
||||
.. versionadded:: 3.12
|
||||
|
||||
.. noqa: spellcheck off
|
||||
.. Ignore `-Fo` here
|
||||
|
||||
Specifies a file name for the compiled shader object file for an ``.hlsl``
|
||||
source file. This adds the ``-Fo`` flag to the command line for the FxCompiler
|
||||
tool.
|
||||
|
||||
.. noqa: spellcheck on
|
||||
|
@ -19,14 +19,18 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
|
||||
FAIL_REGEX "invalid argument .*option" # Intel
|
||||
FAIL_REGEX "ignoring option .*argument required" # Intel
|
||||
FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
|
||||
# noqa: spellcheck off
|
||||
FAIL_REGEX "[Uu]nknown option" # HP
|
||||
# noqa: spellcheck on
|
||||
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
|
||||
FAIL_REGEX "command option .* is not recognized" # XL
|
||||
FAIL_REGEX "command option .* contains an incorrect subargument" # XL
|
||||
FAIL_REGEX "Option .* is not recognized. Option will be ignored." # XL
|
||||
FAIL_REGEX "not supported in this configuration. ignored" # AIX
|
||||
FAIL_REGEX "File with unknown suffix passed to linker" # PGI
|
||||
# noqa: spellcheck off
|
||||
FAIL_REGEX "[Uu]nknown switch" # PGI
|
||||
# noqa: spellcheck on
|
||||
FAIL_REGEX "WARNING: unknown flag:" # Open64
|
||||
FAIL_REGEX "Incorrect command line option:" # Borland
|
||||
FAIL_REGEX "Warning: illegal option" # SunStudio 12
|
||||
|
@ -215,7 +215,7 @@ function(_ICU_FIND)
|
||||
endif()
|
||||
if(component STREQUAL "in")
|
||||
list(APPEND component_libnames "icui18n")
|
||||
list(APPEND component_debug_libnames "icui18nd")
|
||||
list(APPEND component_debug_libnames "icui18nd") # noqa: spellcheck disable-line
|
||||
endif()
|
||||
|
||||
if(static_prefix)
|
||||
|
@ -618,11 +618,13 @@ function (_MPI_interrogate_compiler LANG)
|
||||
# At this point, we obtained some output from a compiler wrapper that works.
|
||||
# We'll now try to parse it into variables with meaning to us.
|
||||
if(LANG STREQUAL "Fortran")
|
||||
# noqa: spellcheck off
|
||||
# If MPICH (and derivates) didn't recognize the Fortran compiler include flag during configuration,
|
||||
# they'll return a set of three commands, consisting out of a symlink command for mpif.h,
|
||||
# the actual compiler command and deletion of the created symlink.
|
||||
# Especially with M(VA)PICH-1, this appears to happen erroneously, and therefore we should translate
|
||||
# this output into an additional include directory and then drop it from the output.
|
||||
# noqa: spellcheck on
|
||||
if(MPI_COMPILE_CMDLINE MATCHES "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h")
|
||||
get_filename_component(MPI_INCLUDE_DIRS_WORK "${CMAKE_MATCH_1}" DIRECTORY)
|
||||
string(REGEX REPLACE "^ln -s ([^\" ]+|\"[^\"]+\") mpif.h\n" "" MPI_COMPILE_CMDLINE "${MPI_COMPILE_CMDLINE}")
|
||||
@ -955,6 +957,7 @@ function(_MPI_guess_settings LANG)
|
||||
# Should a user be employing PGI or have built its own set and provided it via cache variables, the
|
||||
# splitting routine would have located the module files.
|
||||
|
||||
# noqa: spellcheck off
|
||||
# For C and C++, we're done here (MSMPI does not ship the MPI-2 C++ bindings) - however, for Fortran
|
||||
# we need some extra library to glue Fortran support together:
|
||||
# MSMPI ships 2-4 Fortran libraries, each for different Fortran compiler behaviors. The library names
|
||||
@ -964,6 +967,7 @@ function(_MPI_guess_settings LANG)
|
||||
# The second difference is the last but one letter, if it's an e(nd), the length of a string argument is
|
||||
# passed by the Fortran compiler after all other arguments on the parameter list, if it's an m(ixed),
|
||||
# it's passed immediately after the string address.
|
||||
# noqa: spellcheck on
|
||||
|
||||
# To summarize:
|
||||
# - msmpifec: CHARACTER length passed after the parameter list and using cdecl calling convention
|
||||
|
@ -42,6 +42,7 @@ endmacro()
|
||||
|
||||
set(RTI_DEFINITIONS "-DRTI_USES_STD_FSTREAM")
|
||||
|
||||
# noqa: spellcheck off
|
||||
# Detect the CERTI installation, http://www.cert.fr/CERTI
|
||||
# Detect the MAK Technologies RTI installation, http://www.mak.com/products/rti.php
|
||||
# note: the following list is ordered to find the most recent version first
|
||||
@ -55,6 +56,7 @@ set(RTI_POSSIBLE_DIRS
|
||||
set(RTI_OLD_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
# The MAK RTI has the "lib" prefix even on Windows.
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
|
||||
# noqa: spellcheck on
|
||||
|
||||
find_library(RTI_LIBRARY
|
||||
NAMES RTI RTI-NG
|
||||
|
@ -52,9 +52,11 @@ if(NOT CMake_VERSION_NO_GIT)
|
||||
set(git_subject "${CMAKE_MATCH_2}")
|
||||
|
||||
# If this is not the exact commit of a release, add dev info.
|
||||
# noqa: spellcheck off
|
||||
if(NOT "${git_subject}" MATCHES "^[Cc][Mm]ake ${CMake_VERSION}$")
|
||||
string(APPEND CMake_VERSION "-g${git_hash}")
|
||||
endif()
|
||||
# noqa: spellcheck on
|
||||
|
||||
# If this is a work tree, check whether it is dirty.
|
||||
if(COMMAND _git)
|
||||
|
@ -128,7 +128,7 @@ void cmWIXRichTextFormatWriter::WriteDocumentPrefix()
|
||||
{
|
||||
ControlWord("viewkind4");
|
||||
ControlWord("uc1");
|
||||
ControlWord("pard");
|
||||
ControlWord("pard"); // noqa: spellcheck disable-line
|
||||
ControlWord("f0");
|
||||
ControlWord("fs14");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "cmXMLWriter.h"
|
||||
|
||||
static const char* cmCTestErrorMatches[] = {
|
||||
"^[Bb]us [Ee]rror",
|
||||
"^[Bb]us [Ee]rror", // noqa: spellcheck disable-line
|
||||
"^[Ss]egmentation [Vv]iolation",
|
||||
"^[Ss]egmentation [Ff]ault",
|
||||
":.*[Pp]ermission [Dd]enied",
|
||||
|
@ -10,6 +10,7 @@
|
||||
class cmCTest;
|
||||
class cmCTestCoverageHandlerContainer;
|
||||
|
||||
// noqa: spellcheck off
|
||||
/** \class cmParsePythonCoverage
|
||||
* \brief Parse coverage.py Python coverage information
|
||||
*
|
||||
@ -19,6 +20,7 @@ class cmCTestCoverageHandlerContainer;
|
||||
* Java-based Cobertura coverage application. This helper class parses
|
||||
* that XML file to fill the coverage-handler container.
|
||||
*/
|
||||
// noqa: spellcheck on
|
||||
class cmParseCoberturaCoverage
|
||||
{
|
||||
public:
|
||||
|
@ -626,7 +626,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
|
||||
xml.StartElement("storageModule");
|
||||
xml.Attribute("moduleId", "org.eclipse.cdt.core.settings");
|
||||
|
||||
xml.StartElement("cconfiguration");
|
||||
xml.StartElement("cconfiguration"); // noqa: spellcheck disable-line
|
||||
xml.Attribute("id", "org.eclipse.cdt.core.default.config.1");
|
||||
|
||||
// Configuration settings...
|
||||
@ -1018,7 +1018,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
|
||||
|
||||
cmExtraEclipseCDT4Generator::AppendStorageScanners(xml, *mf);
|
||||
|
||||
// noqa: spellcheck off
|
||||
xml.EndElement(); // cconfiguration
|
||||
// noqa: spellcheck on
|
||||
xml.EndElement(); // storageModule
|
||||
|
||||
xml.StartElement("storageModule");
|
||||
|
@ -35,7 +35,7 @@ bool cmFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
|
||||
<< " " << lfc << "\n"
|
||||
<< "closes on the line\n"
|
||||
<< " " << closingContext << "\n"
|
||||
<< "with mis-matching arguments.";
|
||||
<< "with mis-matching arguments."; // noqa: spellcheck disable-line
|
||||
/* clang-format on */
|
||||
mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
|
||||
} else if (!this->EndCommandSupportsArguments() &&
|
||||
|
@ -975,6 +975,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
||||
cmXMLElement epg(eprj, "PropertyGroup");
|
||||
epg.Attribute("Label", "Configuration");
|
||||
{
|
||||
// noqa: spellcheck off
|
||||
cmXMLElement ect(epg, "ConfigurationType");
|
||||
if (this->IsNsightTegra()) {
|
||||
// Tegra-Android platform does not understand "Utility".
|
||||
@ -982,6 +983,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
|
||||
} else {
|
||||
ect.Content("Utility");
|
||||
}
|
||||
// noqa: spellcheck on
|
||||
}
|
||||
cmXMLElement(epg, "CharacterSet").Content("MultiByte");
|
||||
if (this->IsNsightTegra()) {
|
||||
|
@ -518,8 +518,9 @@ static cmVS7FlagTable cmVS8ExtraFlagTable[] = {
|
||||
// Exception handling mode. If no entries match, it will be FALSE.
|
||||
{ "ExceptionHandling", "GX", "enable c++ exceptions", "1", 0 },
|
||||
{ "ExceptionHandling", "EHsc", "enable c++ exceptions", "1", 0 },
|
||||
// noqa: spellcheck off
|
||||
{ "ExceptionHandling", "EHa", "enable SEH exceptions", "2", 0 },
|
||||
|
||||
// noqa: spellcheck on
|
||||
{ "EnablePREfast", "analyze", "", "true", 0 },
|
||||
{ "EnablePREfast", "analyze-", "", "false", 0 },
|
||||
|
||||
|
@ -389,7 +389,9 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = {
|
||||
{ "FloatingPointModel", "fp:strict", "Use strict floating point model", "1",
|
||||
0 },
|
||||
{ "FloatingPointModel", "fp:fast", "Use fast floating point model", "2", 0 },
|
||||
// noqa: spellcheck off
|
||||
{ "FavorSizeOrSpeed", "Ot", "Favor fast code", "1", 0 },
|
||||
// noqa: spellcheck on
|
||||
{ "FavorSizeOrSpeed", "Os", "Favor small code", "2", 0 },
|
||||
{ "CompileAs", "TC", "Compile as c code", "1", 0 },
|
||||
{ "CompileAs", "TP", "Compile as c++ code", "2", 0 },
|
||||
|
@ -2033,7 +2033,7 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args)
|
||||
static const cmsys::RegularExpression llvm_rc_only_double_arg(
|
||||
"^[-/](C|LN|L)(.)?");
|
||||
static const cmsys::RegularExpression common_double_arg(
|
||||
"^[-/](D|U|I|FO|fo|Fo)(.)?");
|
||||
"^[-/](D|U|I|FO|fo|Fo)(.)?"); // noqa: spellcheck disable-line
|
||||
bool acceptNextArg = false;
|
||||
bool skipNextArg = false;
|
||||
for (std::string const& arg : cmMakeRange(args).advance(4)) {
|
||||
@ -2448,7 +2448,7 @@ int cmVSLink::LinkIncremental()
|
||||
// Compile the resource file.
|
||||
std::vector<std::string> rcCommand;
|
||||
rcCommand.push_back(this->RcPath.empty() ? "rc" : this->RcPath);
|
||||
rcCommand.emplace_back("/fo");
|
||||
rcCommand.emplace_back("/fo"); // noqa: spellcheck disable-line
|
||||
rcCommand.push_back(this->ManifestFileRes);
|
||||
rcCommand.push_back(this->ManifestFileRC);
|
||||
if (!RunCommand("RC Pass 1", rcCommand, this->Verbose, FORMAT_DECIMAL)) {
|
||||
|
Loading…
Reference in New Issue
Block a user