Skip to content

Lint CONV011 (NoCommitInLoop) misses CHANGE … COMMIT (and CREATE … COMMIT) inside a loop; only a separate COMMIT activity is flagged #1217

Description

@MohamedElNady

Environment

  • mxcli: v0.24.0 (2026-09-24T05:44:35Z), Windows (Git Bash)
  • Mendix: 11.14.0, blank project from mx create-project (MPR v2)

Summary

CONV011 flags a standalone COMMIT $Obj inside a loop. It does not flag a change-object activity with Commit = Yes (change $T (…) commit;) in the same loop, although it is the same N+1 pattern: one database round-trip per iteration. Studio Pro's Best Practice Recommender flags it (MXP004). On a real project, lint reported 0 CONV011 findings while the Recommender listed this pattern.

Reproduction

create module "ModP";
create persistent entity "ModP"."Task" ("Done": Boolean default false);
create microflow "ModP"."SUB_CloseAll" ()     -- change with commit in a loop
begin
  retrieve $Tasks from "ModP"."Task";
  loop $T in $Tasks
  begin
    change $T ("Done" = true) commit;
  end loop;
end;
/
create microflow "ModP"."SUB_CloseAll2" ()    -- separate commit in a loop
begin
  retrieve $Tasks from "ModP"."Task";
  loop $T in $Tasks
  begin
    change $T ("Done" = true);
    commit $T;
  end loop;
end;
/
$ mxcli lint -p Repro.mpr
  ⚠ Microflow 'ModP.SUB_CloseAll2' has a Commit action inside a loop. This causes N+1 database operations. [CONV011]

SUB_CloseAll is not reported.

Expected

CONV011 also fires when a CreateObjectAction / ChangeObjectAction with Commit = Yes sits inside a loop, directly or through a nested loop or branch.

Actual

Only the standalone commit action is detected.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions