Explorer

core.check-event-module-names

description
Rejects empty or duplicated module names in a project commit and module names that belong to other projects (others), from index, and checks the part names of each module. seen is the names before index. See docs/project.md
type
Fn(
  modules: List<@core.project-commit-module>,
  others: List<String>,
  seen: List<String>,
  index: Number
) -> List<@core.event-rejection>
expression
fn(modules$0, others$1, seen$2, index$3) =>
  match @core.list-get(list: $0, index: $3) {
    #none(_) =>
      [],
    #some(item$1006) =>
      let module$4 = $1006;
      let name$5 = $4.name;
      @core.list-concat(
        left: match @core.equal(left: @core.string-length(value: $5), right: 0) {
          true =>
            [#empty_module_name<@core.event-rejection>],
          false =>
            @core.list-concat(
              left: match @core.list-contains-string(list: $2, target: $5, index: 0) {
                true =>
                  [#duplicate_module_name<@core.event-rejection>($5)],
                false =>
                  []
              },
              right: match @core.list-contains-string(list: $1, target: $5, index: 0) {
                true =>
                  [#module_in_other_project<@core.event-rejection>($5)],
                false =>
                  []
              }
            )
        },
        right: @core.list-concat(
          left: @core.check-event-part-names(parts: $4.parts, seen: [], index: 0),
          right: @core.check-event-module-names(
            modules: $0,
            others: $1,
            seen: @core.list-append(list: $2, item: $5),
            index: @core.plus(left: $3, right: 1)
          )
        )
      )
  }
visibility
public
core.check-event-module-names (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: qdDhMmJJ1w5UgbNx7tkORv7sN_N5RY9rWIMvwzDcatg
content hash: vsQqTBIWk4gU-WCzzdS4qf9VXdcyTcj3iRPCsVJg_a0