Commit Graph
7 Commits
Author SHA1 Message Date
Cooldude2606 1e861c5c0b Fix issue with MapPosition.energy 2026-08-08 21:58:46 +01:00
bbassieandClaude Opus 5 d495a345d6 Resolve clusterio through CLUSTERIO rather than in ci only
The library path was injected by the workflow, so an editor opened on
this repo could not resolve `modules/clusterio/*`. It now comes from
the environment in both places.

It cannot be written relative to this repo: emmylua does not normalise
`..` in a library path, and an absolute path containing `..` fails the
same way, so the location has to come from outside.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 16:04:16 +00:00
bbassieandClaude Opus 5 f907007d14 Fix arity and return value mismatches
`assert` returns every argument it is given, so `return assert(x, msg)`
was leaking the message as a second return value.

`get_tile` is documented as taking x and y. The async function class
declared `@operator call` with no parameters, which made every async
call look over supplied.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:48 +00:00
bbassieandClaude Opus 5 2fece14a45 Enable the diagnostics which already pass
These were carried over as disabled from the luals config but report
nothing, so they only ever masked a future regression.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:48 +00:00
bbassieandClaude Opus 5 3f46055b70 Enable need-check-nil and start the burn down
`Roles.new_role` returned the result of `error`, which made it nullable,
and `set_permission_group` returned nil for an unknown group, which
broke the config chain with an index error rather than saying so.

Positions and bounding boxes read back from the game always use the
named members, so they are narrowed once where they enter a function.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:43 +00:00
bbassieandClaude Opus 5 c233a9ab06 Defer need-check-nil and clean up stale suppressions
emmylua deserialises an unknown diagnostic code to a catch all that
matches no checker, so every `invisible`, `nil-check` and
`global-element` suppression was silently doing nothing. Renamed to the
emmylua codes. `name-style-check` has no equivalent and is dropped, it
was already disabled under luals.

The `get_tile` suppressions referenced an api typedef bug from 2024
which no longer reproduces.

need-check-nil is deferred rather than disabled on merit: a third of the
407 findings come from MapPosition and BoundingBox being aliased as
`struct|[double, double]`, so every `entity.position.x` reads as
possibly nil. The rest need per site knowledge of runtime invariants.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00
bbassieandClaude Opus 5 c6da1fd9ac Replace the luals lint config with emmylua
fmtk 2.1.4 onwards generates typedefs targeting emmylua that luals
misreads, and every fmtk changelog since 2.1.5 states luals support is
being dropped. luals 3.18.2 is already the latest release, so there is
nothing to bump.

The `--clusterio-modules` plugin has no emmylua equivalent, as emmylua
has no plugin interface, so it is reimplemented as `workspace.moduleMap`.
Those rules rewrite each file's own module path rather than the require
string, hence the reversed direction.

type.patch.lua is obsolete: `raise_event` now takes `LuaEventType` in
the generated typedefs, and `LuaObject` has become `LuaObject.base`.
exp_scenario/.luacheckrc was already dead, luacheck is never invoked.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 15:31:18 +00:00