Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Codespell GitHub action #1234

Merged
merged 13 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .codespellexclude
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
v8->setName("neether");
" <unit units=\"ned\"/>\n"
<ci>ths</ci>
<ci>ths</ci>
<variable units="dimensionless" name="ths"/>
auto ue = std::any_cast<libcellml::UnitsItemPtr>(expectedItems[id][index].second);
* Fixed typos: occurence -> occurRence by `@agarny <https://github.com/agarny>`_ [`#794 <https://github.com/cellml/libcellml/pull/794>`_].
std::vector<size_t> mErrors;
mErrors.push_back(index);
mErrors.erase(mErrors.begin() + ptrdiff_t(index));
mIssues.erase(mIssues.begin() + ptrdiff_t(mErrors.at(index)));
mErrors.clear();
if (index < pFunc()->mErrors.size()) {
issue = pFunc()->mIssues.at(pFunc()->mErrors.at(index));
return pFunc()->mErrors.size();
21 changes: 21 additions & 0 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# GitHub Action to automate the identification of common misspellings in text files.
# https://github.com/codespell-project/actions-codespell
# https://github.com/codespell-project/codespell
name: codespell
on: [pull_request]

permissions:
contents: read

jobs:
codespell:
if: github.repository == 'cellml/libcellml'
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
skip: ./.git,./tests/gtest/include/gtest/gtest.h,./tests/gtest/src/gtest-all.cc,./src/dtds/mathml2/*
exclude_file: .codespellexclude
4 changes: 2 additions & 2 deletions docs/configure_and_build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Policy CMP0086 is not set
-------------------------

Despite being in red and repeated multiple times, this is a warning which can safely be ignored.
It's caused by a version mis-match between SWIG and libCellML and will be addressed in the next release.
It's caused by a version mismatch between SWIG and libCellML and will be addressed in the next release.

.. figure:: ./images/libCellMLBuilding-PolicyCMP0086Error.png
:align: center
Expand Down Expand Up @@ -223,7 +223,7 @@ Once you have used CMake to configure and generate your project files, either pu
Fatal error: Cannot open include file Python.h
++++++++++++++++++++++++++++++++++++++++++++++

If you've included Python bindings in your CMake configuration, but get this error in Visual Studio at build time, it's because the path to the Python installation was not set correctly in the CMake step. Re-running the CMake configuration with a manually-specified path to the Python installation will solve the problem. See `ERROR: On Windows without Python debug libaries` for instructions.
If you've included Python bindings in your CMake configuration, but get this error in Visual Studio at build time, it's because the path to the Python installation was not set correctly in the CMake step. Re-running the CMake configuration with a manually-specified path to the Python installation will solve the problem. See `ERROR: On Windows without Python debug libraries` for instructions.

Cannot access xxx
+++++++++++++++++
Expand Down
6 changes: 3 additions & 3 deletions docs/dev_utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Utilities
=========

This document covers the utilities that are availble to developers of libCellML.
This document covers the utilities that are available to developers of libCellML.
The utilities are not built or made available by default.
The utilities can be enabled through the configuration of the library.
In order to enable the utilities, set the configuration variable :code:`LIBCELLML_ENABLE_UTILITIES` to :code:`TRUE`.
Expand All @@ -18,7 +18,7 @@ Create MathML DTD files
The create MathML DTD files utility generates a compressed MathML DTD.
The MathML DTD is used to determine the validity of MathML strings in a CellML document.
This utility updates the header file :code:`mathmldtd.h` and source file :code:`mathmldtd.cpp` in the source tree of the current build.
For a make-based envirionment, the utility may be run with the following command::
For a make-based environment, the utility may be run with the following command::

make create_mathml_dtd_files

Expand All @@ -27,6 +27,6 @@ Update generator profile SHA-1 values

The update generator profile SHA-1 values utility calculates the SHA-1 values for the current C and Python generator profiles.
This utility updates the header file :code:`generatorprofilesha1values.h` in the source tree of the current build.
For a make-based envirionment, the utility may be run with the following command::
For a make-based environment, the utility may be run with the following command::

make update_generator_profile_sha1_values
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ else()
target_compile_definitions(cellml PUBLIC ${LIBXML2_DEFINITIONS})
endif()

# Use target compile features to propogate features to consuming projects.
# Use target compile features to propagate features to consuming projects.
target_compile_features(cellml PUBLIC cxx_std_17)

set_target_properties(cellml PROPERTIES
Expand Down
2 changes: 1 addition & 1 deletion src/analyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ bool AnalyserInternalEquation::check(const AnalyserModelPtr &model,

// An ODE equation may have a dependency on the state of that ODE (e.g.,
// dx/dt = x+3). Similarly, an NLA equation will have a "dependency" on
// its unknown variables. Either way, we must remove our "depenencies"
// its unknown variables. Either way, we must remove our "dependencies"
// on our unknown variables or we will end up in a circular dependency.

for (const auto &unknownVariable : mUnknownVariables) {
Expand Down
2 changes: 1 addition & 1 deletion src/api/libcellml/importsource.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class LIBCELLML_EXPORT ImportSource: public Entity
* Get the source @ref Model's URL set in this instance. If no source @ref Model
* URL is set then return an empty string.
*
* @return The URL of the source @ref Model if set otherwise the emtpy string.
* @return The URL of the source @ref Model if set otherwise the empty string.
*/
std::string url() const;

Expand Down
2 changes: 1 addition & 1 deletion src/api/libcellml/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class LIBCELLML_EXPORT Model: public ComponentEntity
/**
* @brief Remove any empty components and units from the model.
*
* Remove any empty components and units fom this model.
* Remove any empty components and units from this model.
* In this context, "empty" means:
* - components with no name, identifier, resets, variables, maths, or non-empty child components; and
* - units which have no name, identifier, or child units.
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/interface/createconstructor.i
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is a helper macro for extending the bindings to have a Constructor mapped to the static create method.

// The macro create_name_constructor must be used in conjuction with the create_constructor macro.
// The macro create_name_constructor must be used in conjunction with the create_constructor macro.

%define %create_constructor(TYPE...)
%typemap(out) libcellml::TYPE *TYPE() {
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ foreach(SWIG_INTERFACE_SRC ${SWIG_INTERFACE_SRCS})
endif()

if (APPLE)
# Specifically allow dynamic lookup, here we are really targetting Python symbols.
# Specifically allow dynamic lookup, here we are really targeting Python symbols.
set_target_properties(${MODULE_TARGET} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
# But, we do need to know about the Python include directories.
target_include_directories(${MODULE_TARGET} PRIVATE ${Python_INCLUDE_DIRS})
Expand Down
2 changes: 1 addition & 1 deletion src/internaltypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const std::string ORIGIN_MODEL_REF = ":this:";

using ComponentNameMap = std::map<std::string, ComponentPtr>; /**< Type definition for map of component name to component pointer. */

using IndexStack = std::vector<size_t>; /**< Type definition for tracking indicies. */
using IndexStack = std::vector<size_t>; /**< Type definition for tracking indices. */
using EquivalenceMap = std::map<IndexStack, std::vector<IndexStack>>; /**< Type definition for map of variable equivalences defined over model. */

using NameList = std::vector<std::string>; /**< Type definition for list of names. */
Expand Down
4 changes: 2 additions & 2 deletions src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class Parser::ParserImpl: public Logger::LoggerImpl
/**
* @brief Recursively update the @p model with the encapsulation parsed from the @p node.
*
* Recusively parse through the @p node to create the component hierarchy. Returns the
* Recursively parse through the @p node to create the component hierarchy. Returns the
* root component of the hierarchy to the calling method.
*
* @param model The @c ModelPtr to update.
Expand Down Expand Up @@ -294,7 +294,7 @@ ModelPtr Parser::ParserImpl::parseModel(const std::string &input)
* @brief Test to determine if the attribute is an XML identifier.
*
* Test to determine if the attribute is an XML identifier. When
* transfoming from CellML 1.0 and CellML 1.1 it will also test for
* transforming from CellML 1.0 and CellML 1.1 it will also test for
* XML identifiers in the CMETA 1.0 namespace.
*
* @param attribute The attribute to test.
Expand Down
4 changes: 2 additions & 2 deletions src/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ bool canConvertToBasicDouble(const std::string &in);
* @sa isCellMLReal
*
* @param in The @c std::string value to convert to a @c double.
* @param out The value of the @p in as a doulbe if the conversion was successful,
* @param out The value of the @p in as a double if the conversion was successful,
* left unchanged if the conversion fails.
*
* @return @c true if the conversion succeeded, @c false otherwise.
Expand Down Expand Up @@ -710,7 +710,7 @@ std::vector<VariablePtr> equivalentVariables(const VariablePtr &variable);
* @param owner The owner to compare entities with.
* @param entities The list of entities to equate.
*
* @return @c true if all the entities in @p entities are equal to entites in the @p owner.
* @return @c true if all the entities in @p entities are equal to entities in the @p owner.
*/
bool equalEntities(const EntityPtr &owner, const std::vector<EntityPtr> &entities);

Expand Down
4 changes: 2 additions & 2 deletions src/validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class Validator::ValidatorImpl: public LoggerImpl
/**
* @brief Validate the component tree of the given @p component.
*
* Validate the given compoment and all child components of the component.
* Validate the given component and all child components of the component.
*
* @param model The model the @p component comes from.
* @param component The @c Component to validate.
Expand Down Expand Up @@ -711,7 +711,7 @@ ValidatorPtr Validator::create() noexcept

void Validator::validateModel(const ModelPtr &model)
{
// Clear any pre-existing issues in ths validator instance.
// Clear any pre-existing issues in this validator instance.
pFunc()->removeAllIssues();

if (model == nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion src/variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ bool Variable::VariableImpl::hasEquivalentVariable(const VariablePtr &equivalent
*
* @param variable1 The first variable to test.
* @param variable2 The second variable to test.
* @param testedVariables Vector of previoulsy tested variables.
* @param testedVariables Vector of previously tested variables.
*
* @return True if the two given variables are equivalent, false otherwise.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/xmlnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class XmlNode
*
* Set the attribute of the given @p attributeName to the given @p attributeValue.
* The attribute name must already exist.
* If the attribute name does not already exist the attibute value will not be modified.
* If the attribute name does not already exist the attribute value will not be modified.
*
* @param attributeName The @c char attribute type.
* @param attributeValue The @c char value of the attribute to set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ http://www.CellML.org/
<modified xmlns="http://purl.org/dc/terms/">
<rdf:Description rdf:about="rdf:#5bc4f7d2-1306-4281-88b5-a5afe628bc66" />
</modified>
<rdf:value xml:lang="en">Added stimulus protocol to allow simulation of trains of action potentials. The stimulus amplitude (20 microamperes per cm2) and duration (0.5 ms) were taken from the single stimulus in the previous version. Set a period of 200 ms (arbitrary) to allow visualisation of 3 action potentials together at a resonable zoom level.</rdf:value>
<rdf:value xml:lang="en">Added stimulus protocol to allow simulation of trains of action potentials. The stimulus amplitude (20 microamperes per cm2) and duration (0.5 ms) were taken from the single stimulus in the previous version. Set a period of 200 ms (arbitrary) to allow visualisation of 3 action potentials together at a reasonable zoom level.</rdf:value>
<cmeta:modifier>
<rdf:Description rdf:about="rdf:#e897f342-e771-4ae3-876d-062dfdfccc88" />
</cmeta:modifier>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
<ci>b</ci>
</apply>
<apply>
<!-- 'root' element with two MathML siblings but first MathML sibling not a 'degree' elelement. -->
<!-- 'root' element with two MathML siblings but first MathML sibling not a 'degree' element. -->
<root/>
<ci>a</ci>
<ci>b</ci>
Expand Down Expand Up @@ -281,7 +281,7 @@
<ci>b</ci>
</apply>
<apply>
<!-- 'log' element with two MathML siblings but first MathML sibling not a 'logbase' elelement. -->
<!-- 'log' element with two MathML siblings but first MathML sibling not a 'logbase' element. -->
<log/>
<ci>a</ci>
<ci>b</ci>
Expand Down Expand Up @@ -325,7 +325,7 @@
<ci>b</ci>
</apply>
<apply>
<!-- 'diff' element with first MathML sibling not a 'bvar' elelement. -->
<!-- 'diff' element with first MathML sibling not a 'bvar' element. -->
<diff/>
<ci>a</ci>
<ci>b</ci>
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ void TEST_EXPORT compareModel(const libcellml::ModelPtr &m1, const libcellml::Mo
expectEqualIssuesSpecificationHeadingsUrls(issues, specificationHeadings, urls, logger)

#define EXPECT_EQ_ISSUES_CELLMLELEMENTTYPES_LEVELS_REFERENCERULES_URLS(issues, cellmlElementTypes, levels, referenceRules, urls, logger) \
SCOPED_TRACE("Issue occured here."); \
SCOPED_TRACE("Issue occurred here."); \
expectEqualIssuesCellmlElementTypesLevelsReferenceRulesUrls(issues, cellmlElementTypes, levels, referenceRules, urls, logger)
2 changes: 1 addition & 1 deletion tests/units/units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1722,7 +1722,7 @@ TEST(Units, compareUnitsCompatibleComplex)
u2->setName("u2");
u2->addUnit(libcellml::Units::StandardUnit::AMPERE, 0, 1.0, 3.0);
u2->addUnit("u");
u2->addUnit("metre", "milli", 2.0, 1.0); // Only unit attirbutes which matter now are the exponent and the base unit. Not interested in multipliers.
u2->addUnit("metre", "milli", 2.0, 1.0); // Only unit attributes which matter now are the exponent and the base unit. Not interested in multipliers.

libcellml::ModelPtr model = libcellml::Model::create();
model->setName("model");
Expand Down