diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14a4e98..3dc810e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,3 +36,10 @@ jobs: # still accept (and get wrong in the documented way). - name: Caught and uncaught run: pixi run check + + # mojolint must be silent on the post's corrected listing, and must + # flag every case in tests/uncaught/ — the flip side of the step above. + - name: Lint (mojolint --lsp) + run: | + pixi run lint + pixi run lint-uncaught diff --git a/pixi.lock b/pixi.lock index 730d3fb..2fc96ae 100644 --- a/pixi.lock +++ b/pixi.lock @@ -69,6 +69,7 @@ environments: - conda: https://conda.modular.com/max-nightly/linux-64/mojo-compiler-1.0.0-release.conda - conda: https://conda.modular.com/max-nightly/noarch/mblack-26.5.0-release.conda - conda: https://conda.modular.com/max-nightly/noarch/mojo-python-1.0.0-release.conda + - conda_source: lint-mojo[bcfc8d37] @ git+https://github.com/magmalake/lint.mojo?rev=2a12807b7847984aff2c8bf148b0eb7515a99844#2a12807b7847984aff2c8bf148b0eb7515a99844 - conda_source: threads-mojo[1ee782b4] @ git+https://github.com/magmalake/threads.mojo?rev=1133606d6de0f48039e7ba2b427575b39b0d2010#1133606d6de0f48039e7ba2b427575b39b0d2010 osx-arm64: - conda: https://conda.anaconda.org/conda-forge/noarch/_python_abi3_support-1.0-hd8ed1ab_3.conda @@ -116,6 +117,7 @@ environments: - conda: https://conda.modular.com/max-nightly/noarch/mojo-python-1.0.0-release.conda - conda: https://conda.modular.com/max-nightly/osx-arm64/mojo-1.0.0-release.conda - conda: https://conda.modular.com/max-nightly/osx-arm64/mojo-compiler-1.0.0-release.conda + - conda_source: lint-mojo[6339f348] @ git+https://github.com/magmalake/lint.mojo?rev=2a12807b7847984aff2c8bf148b0eb7515a99844#2a12807b7847984aff2c8bf148b0eb7515a99844 - conda_source: threads-mojo[ab5a0344] @ git+https://github.com/magmalake/threads.mojo?rev=1133606d6de0f48039e7ba2b427575b39b0d2010#1133606d6de0f48039e7ba2b427575b39b0d2010 packages: - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda @@ -1100,6 +1102,120 @@ packages: run_exports: {} size: 61221085 timestamp: 1786294690001 +- conda_source: lint-mojo[6339f348] @ git+https://github.com/magmalake/lint.mojo?rev=2a12807b7847984aff2c8bf148b0eb7515a99844#2a12807b7847984aff2c8bf148b0eb7515a99844 + version: 0.1.1 + build: h60d57d3_0 + subdir: osx-arm64 + variants: + target_platform: osx-arm64 + depends: + - mojo >=1.0.0,<2 + build_packages: + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.7.22-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-9_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2026c-h151e31d_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/bzip2-1.0.8-h4e30115_10.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/icu-78.3-py310h579977c_2.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libcxx-23.1.0-h55c6f16_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libexpat-2.8.1-hf6b4638_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libffi-3.7.0-h47dc5ef_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/liblzma-5.8.3-h8088a28_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libmpdec-4.0.0-h84a0fba_2.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libpython-3.14.7-h4311e70_106_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libsqlite-3.53.4-hca69786_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.3.2-h8088a28_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.6-he64c551_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.6.4-h55eecbc_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.14.7-h0ae1c2c_106_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.3-h8b90a29_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/tk-8.6.13-hbeba79b_4.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/zstd-1.5.7-hf451053_7.conda + - conda: https://conda.modular.com/max-nightly/noarch/mojo-python-1.0.0-release.conda + - conda: https://conda.modular.com/max-nightly/osx-arm64/mojo-compiler-1.0.0-release.conda + host_packages: + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.7.22-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-9_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2026c-h151e31d_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/bzip2-1.0.8-h4e30115_10.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/icu-78.3-py310h579977c_2.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libcxx-23.1.0-h55c6f16_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libexpat-2.8.1-hf6b4638_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libffi-3.7.0-h47dc5ef_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/liblzma-5.8.3-h8088a28_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libmpdec-4.0.0-h84a0fba_2.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libpython-3.14.7-h4311e70_106_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libsqlite-3.53.4-hca69786_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.3.2-h8088a28_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.6-he64c551_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.6.4-h55eecbc_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.14.7-h0ae1c2c_106_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.3-h8b90a29_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/tk-8.6.13-hbeba79b_4.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/zstd-1.5.7-hf451053_7.conda + - conda: https://conda.modular.com/max-nightly/noarch/mojo-python-1.0.0-release.conda + - conda: https://conda.modular.com/max-nightly/osx-arm64/mojo-compiler-1.0.0-release.conda +- conda_source: lint-mojo[bcfc8d37] @ git+https://github.com/magmalake/lint.mojo?rev=2a12807b7847984aff2c8bf148b0eb7515a99844#2a12807b7847984aff2c8bf148b0eb7515a99844 + version: 0.1.1 + build: hb0f4dca_0 + subdir: linux-64 + variants: + target_platform: linux-64 + depends: + - mojo >=1.0.0,<2 + build_packages: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_10.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.3-py310h44b86e0_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.46.1-default_hbd61a6d_102.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.8.1-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.7.0-h81df57d_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-16.2.0-ha9f2e26_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-16.2.0-he0feb66_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.3-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libpython-3.14.7-hdc7f604_106_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.53.4-h13e7031_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-16.2.0-h934c35e_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.42.3-hcfc3c73_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.2-h25fd6f3_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.6-hdb14827_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.4-h781a0a9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.7-hcd007b5_106_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-hd6e31c0_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h1df4ec4_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.7.22-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-9_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2026c-h151e31d_0.conda + - conda: https://conda.modular.com/max-nightly/linux-64/mojo-compiler-1.0.0-release.conda + - conda: https://conda.modular.com/max-nightly/noarch/mojo-python-1.0.0-release.conda + host_packages: + - conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-20_gnu.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/bzip2-1.0.8-hda65f42_10.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/icu-78.3-py310h44b86e0_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.46.1-default_hbd61a6d_102.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libexpat-2.8.1-hecca717_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libffi-3.7.0-h81df57d_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgcc-16.2.0-ha9f2e26_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-16.2.0-he0feb66_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.3-hb03c661_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb03c661_2.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libpython-3.14.7-hdc7f604_106_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.53.4-h13e7031_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libstdcxx-16.2.0-h934c35e_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.42.3-hcfc3c73_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.2-h25fd6f3_3.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.6-hdb14827_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/openssl-3.6.4-h781a0a9_0.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/python-3.14.7-hcd007b5_106_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/readline-8.3-hd6e31c0_1.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_h1df4ec4_4.conda + - conda: https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.7-hb78ec9c_7.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2026.7.22-hbd8a1cb_0.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-9_cp314.conda + - conda: https://conda.anaconda.org/conda-forge/noarch/tzdata-2026c-h151e31d_0.conda + - conda: https://conda.modular.com/max-nightly/linux-64/mojo-compiler-1.0.0-release.conda + - conda: https://conda.modular.com/max-nightly/noarch/mojo-python-1.0.0-release.conda - conda_source: threads-mojo[1ee782b4] @ git+https://github.com/magmalake/threads.mojo?rev=1133606d6de0f48039e7ba2b427575b39b0d2010#1133606d6de0f48039e7ba2b427575b39b0d2010 version: 0.3.0 build: hb0f4dca_0 diff --git a/pixi.toml b/pixi.toml index ac8c79e..10f9fe4 100644 --- a/pixi.toml +++ b/pixi.toml @@ -16,9 +16,23 @@ run-post = { cmd = "mkdir -p build && mojo build src/post.mojo -o build/post && # Deliberate misuse: what the compiler rejects, and what it lets through. check = { cmd = "bash tests/check.sh" } fmt = { cmd = "mojo format src tests" } +# mojolint (lint-mojo, below): the origin and threading mistakes the compiler +# lets through, with mojo-lsp-server behind the rules. Exit 1 on findings. +# Only src/origins.mojo — the post's corrected listing — is linted here. +# src/post.mojo and tests/uncaught/*.mojo are deliberate positives (see +# tests/lint_uncaught.sh); tests/caught/*.mojo are deliberately rejected by +# the compiler and never reach mojolint at all. +lint = { cmd = "mojolint --lsp -I src src/origins.mojo" } +# The other half of the claim: mojolint must flag every file in +# tests/uncaught/. See tests/lint_uncaught.sh for what "flag" means here. +lint-uncaught = { cmd = "bash tests/lint_uncaught.sh" } [dependencies] mojo = "==1.0.0" # Added by `pixi shelf add threads-mojo`: the tin comes from GitHub as a pixi # source dependency, pinned at the revision mojoshelf published. threads-mojo = { git = "https://github.com/magmalake/threads.mojo.git", rev = "1133606d6de0f48039e7ba2b427575b39b0d2010" } +# Added by `pixi shelf add lint-mojo`: the linter comes from GitHub as a pixi +# source dependency pinned at the revision mojoshelf published, and builds +# the `mojolint` executable into every environment next to mojo-lsp-server. +lint-mojo = { git = "https://github.com/magmalake/lint.mojo.git", rev = "2a12807b7847984aff2c8bf148b0eb7515a99844" } diff --git a/tests/lint_uncaught.sh b/tests/lint_uncaught.sh new file mode 100755 index 0000000..68bdfb9 --- /dev/null +++ b/tests/lint_uncaught.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# The flip side of tests/check.sh: tests/uncaught/*.mojo are deliberate +# positives for mojolint (lint-mojo) — the origin and threading mistakes the +# compiler lets through, which is the whole point of the post. This asserts +# the linter actually catches all four: `mojolint --lsp -I src tests/uncaught` +# must exit non-zero, and its output must name every file in the directory. +# +# If a file stops being flagged, the linter has regressed on a case the post +# relies on. If mojolint starts exiting 0 here, something is badly wrong. +set -u +cd "$(dirname "$0")/.." +command -v mojolint >/dev/null || { echo "mojolint not on PATH — run as: pixi run lint-uncaught"; exit 2; } + +out=$(mojolint --lsp -I src tests/uncaught 2>&1) +status=$? +fail=0 + +if [ "$status" -eq 0 ]; then + echo "FAIL: mojolint exited 0 on tests/uncaught — expected findings" + fail=1 +fi + +for f in tests/uncaught/*.mojo; do + name=$(basename "$f") + if grep -qF -- "$name" <<<"$out"; then + echo "ok flagged $name" + else + echo "FAIL: no finding reported for $name" + fail=1 + fi +done + +echo "$out" +[ "$fail" = 0 ]