Skip to content

Commit

Permalink
Merge pull request #573 from KyleFromKitware/codespell (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlettroscoe authored Mar 31, 2023
2 parents df94654 + 8485c9d commit 2da746a
Show file tree
Hide file tree
Showing 48 changed files with 188 additions and 102 deletions.
7 changes: 7 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[codespell]
check-filenames =
check-hidden =
# Disable warnings about binary files
quiet-level = 2
skip = */.git,*/common_tools/cloc,*/TriBITSDoc,*/tribits/doc/guides/rst2latex.tex
ignore-words-list = thur,inout,te,nd,lod,aci,nin,nnumber,wile,reall,bu,somewhere
66 changes: 66 additions & 0 deletions .github/workflows/tribits_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: TriBITS Lint

on:
pull_request:
branches: [ master ]

jobs:
codespell-source:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Print GitHub Actions Environment Variables
run: |
set | grep "^GITHUB_"
- name: Update OS
run: |
sudo apt-get update -y
- name: Install packages
run: |
sudo apt-get install -y codespell
- name: Run Codespell on source code
run: |
codespell
codespell-commit-messages:
runs-on: ubuntu-latest

if: github.event.pull_request != null

steps:
- name: PR commits + 1
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"

- name: Checkout PR branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}

- name: Fetch base ref
run: |
git fetch origin ${{ github.event.pull_request.base.sha }}
- name: Print GitHub Actions Environment Variables
run: |
set | grep "^GITHUB_"
- name: Update OS
run: |
sudo apt-get update -y
- name: Install packages
run: |
sudo apt-get install -y codespell
- name: Run Codespell on commit messages
run: |
result=0
for commit in $(git rev-list HEAD ^${{ github.event.pull_request.base.sha }}); do
echo "Running codespell on commit message of $commit..."
git show --format=%B -s "$commit" | codespell - || result=1
done
exit $result
2 changes: 1 addition & 1 deletion README.DIRECTORY_CONTENTS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ functionality and assimilate into the TriBITS framework. It also contains
basic documentation and examples. Files and directories from here are what
get installed on the system or are snapshotted into
``<projectDir>/cmake/tribits/``. Each TriBITS Project decides what parts of
it wants to install or shapshot using the script
it wants to install or snapshot using the script
``tribits/snapshot_tribits.py`` (which takes arguments for what dirs to
snapshot, see below). This directory contains no tests at all. All of the
tests for TriBITS are in the ``test/`` directory (see below). The breakdown of
Expand Down
6 changes: 6 additions & 0 deletions common_tools/git/hooks/client-side/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
which codespell >> /dev/null
which_codespell_rtn=$?

if [[ "${which_codespell_rtn}" == "0" ]] ; then
codespell $1
fi
31 changes: 31 additions & 0 deletions common_tools/git/hooks/client-side/copy_hooks_scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
#
# Run from the base TriBITS git repo clone to install local git hooks
#
# $ cd TriBITS/
# $ ./commont_tools/git/client-side/copy_hooks_scripts.sh
#

if [[ ! -d .git ]] ; then
echo "Error, must be a base git repo with subdir .git/!"
exit 1
fi

_SCRIPT_DIR=`echo $0 | sed "s/\(.*\)\/copy_hooks_scripts.sh/\1/g"`

function copy_hook_script {
orig_file="$_SCRIPT_DIR/$1"
dest_file=".git/hooks/$1"

if diff ${orig_file} ${dest_file} &> /dev/null ; then
:
else
echo "Copy local git hook script: $1"
cp "${orig_file}" "${dest_file}"
fi
}

#echo "_SCRIPT_DIR = '$_SCRIPT_DIR'"

copy_hook_script commit-msg

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ if (PYTHON_EXECUTABLE)
doc
)
endif()

add_subdirectory(codespell)
4 changes: 2 additions & 2 deletions test/ci_support/CDashQueryAnalyzeReport_UnitTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ def test_simple(self):

