GispoCoding / flake8-qgis

Flake8 plugin for QGIS python plugins
MIT License
6 stars 4 forks source link

Check UI files with custom widgets #3

Open Gustry opened 2 years ago

Gustry commented 2 years ago

It can be nice to check how custom widgets in UI file are imported.

The UI file must contain a block like :

  <customwidget>
   <class>QgsMapLayerComboBox</class>
   <extends>QComboBox</extends>
   <header>qgis.gui</header>
  </customwidget>

It's wrong if the extends contains .h.

CF https://github.com/3liz/lizmap-plugin/blob/master/lizmap/test/test_code_layout.py#L26..L37

Joonalai commented 2 years ago

Than you for the great idea! We will try to implement this soon.

Joonalai commented 2 years ago

Unfortunately, since ui files are not python files, flake8 is not a right tool to lint them. Maybe there should be another tool that can be used as a pre-commit hook to enable this?