Sensor.execute, SensorContect and module()


since 7.6 modules are deprecated MMF-365.

What I understood:

  • Multi-Module analysis is no more supported
  • in case project consists of one module it still works
  • module, folder issues are no more supported: only file and project level are supported now
  • report path are relative to project base now (no more relative to module)

My questions are:

  • In the past Sensor.execute was called several times for each module. Seems that Sensor.execute is called only once per project now?
    • This means SensoContext.modue() can be replaced by SensoContect.project()?
  • Global sensors can handle measures on project root level only?
  • Are file measures automatically aggregated on project level?

Thanks and regards,

Hi Günter,

The situation is a bit complex. Modules have been totally removed on server side. It means there are no more:

  • module level measures
  • module level issues
  • module level (server side) settings

On scanner side, the situation is a bit different. If you are using the scanners for Maven or Gradle, there will still be a “per module” sensor execution. This is mainly for backward compatibility, and also to access some module levels settings (like classpath for Java modules).

If you don’t absolutely need those module level settings, I suggest you only use project level sensors.

For backward compatibility, Sensor are still executed once per module, except if you declare then as global. You should use the new ProjectSensor extension point instead.

For a “global” Sensor or a ProjectSensor, module() and project() will point to the same thing (project = root module).

Yes, and also on all project files.

Depends. Some built-in measures are automatically aggregated. If you create a new custom measure, you have to handle the aggregation (likely using a MeasureComputer).
Note that this is unrelated to the drop of modules.

Hi Julien,

Many thanks for your detailed answer.