def test_harder(self):
self.assertEqual(
getFileNameStrFromText("thi@ (something; other)"),
"thi___something__other_")
getFileNameStrFromText("this@ (something; other)"),
"this___something__other_")


#############################################################################
Expand Down
10 changes: 5 additions & 5 deletions test/ci_support/CheckinTest_UnitTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ def checkin_test_run_case(testObject, testName, optionsStr, cmndInterceptsStr, \
"--with-cmake=\""+g_withCmake+"\"",
"--project-name=Trilinos",
"--src-dir="+mockProjectBaseDir,
"--send-email-to=bogous@somwhere.com",
"--send-email-to=bogous@somewhere.com",
"--project-configuration=%s" % os.path.join(g_testBaseDir,
'CheckinTest_UnitTests_Config.py'),
optionsStr,
Expand Down Expand Up @@ -1658,7 +1658,7 @@ def checkin_test_run_case(testObject, testName, optionsStr, cmndInterceptsStr, \

if inPathGit:
baseCmndInterceptsStr += \
"IT: git config --get user.email; 0; bogous@somwhere.com\n" \
"IT: git config --get user.email; 0; bogous@somewhere.com\n" \
+"IT: which git; 0; /some/path/git\n"

fullCmndInterceptsStr = baseCmndInterceptsStr + cmndInterceptsStr
Expand Down Expand Up @@ -2237,7 +2237,7 @@ def test_do_all_no_git_installed(self):
+" --do-all --push" \
,
\
"IT: git config --get user.email; 0; bogous@somwhere.com\n" \
"IT: git config --get user.email; 0; bogous@somewhere.com\n" \
+"IT: which git; 1; '/usr/bin/which: no git in (path1:path2:path3)'\n" \
,
\
Expand Down Expand Up @@ -5634,9 +5634,9 @@ def test_send_email_only_on_failure_do_all_mpi_debug_build_configure_fail(self):
+g_expectedRegexBuildPasses \
+g_expectedRegexTestPasses \
+g_expectedCommonOptionsSummary \
+"Running: mailx -s .FAILED: Trilinos/MPI_DEBUG: configure failed. bogous@somwhere.com\n" \
+"Running: mailx -s .FAILED: Trilinos/MPI_DEBUG: configure failed. bogous@somewhere.com\n" \
+"SERIAL_RELEASE: Skipping sending build/test case email because it passed and --send-email-only-on-failure was set!\n" \
+"Running: mailx -s .FAILED CONFIGURE/BUILD/TEST: Trilinos: .* bogous@somwhere.com\n" \
+"Running: mailx -s .FAILED CONFIGURE/BUILD/TEST: Trilinos: .* bogous@somewhere.com\n" \
)


Expand Down
9 changes: 9 additions & 0 deletions test/codespell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
find_program(CODESPELL_EXEC codespell)

tribits_add_advanced_test(codespell
EXCLUDE_IF_NOT_TRUE CODESPELL_EXEC
OVERALL_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
SKIP_CLEAN_OVERALL_WORKING_DIRECTORY
TEST_0
CMND ${CODESPELL_EXEC}
)
2 changes: 1 addition & 1 deletion test/core/CompilerOptions_UnitTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ endfunction()
function(unitest_gcc_with_debug_symboles_options)

message("\n***")
message("*** Testing GCC base compiler options with debut symboles")
message("*** Testing GCC base compiler options with debut symbols")
message("***\n")

tribits_set_all_compiler_id(GNU)
Expand Down
6 changes: 3 additions & 3 deletions test/core/ExamplesUnitTests/TribitsExampleApp_Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ set_ENV_HACK_FOR_SIMPLETPL_ENVIRONMENT_ARG(SHARED)
#
# TribitsExampleApp_set_test_env_var([ALWAYS_SET_ENV_VARS])
#
# Must be alled after 'testDir' is defined!
# Must be called after 'testDir' is defined!
#
macro(TribitsExampleApp_set_test_env_var)

Expand Down Expand Up @@ -145,7 +145,7 @@ function(convertCMakePathsToNativePaths pathsListIn pathsListVarOut)
endfunction()


# Macro to handle the 'sharedOrStatic' arguemnt
# Macro to handle the 'sharedOrStatic' argument
#
macro(TribitsExampleApp_process_sharedOrStatic_arg)

Expand Down Expand Up @@ -1049,7 +1049,7 @@ function(TribitsExampleApp_ALL_ST_tpl_link_options byProjectOrPackage sharedOrSt

endfunction()
# NOTE: Above, it seems you always have to set LD_LIBRARY_PATH because CMake
# does not put in RPATH if you only specifiy the TPL directory using -L<dir>.
# does not put in RPATH if you only specify the TPL directory using -L<dir>.
# If you use the entire library file, CMake will put in RPATH correctly.


Expand Down
4 changes: 2 additions & 2 deletions test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ tribits_add_advanced_test( TribitsExampleProject_ALL_ST_NoFortran_enable_install
# source files from the installation testing source tree which shows that
# those files are not being built. It also leaves the library header files
# but it breaks them to ensure that they do not get selected therefore include
# dirs from the soruce tree are not added. Since the include directories from
# dirs from the source tree are not added. Since the include directories from
# the installed project are pulled in with -isystem, the -I for the local
# source tree would be searched first. Therefore, this test shows that those
# -I directories are not added to the compile lines. This above test also
Expand Down Expand Up @@ -3200,7 +3200,7 @@ tribits_add_advanced_test( TribitsExampleProject_extra_link_flags
# get sets even for packages without TPLs. The package SimpleCxx that
# depends on SimpleTPL proves that the extra libs get tacked on after the
# TPL's libs. Also, the fact that the extra libs are tacked on at the very
# end of the link lik for the 'c_util' exec shows that CMake is respecting
# end of the link like for the 'c_util' exec shows that CMake is respecting
# the dependency of libmixedlang.a on these extra libs. This test also
# shows that TriBITS and CMake do a good job of not listing the same libs
# more than once.
Expand Down
2 changes: 1 addition & 1 deletion test/core/ExamplesUnitTests/copy_files_glob.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copy files from a list of directories given a glob experession
# Copy files from a list of directories given a glob expression
#
# Usage::
#
Expand Down
4 changes: 2 additions & 2 deletions test/core/TestingFunctionMacro_UnitTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ function(unittest_tribits_add_test_basic)
"NAME;PackageA_SomeExec_test0;COMMAND;${PACKEXEN_PATH};has some;spaces;--and semi;colons too;NAME;PackageA_SomeExec_test1;COMMAND;${PACKEXEN_PATH};has2 some;spaces;--and2 semi;colons too"
)
unittest_compare_const( ${EXEN}_TEST_NAMES "${PACKEXEN}_test0;${PACKEXEN}_test1" )
# NOTE: There is a test under CTestScriptsUnitTests/ that actaully runs an
# NOTE: There is a test under CTestScriptsUnitTests/ that actually runs an
# real test and command that verifies the correct handling of semi-colons.
# The mashing that CMake above is doing to these replaced semicolons does
# not do them justice.
Expand Down Expand Up @@ -3676,7 +3676,7 @@ function(unittest_tribits_add_advanced_test_properties)
set(${PROJECT_NAME}_TRACE_ADD_TEST ON)
set(MESSAGE_WRAPPER_UNIT_TEST_MODE TRUE)

message("Test setting default properites")
message("Test setting default properties")
tribits_add_advanced_test_unittest_reset()
tribits_add_advanced_test( TAAT_basic_cmnd_1_args_0
TEST_0 CMND ${CMNDN}
Expand Down
6 changes: 3 additions & 3 deletions test/ctest_driver/TribitsExampleMetaProject/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ tribits_add_advanced_test( CTestDriver_TribitsExMetaProj_clone_default_branch_re
EXCLUDE_IF_NOT_TRUE ${PROJECT_NAME}_ENABLE_Fortran

TEST_0
MESSAGE "Run ctest driver with intial clone only of the repos on the default branch 'master' and remote 'origin'"
MESSAGE "Run ctest driver with initial clone only of the repos on the default branch 'master' and remote 'origin'"
CMND env
ARGS
CTEST_DASHBOARD_ROOT=PWD
Expand Down Expand Up @@ -621,7 +621,7 @@ tribits_add_advanced_test( CTestDriver_TribitsExMetaProj_clone_custom_branch_rem
if (NOT GIT_VERSION_STRING VERSION_LESS "2.10.0")
set(GIT_SUPPORTS_VERSION_DATE TRUE)
else()
set(GIT_SUPPORTS_VERSION_DATE FASLE)
set(GIT_SUPPORTS_VERSION_DATE FALSE)
endif()

set(FULL_TEST_BINARY_DIR
Expand Down Expand Up @@ -710,7 +710,7 @@ tribits_add_advanced_test( CTestDriver_TribitsExMetaProj_version_date
BUILD/install/include/TribitsExMetaProj_version_date.h

TEST_8
MESSAGE "Check just the version date macro in intalled TribitsExampleProject_version_date.h"
MESSAGE "Check just the version date macro in installed TribitsExampleProject_version_date.h"
CMND cat
ARGS BUILD/install/include/TribitsExampleProject_version_date.h
PASS_REGULAR_EXPRESSION
Expand Down
4 changes: 2 additions & 2 deletions test/ctest_driver/TribitsExampleProject/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ function(generate_aao_tests)
CMND ln
ARGS -s ${TribitsExProj_DIR} .
TEST_1
MESSAGE "Run ctest driver testing everyting but no push."
MESSAGE "Run ctest driver testing everything but no push."
CMND env
ARGS
CTEST_DASHBOARD_ROOT=PWD
Expand Down Expand Up @@ -1371,7 +1371,7 @@ function(generate_aao_tests)
# ${PACKAGE_NAME}_CTEST_DRIVER_SUBMIT_TO is set. This is so we can
# exactly control the CDash location vars and do a good test of the
# construction of the CDash URL. Note that we don't know the actual
# buildstamp because the buildstarttime changes everytime the test runs.
# buildstamp because the buildstarttime changes every time the test runs.
# We only know it is [8 digits]-[4 digits].


Expand Down
2 changes: 1 addition & 1 deletion test/python_utils/SnapshotDir_UnitTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def getDummyDefaultOptions():


# Run a snapshot-dir.py test case using mock commands all in memory without
# actually doing anyting on the disk or the filesystem.
# actually doing anything on the disk or the filesystem.
#
def runSnapshotDirTestCase(testObject, cmndLineArgsList, cmndInterceptList,
passRegexExpressionsList, defaultOptions=None \
Expand Down
10 changes: 5 additions & 5 deletions test/python_utils/gitdist_UnitTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def create_table_data(self):
"2019-10-17 16:32:15"]},
{"label": "Author", "align": "L",
"fields": ["[email protected]", "[email protected]",
"someone@somwhere.com"]},
"someone@somewhere.com"]},
{"label": "Summary", "align": "L",
"fields": ["Merge Pull Request #1234 from user/repo/branch",
"Fixed a Bug", "Did Some Work"]}
Expand All @@ -431,7 +431,7 @@ def test_full_markdown_table(self):
"|:-------------- |:-------:|:------------------- |:---------------------- |:---------------------------------------------- |\n" \
"| MockProjectDir | e2dc488 | 2019-10-23 10:16:07 | [email protected] | Merge Pull Request #1234 from user/repo/branch |\n" \
"| ExtraRepo1 | f671414 | 2019-10-22 11:18:47 | [email protected] | Fixed a Bug |\n" \
"| ExtraRepo2 | 50bbf3e | 2019-10-17 16:32:15 | someone@somwhere.com | Did Some Work |"
"| ExtraRepo2 | 50bbf3e | 2019-10-17 16:32:15 | someone@somewhere.com | Did Some Work |"
self.assertEqual(table, table_expected)


Expand Down Expand Up @@ -841,7 +841,7 @@ def writeGitMockProgram_dist_repo_versions_table():
"MOCK_PROGRAM_OUTPUT: 2019-10-17 16:32:15\n" \
"MOCK_PROGRAM_INPUT: log -1 --pretty=format:%ae\n" \
"MOCK_PROGRAM_RETURN: 0\n" \
"MOCK_PROGRAM_OUTPUT: someone@somwhere.com\n" \
"MOCK_PROGRAM_OUTPUT: someone@somewhere.com\n" \
"MOCK_PROGRAM_INPUT: log -1 --pretty=format:%s\n" \
"MOCK_PROGRAM_RETURN: 0\n" \
"MOCK_PROGRAM_OUTPUT: Did Some Work\n" \
Expand Down Expand Up @@ -904,7 +904,7 @@ def writeGitMockProgram_dist_repo_versions_table_1_change_base():
"MOCK_PROGRAM_OUTPUT: 2019-10-17 16:32:15\n" \
"MOCK_PROGRAM_INPUT: log -1 --pretty=format:%ae\n" \
"MOCK_PROGRAM_RETURN: 0\n" \
"MOCK_PROGRAM_OUTPUT: someone@somwhere.com\n" \
"MOCK_PROGRAM_OUTPUT: someone@somewhere.com\n" \
"MOCK_PROGRAM_INPUT: log -1 --pretty=format:%s\n" \
"MOCK_PROGRAM_RETURN: 0\n" \
"MOCK_PROGRAM_OUTPUT: Did Some Work\n" \
Expand Down Expand Up @@ -1730,7 +1730,7 @@ def test_dist_repo_versions_table(self):
"|:-------------- |:-------:|:------------------- |:---------------------- |:---------------------------------------------- |\n" \
"| MockProjectDir | e2dc488 | 2019-10-23 10:16:07 | [email protected] | Merge Pull Request #1234 from user/repo/branch |\n" \
"| ExtraRepo1 | f671414 | 2019-10-22 11:18:47 | [email protected] | Fixed a Bug |\n" \
"| ExtraRepo2 | 50bbf3e | 2019-10-17 16:32:15 | someone@somwhere.com | Did Some Work |\n"
"| ExtraRepo2 | 50bbf3e | 2019-10-17 16:32:15 | someone@somewhere.com | Did Some Work |\n"
self.assertEqual(s(cmndOut), s(cmndOut_expected))

finally:
Expand Down
4 changes: 2 additions & 2 deletions tribits/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ ChangeLog for TriBITS
macro `tribits_extpkg_define_dependencies()` that sets
`<tplName>_LIB_ALL_DEPENDENCIES`. Now `<tplName>_LIB_ENABLED_DEPENDENCIES`
is automatically set from `<tplName>_LIB_ALL_DEPENDENCIES` based on what
TPLs are actaully enabled. This avoids the problem described below from
TPLs are actually enabled. This avoids the problem described below from
directly setting `<tplName>_LIB_ENABLED_DEPENDENCIES` without reguard to
what TPLs are actaully enabled. This maintains backward compatibility for
what TPLs are actually enabled. This maintains backward compatibility for
existing configure scripts where an upstream TPL may not be enabled in some
strange configure scripts (see
[TriBITSPub/TriBITS#494](https://github.com/TriBITSPub/TriBITS/issues/494)).
Expand Down
Loading

0 comments on commit 2da746a

Please sign in to comment.