clang-tidy: Enable bugprone-unchecked-optional-access

Enable bugprone-unchecked-optional-access to detect the case that it
accesses std::optional without checking empty.

See https://gerrit.openbmc.org/c/openbmc/docs/+/78034 for details.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I6f35cc4585e681b7f4030b85295074b1564e8a48
1 file changed
tree: 4fc1aa9fc53537e446318e8b5c2e6e771ef9b972
  1. subprojects/
  2. test/
  3. .clang-format
  4. .clang-tidy
  5. .editorconfig
  6. .gitignore
  7. .prettierrc.yaml
  8. calculate.cpp
  9. calculate.hpp
  10. dbusSensor.cpp
  11. dbusSensor.hpp
  12. dbusUtils.cpp
  13. dbusUtils.hpp
  14. exprtkTools.hpp
  15. LICENSE
  16. main.cpp
  17. meson.build
  18. meson.options
  19. OWNERS
  20. phosphor-virtual-sensor.service.in
  21. README.md
  22. thresholds.hpp
  23. virtual_sensor_config.json
  24. virtualSensor.cpp
  25. virtualSensor.hpp
README.md

phosphor-virtual-sensor

phosphor-virtual-sensor reads the configuration file virtual_sensor_config.json from one of three locations:

  1. The current directory.
  2. /var/lib/phosphor-virtual-sensor
  3. /usr/share/phosphor-virtual-sensor

By default the repository will install a sample config into (3).

There are two types of data in this file.

virtual sensor configuration information

See virtual_sensor_config.json in this repository for an example. Sensors added this way can use any expression that is accepted by exprtk.

information to get a virtual sensor configuration from D-Bus

For example:

{
  "Desc": {
    "Config": "D-Bus"
  }
}

Sensors added this way can only use a set of restricted calculations. Currently supported types are Average, Maximum, Minimum, Sum and ModifiedMedian.

The virtual sensor configuration information needs to be added into the relevant hardware configuration file in entity-manager. This method of adding a virtual sensor allows a recipe that builds for different hardware configurations to have different virtual sensors for each configuration.

The virtual sensor configuration in entity manager follows a different format to the JSON in virtual_sensor_config.json (specified in entity-manager/schemas/VirtualSensor.json).