weboob_lint.py 1.08 KB
Newer Older
1
#!/usr/bin/env python3
2
from __future__ import print_function
3

4 5 6 7 8 9
import logging
import os
import sys

from weboob.core import Weboob

10 11 12
# Hint: use this script with file:///path/to/local/modules/ in sources.list
# if you want to correctly check all modules.

13 14

logging.basicConfig()
15

16 17
weboob = Weboob()
weboob.modules_loader.load_all()
18

19 20
modules_without_tests = []
modules_without_icons = []
21

22

23 24
for name, module in weboob.modules_loader.loaded.items():
    path = module.package.__path__[0]
25
    if not os.path.exists(os.path.join(path, 'test.py')):
26
        modules_without_tests.append(name)
27 28
    if not os.path.exists(os.path.join(path, 'favicon.png')) and \
       not os.path.exists(os.path.join(weboob.repositories.icons_dir, '%s.png' % name)) and \
29 30
       not module.icon:
        modules_without_icons.append(name)
31

32

33 34 35 36
if modules_without_tests:
    print('\nModules without tests: %s' % ', '.join(sorted(modules_without_tests)))
if modules_without_icons:
    print('\nModules without icons: %s' % ', '.join(sorted(modules_without_icons)))
37

38

39
if modules_without_tests or modules_without_icons:
40
    sys.exit(1)