diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 0000000000..7c84f7da4f --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,21 @@ +--- +name: actionlint +'on': + push: + branches: + - master + pull_request: + branches: + - master +jobs: + actionlint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Download actionlint + id: get_actionlint + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + shell: bash + - name: Check workflow files + run: ${{ steps.get_actionlint.outputs.executable }} -color + shell: bash diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index adee863282..99d67255cf 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -16,7 +16,7 @@ jobs: codecov: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 - uses: teatimeguest/setup-texlive-action@v3.2.1 with: update-all-packages: true diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 20d1e638f7..7c18d12027 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -8,23 +8,27 @@ jobs: build: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 - uses: teatimeguest/setup-texlive-action@v3.2.1 with: update-all-packages: true packages: scheme-basic geometry xcolor naive-ebnf microtype etoolbox + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 20 - uses: actions/cache@v4 with: path: ~/.m2/repository - key: ${{ runner.os }}-jdk-${{ matrix.java }}-maven-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-jdk-20-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - ${{ runner.os }}-jdk-${{ matrix.java }}-maven- + ${{ runner.os }}-jdk-20-maven- - run: | # Clean the test classes to avoid caching issues and prepare testing environment # without running the tests mvn clean install -Pqulice -DskipTests -DskipITs -Dinvoker.skip=true # Find script - SCRIPT="${GITHUB_WORKSPACE}/src/test/scripts/test-repetition.sh" + SCRIPT=${GITHUB_WORKSPACE}/src/test/scripts/test-repetition.sh # Check that script is exists if [ ! -f "${SCRIPT}" ]; then echo "Script ${SCRIPT} not found" @@ -33,15 +37,15 @@ jobs: # Make script runnable chmod +x "${SCRIPT}" # Test eo-parser - ${SCRIPT} --max 10 --folder ${GITHUB_WORKSPACE}/eo-parser + "${SCRIPT}" --max 10 --folder "${GITHUB_WORKSPACE}/eo-parser" # Test eo-maven-plugin - ${SCRIPT} --max 10 --folder ${GITHUB_WORKSPACE}/eo-maven-plugin + "${SCRIPT}" --max 10 --folder "${GITHUB_WORKSPACE}/eo-maven-plugin" # Test eo-runtime - ${SCRIPT} --max 10 --folder ${GITHUB_WORKSPACE}/eo-runtime --compilation true + "${SCRIPT}" --max 10 --folder "${GITHUB_WORKSPACE}/eo-runtime" --compilation true report-fail: name: Create issue on failure needs: build - if: failure() && github.even.pull_request == null + if: failure() && github.event.pull_request == null runs-on: ubuntu-22.04 steps: - uses: jayqi/failed-build-issue-action@v1 diff --git a/.github/workflows/ebnf.yml b/.github/workflows/ebnf.yml index 34b9fac415..0a3f846626 100644 --- a/.github/workflows/ebnf.yml +++ b/.github/workflows/ebnf.yml @@ -13,7 +13,7 @@ jobs: env: CONVERT_PATH: /tmp/antlr4-to-bnf-converter steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 - run: | sudo apt-get update sudo apt-get -y install ghostscript imagemagick texlive-extra-utils pdf2svg inkscape @@ -28,8 +28,8 @@ jobs: - uses: actions/cache@v4 with: path: ~/.m2/repository - key: ${{ runner.os }}-jdk-${{ matrix.java }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-jdk-${{ matrix.java }}-maven- + key: ${{ runner.os }}-jdk-20-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-jdk-20-maven- - run: | mkdir -p "$CONVERT_PATH" wget --quiet http://public.yegor256.com/convert.zip -O /tmp/convert.zip diff --git a/.github/workflows/gpt-code-review.yml b/.github/workflows/gpt-code-review.yml index e19e1effff..683f91dc6b 100644 --- a/.github/workflows/gpt-code-review.yml +++ b/.github/workflows/gpt-code-review.yml @@ -10,7 +10,7 @@ jobs: build: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-node@v4 diff --git a/.github/workflows/loc-badge.yml b/.github/workflows/loc-badge.yml index c2b68fdbe9..a068afd74d 100644 --- a/.github/workflows/loc-badge.yml +++ b/.github/workflows/loc-badge.yml @@ -11,7 +11,7 @@ jobs: loc-badge: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 - uses: shadowmoose/GHA-LoC-Badge@1.0.0 with: debug: true diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index 62b9aac4f3..a11dbe4fcf 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -1,6 +1,6 @@ --- name: markdown-lint -on: +'on': push: branches: - master @@ -8,12 +8,9 @@ on: branches: - master paths-ignore: [ 'paper/**', 'sandbox/**' ] -concurrency: - group: markdown-lint-${{ github.ref }} - cancel-in-progress: true jobs: markdown-lint: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@8459bc0c7e3759cdf591f513d9f141a95fef0a8f + - uses: actions/checkout@v4 - uses: articulate/actions-markdownlint@v1 diff --git a/.github/workflows/simian.yml b/.github/workflows/simian.yml index 0aaee3bc75..216adc49cb 100644 --- a/.github/workflows/simian.yml +++ b/.github/workflows/simian.yml @@ -16,12 +16,10 @@ jobs: simian: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 17 - - run: | - wget --quiet http://public.yegor256.com/simian.jar -O /tmp/simian.jar - - run: | - java -jar /tmp/simian.jar -threshold=19 -excludes=**/gen -excludes=**/it **/*.java + - run: wget --quiet http://public.yegor256.com/simian.jar -O /tmp/simian.jar + - run: java -jar /tmp/simian.jar -threshold=19 "-excludes=**/gen" "-excludes=**/it" "**/*.java" diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 3f1747d484..ff53f9c536 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -11,7 +11,7 @@ jobs: sonar: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: teatimeguest/setup-texlive-action@v3.2.1 diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 0000000000..74c330cbb6 --- /dev/null +++ b/.github/workflows/typos.yml @@ -0,0 +1,16 @@ +--- + +name: typos +'on': + push: + branches: + - master + pull_request: + branches: + - master +jobs: + typos: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@master diff --git a/.github/workflows/up.yml b/.github/workflows/up.yml index fd7ec0b84f..3463a54a07 100644 --- a/.github/workflows/up.yml +++ b/.github/workflows/up.yml @@ -13,7 +13,7 @@ jobs: up: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 - run: |- git fetch --tags --force && \ latest=$(git tag --sort=creatordate | tail -1) && \ diff --git a/.github/workflows/xcop.yml b/.github/workflows/xcop.yml index 225b4377be..c0ab79a52c 100644 --- a/.github/workflows/xcop.yml +++ b/.github/workflows/xcop.yml @@ -14,7 +14,7 @@ jobs: xcop: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 - uses: g4s8/xcop-action@v1.3 with: files: | diff --git a/.github/workflows/year.yml b/.github/workflows/year.yml index 86b3f80047..8415773d52 100644 --- a/.github/workflows/year.yml +++ b/.github/workflows/year.yml @@ -10,7 +10,7 @@ jobs: license: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: FantasticFiasco/action-update-license-year@v3 diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000000..28589a6135 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,14 @@ +[default] +extend-ignore-identifiers-re = [ + "Olt*", # false positive + "Onot", # false positive + "BA", # false positive + "thi", # false positive + "lowcase", # false positive + "[D,d]atas*", # valid variable names + "thr", # valid variable name + "cutted", # valid variable name + "splitted", # valid variable name + "scrpt", # valid variable name + "fle" # valid variable name +] diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java index 7e4f7d0e98..639ba36302 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java @@ -167,7 +167,7 @@ count, new Rel(this.phiInputDir), new Rel(this.phiOutputDir) /** * Translate given xmir to phi calculus expression. - * @param train Train that optimize and traslates given xmir + * @param train Train that optimize and translates given xmir * @param xmir Text of xmir * @return Translated xmir * @throws ImpossibleToPhiTranslationException If fails to translate given XMIR to phi diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChRemote.java b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChRemote.java index 8561f5760e..fbe1393a2b 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChRemote.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/ChRemote.java @@ -25,7 +25,6 @@ import com.jcabi.log.Logger; import org.cactoos.Text; -import org.cactoos.text.Sticky; /** * Hash of tag from objectionary. @@ -37,7 +36,7 @@ public final class ChRemote implements CommitHash { /** * Cached text of hashes. */ - private static final Text CACHE = new Sticky(new CommitHashesText()); + private static final Text CACHE = new CommitHashesText(); /** * Tag. diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/CommitHash.java b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/CommitHash.java index 53043dd03e..9491b1d79e 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/hash/CommitHash.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/hash/CommitHash.java @@ -23,12 +23,15 @@ */ package org.eolang.maven.hash; +import org.cactoos.Scalar; + /** * Hash of tag. * * @since 0.28.11 */ -public interface CommitHash { +@FunctionalInterface +public interface CommitHash extends Scalar { /** * SHA Hash. diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/PrintMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/PrintMojoTest.java index 19675809cf..05678f6ee3 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/PrintMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/PrintMojoTest.java @@ -95,7 +95,7 @@ void printsInStraightNotation(final String pack, @TempDir final Path temp) throw void printsInReversedNotation(final String pack, @TempDir final Path temp) throws Exception { final Map yaml = new Yaml().load(pack); MatcherAssert.assertThat( - "PrintMojo should print EO in reveresed notation, but it didn't", + "PrintMojo should print EO in reversed notation, but it didn't", PrintMojoTest.printed(yaml, temp, true).asString(), Matchers.equalTo((String) yaml.get("reversed")) ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java index a4caff7ff3..e13694abed 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/VerifyMojoTest.java @@ -251,7 +251,7 @@ void failsOnWarning(@TempDir final Path temp) throws Exception { /** * Apply XSL transformation. * @param xsl Path to XSL within classpath - * @param xml Path to XML to be tranformed + * @param xml Path to XML to be transformed */ private static void applyXsl(final String xsl, final Path xml) throws Exception { final XML output = new Xsline( diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java index 7e3c048a9d..67d6c38c8f 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/hash/ChRemoteTest.java @@ -25,6 +25,10 @@ package org.eolang.maven.hash; import com.yegor256.WeAreOnline; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; +import org.cactoos.experimental.Threads; import org.eolang.maven.BinarizeParseTest; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -67,4 +71,22 @@ void throwsCommitHashException() { BinarizeParseTest.TO_ADD_MESSAGE ); } + + @Test + void isThreadSafe() { + final int threads = 200; + final String sample = new ChRemote("0.23.19").value(); + MatcherAssert.assertThat( + "You can use this class concurrently", + StreamSupport.stream( + new Threads<>( + threads, + Stream.generate( + () -> new ChRemote("0.23.19") + ).limit(threads).collect(Collectors.toList()) + ).spliterator(), false + ).filter(str -> !sample.equals(str)).collect(Collectors.toList()), + Matchers.empty() + ); + } } diff --git a/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 b/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 index b3299864a0..be88cd0fbd 100644 --- a/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 +++ b/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 @@ -275,7 +275,7 @@ vapplicationArgUnboundCurrent vapplicationArgUnboundNext : vapplicationArgVanonymUnbound // vertical anonym object | vapplicationHeadNamed vapplicationArgs // vertical application - | reversed oname? vapplicationArgsReversed // reversed verical application + | reversed oname? vapplicationArgsReversed // reversed vertical application ; // Horizontal application as argument of vertical application @@ -351,7 +351,7 @@ onlyphiTail: spacedArrow attributes ; // Inner object of horizontal anonym object -// Does not contan elements in vertical notation +// Does not contain elements in vertical notation hanonymInner : SPACE LB (hmethod | hmethodVersioned | happlication | hanonym | just) oname RB ; @@ -390,7 +390,7 @@ hmethodExtended // The whole method is written in one line // The head does not contain elements in vertical notation // The division of elements into regular and versioned ones is due to -// the presence of horizontal application where head or agruments can't +// the presence of horizontal application where head or arguments can't // contain version hmethodVersioned : hmethodHead methodTail* methodTailVersioned diff --git a/eo-parser/src/main/java/org/eolang/parser/Objects.java b/eo-parser/src/main/java/org/eolang/parser/Objects.java index cc123898b9..50053ca082 100644 --- a/eo-parser/src/main/java/org/eolang/parser/Objects.java +++ b/eo-parser/src/main/java/org/eolang/parser/Objects.java @@ -63,7 +63,7 @@ interface Objects extends Iterable { Objects prop(String key, Object value); /** - * Empty propery. + * Empty property. * @param key Key. * @return Self. */ diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/redundent-parenheses.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/redundant-parenheses.yaml similarity index 100% rename from eo-parser/src/test/resources/org/eolang/parser/typos/redundent-parenheses.yaml rename to eo-parser/src/test/resources/org/eolang/parser/typos/redundant-parenheses.yaml diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/Cages.java b/eo-runtime/src/main/java/EOorg/EOeolang/Cages.java index da4b9ef117..16567cdde4 100644 --- a/eo-runtime/src/main/java/EOorg/EOeolang/Cages.java +++ b/eo-runtime/src/main/java/EOorg/EOeolang/Cages.java @@ -58,7 +58,7 @@ private Cages() { /** * Encage object for the first time. * When object is encaged - locator will be generated. - * @param object Object ot encage + * @param object Object to encage * @return Locator to the object in cage */ int init(final Phi object) { diff --git a/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo b/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo index 5ed5c9bf3e..54c5bf7574 100644 --- a/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo @@ -261,7 +261,7 @@ 53.as-bytes.not # Test. -[] > conjuction-of-bytes +[] > conjunction-of-bytes 02-EF-D4-05-5E-78-3A > a 12-33-C1-B5-5E-71-55 > b eq. > @ @@ -286,7 +286,7 @@ 1 # Test. -[] > convertable-to-bool +[] > convertible-to-bool not. > @ eq. 01-.as-bool diff --git a/eo-runtime/src/test/eo/org/eolang/seq-tests.eo b/eo-runtime/src/test/eo/org/eolang/seq-tests.eo index 8c3488ab17..bbcc3e4147 100644 --- a/eo-runtime/src/test/eo/org/eolang/seq-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/seq-tests.eo @@ -12,7 +12,7 @@ # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EcounterPRESS OR +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOmallocTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOmallocTest.java index 223c1179e0..ff561d58b1 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOmallocTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOmallocTest.java @@ -63,7 +63,7 @@ void freesMemory() { } @Test - void freesMemoryIfErrorIsOccured() { + void freesMemoryIfErrorIsOccurred() { final ErrorDummy dummy = new ErrorDummy(); final Phi phi = EOmallocTest.allocated( new Data.ToPhi(1L),