From 1b5332c2b95fd21ae7b172b1c31f870de84de863 Mon Sep 17 00:00:00 2001 From: Marenz Date: Thu, 18 Aug 2022 13:43:16 +0200 Subject: [PATCH] Fix spelling mistakes and CI spellcheck job --- .circleci/config.yml | 2 +- libevmasm/KnownState.h | 2 +- liblangutil/Scanner.cpp | 2 +- libsolutil/StringUtils.h | 2 +- scripts/codespell_ignored_lines.txt | 20 +++++++++++++++++++ scripts/codespell_whitelist.txt | 13 ------------ test/externalTests/README.md | 2 +- test/libevmasm/Optimiser.cpp | 4 ++-- test/liblangutil/Scanner.cpp | 12 +++++------ .../SolidityExpressionCompiler.cpp | 2 +- .../_prbmath/PRBMathCommon.sol | 2 +- .../_prbmath/PRBMathUD60x18.sol | 2 +- 12 files changed, 36 insertions(+), 29 deletions(-) create mode 100644 scripts/codespell_ignored_lines.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index 510341ef5..9717567ef 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -652,7 +652,7 @@ jobs: pip install --user codespell - run: name: Check spelling - command: ~/.local/bin/codespell -S "*.enc,.git,Dockerfile*" -I ./scripts/codespell_whitelist.txt + command: ~/.local/bin/codespell -S "*.enc,.git,Dockerfile*,LICENSE,codespell_whitelist.txt,codespell_ignored_lines.txt" -I ./scripts/codespell_whitelist.txt -x ./scripts/codespell_ignored_lines.txt - gitter_notify_failure_unless_pr chk_docs_examples: diff --git a/libevmasm/KnownState.h b/libevmasm/KnownState.h index 723170610..8c28fbb62 100644 --- a/libevmasm/KnownState.h +++ b/libevmasm/KnownState.h @@ -132,7 +132,7 @@ public: /// @returns true if the knowledge about the state of both objects is (known to be) equal. bool operator==(KnownState const& _other) const; - /// Retrieves the current equivalence class fo the given stack element (or generates a new + /// Retrieves the current equivalence class for the given stack element (or generates a new /// one if it does not exist yet). Id stackElement(int _stackHeight, langutil::SourceLocation const& _location); /// @returns the stackElement relative to the current stack height. diff --git a/liblangutil/Scanner.cpp b/liblangutil/Scanner.cpp index 819dafaf5..d769a9363 100644 --- a/liblangutil/Scanner.cpp +++ b/liblangutil/Scanner.cpp @@ -425,7 +425,7 @@ Token Scanner::scanMultiLineDocComment() while (!isSourcePastEndOfInput()) { - //handle newlines in multline comments + // handle newlines in multiline comments if (atEndOfLine()) { skipWhitespace(); diff --git a/libsolutil/StringUtils.h b/libsolutil/StringUtils.h index a50d679e8..d7e123850 100644 --- a/libsolutil/StringUtils.h +++ b/libsolutil/StringUtils.h @@ -206,7 +206,7 @@ inline std::string formatNumberReadable( } } -/// Safely converts an usigned integer as string into an unsigned int type. +/// Safely converts an unsigned integer as string into an unsigned int type. /// /// @return the converted number or nullopt in case of an failure (including if it would not fit). inline std::optional toUnsignedInt(std::string const& _value) diff --git a/scripts/codespell_ignored_lines.txt b/scripts/codespell_ignored_lines.txt new file mode 100644 index 000000000..b7987cc00 --- /dev/null +++ b/scripts/codespell_ignored_lines.txt @@ -0,0 +1,20 @@ + A constant BT = BU; + A constant BU = BV; + A constant FN = FO; + A constant FO = FP; + struct BT { BU m; } + struct BU { BV m; } + struct FN { FO m; } + struct FO { FP m; } +// encode_inline_asm(bytes): 0x20, 2, "fo" -> 0x20, 4, "Zm8=" +// encode_no_asm(bytes): 0x20, 2, "fo" -> 0x20, 4, "Zm8=" + BOOST_TEST(mutation(chromosome) == Chromosome("fo")); +docker run --rm -v "${OUTPUTDIR}":/tmp/output -v "${SCRIPTDIR}":/tmp/scripts:ro -it trzeci/emscripten:sdk-tag-1.39.3-64bit /tmp/scripts/docker-scripts/rebuild_tags.sh "${TAGS}" /tmp/output "$@" + + + + templ("assignEnd", dynamic ? "end := pos" : ""); + templ("assignEnd", dynamic ? "end := pos" : ""); + templ("assignEnd", "end := pos"); + templ("assignEnd", "end := tail"); + templ("assignEnd", ""); diff --git a/scripts/codespell_whitelist.txt b/scripts/codespell_whitelist.txt index 035060866..7de8a42fe 100644 --- a/scripts/codespell_whitelist.txt +++ b/scripts/codespell_whitelist.txt @@ -1,16 +1,3 @@ -iff nd -assignend -uint -mut -BA -FO -ba -fo compilability -errorstring -hist -otion keypair -ether -sur diff --git a/test/externalTests/README.md b/test/externalTests/README.md index 76e39a79b..8df5b4dfe 100644 --- a/test/externalTests/README.md +++ b/test/externalTests/README.md @@ -79,7 +79,7 @@ The above is the workflow to use when the update is straightforward and looks sa fine to just modify the branches directly. If this is not the case, it is recommended to first perform the operation on copies of these version-specific branches and test them by creating PRs on `develop` and `breaking` to see if tests pass. The PRs should just modify project scripts in `test/externalScripts/` -to use the updated copies of the branches and can be discarded aferwards without being merged. +to use the updated copies of the branches and can be discarded afterwards without being merged. #### Changes needed after a breaking release of the compiler When a non-backwards-compatible version becomes the most recent release, `breaking` branch diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp index aaf5498ec..f08f227cb 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -714,10 +714,10 @@ BOOST_AUTO_TEST_CASE(cse_keccak256_twice_same_content_noninterfering_store_in_be Instruction::MSTORE, // m[12] = DUP1 Instruction::DUP12, u256(12 + 32), - Instruction::MSTORE, // does not destoy memory knowledge + Instruction::MSTORE, // does not destroy memory knowledge Instruction::DUP13, u256(128 - 32), - Instruction::MSTORE, // does not destoy memory knowledge + Instruction::MSTORE, // does not destroy memory knowledge u256(0x20), u256(12), Instruction::KECCAK256 // keccak256(m[12..(12+32)]) diff --git a/test/liblangutil/Scanner.cpp b/test/liblangutil/Scanner.cpp index c8a88ec82..c288ed854 100644 --- a/test/liblangutil/Scanner.cpp +++ b/test/liblangutil/Scanner.cpp @@ -329,7 +329,7 @@ BOOST_AUTO_TEST_CASE(trailing_dot_in_numbers) BOOST_AUTO_TEST_CASE(leading_underscore_decimal_is_identifier) { - // Actual error is cought by SyntaxChecker. + // Actual error is caught by SyntaxChecker. CharStream stream("_1.2", ""); Scanner scanner(stream); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier); @@ -339,7 +339,7 @@ BOOST_AUTO_TEST_CASE(leading_underscore_decimal_is_identifier) BOOST_AUTO_TEST_CASE(leading_underscore_decimal_after_dot_illegal) { - // Actual error is cought by SyntaxChecker. + // Actual error is caught by SyntaxChecker. TestScanner scanner("1._2"); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Number); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); @@ -351,7 +351,7 @@ BOOST_AUTO_TEST_CASE(leading_underscore_decimal_after_dot_illegal) BOOST_AUTO_TEST_CASE(leading_underscore_exp_are_identifier) { - // Actual error is cought by SyntaxChecker. + // Actual error is caught by SyntaxChecker. CharStream stream("_1e2", ""); Scanner scanner(stream); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier); @@ -360,7 +360,7 @@ BOOST_AUTO_TEST_CASE(leading_underscore_exp_are_identifier) BOOST_AUTO_TEST_CASE(leading_underscore_exp_after_e_illegal) { - // Actual error is cought by SyntaxChecker. + // Actual error is caught by SyntaxChecker. CharStream stream("1e_2", ""); Scanner scanner(stream); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Number); @@ -379,7 +379,7 @@ BOOST_AUTO_TEST_CASE(leading_underscore_hex_illegal) BOOST_AUTO_TEST_CASE(fixed_number_invalid_underscore_front) { - // Actual error is cought by SyntaxChecker. + // Actual error is caught by SyntaxChecker. CharStream stream("12._1234_1234", ""); Scanner scanner(stream); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Number); @@ -388,7 +388,7 @@ BOOST_AUTO_TEST_CASE(fixed_number_invalid_underscore_front) BOOST_AUTO_TEST_CASE(number_literals_with_trailing_underscore_at_eos) { - // Actual error is cought by SyntaxChecker. + // Actual error is caught by SyntaxChecker. TestScanner scanner("0x123_"); BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Number); BOOST_CHECK_EQUAL(scanner.next(), Token::EOS); diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index 4fef140e8..2741290fc 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -168,7 +168,7 @@ bytes compileFirstExpression( )); context.appendMissingLowLevelFunctions(); - // NOTE: We intentionally disable optimisations for utility functions to simplfy the tests + // NOTE: We intentionally disable optimisations for utility functions to simplify the tests context.appendYulUtilityFunctions({}); BOOST_REQUIRE(context.appendYulUtilityFunctionsRan()); diff --git a/test/libsolidity/semanticTests/externalContracts/_prbmath/PRBMathCommon.sol b/test/libsolidity/semanticTests/externalContracts/_prbmath/PRBMathCommon.sol index 923b54c2d..9ec351b6c 100644 --- a/test/libsolidity/semanticTests/externalContracts/_prbmath/PRBMathCommon.sol +++ b/test/libsolidity/semanticTests/externalContracts/_prbmath/PRBMathCommon.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.0; /// @dev Common mathematical functions used in both PRBMathSD59x18 and PRBMathUD60x18. Note that this shared library /// does not always assume the signed 59.18-decimal fixed-point or the unsigned 60.18-decimal fixed-point -// representation. When it does not, it is annonated in the function's NatSpec documentation. +// representation. When it does not, it is annotated in the function's NatSpec documentation. library PRBMathCommon { /// @dev How many trailing decimals can be represented. uint256 internal constant SCALE = 1e18; diff --git a/test/libsolidity/semanticTests/externalContracts/_prbmath/PRBMathUD60x18.sol b/test/libsolidity/semanticTests/externalContracts/_prbmath/PRBMathUD60x18.sol index 2732d95b6..0313481f6 100644 --- a/test/libsolidity/semanticTests/externalContracts/_prbmath/PRBMathUD60x18.sol +++ b/test/libsolidity/semanticTests/externalContracts/_prbmath/PRBMathUD60x18.sol @@ -28,7 +28,7 @@ library PRBMathUD60x18 { /// @notice Calculates arithmetic average of x and y, rounding down. /// @param x The first operand as an unsigned 60.18-decimal fixed-point number. /// @param y The second operand as an unsigned 60.18-decimal fixed-point number. - /// @return result The arithmetic average as an usigned 60.18-decimal fixed-point number. + /// @return result The arithmetic average as an unsigned 60.18-decimal fixed-point number. function avg(uint256 x, uint256 y) internal pure returns (uint256 result) { // The operations can never overflow. unchecked {