diff --git a/tools/idf.py b/tools/idf.py index 3e3986ac5e..74704466e7 100755 --- a/tools/idf.py +++ b/tools/idf.py @@ -687,6 +687,14 @@ def init_cli(verbose_output=None): except ImportError: pass + # Optional load `pyclang` for additional clang-tidy related functionalities + try: + from pyclang import idf_extension + + extensions.append(('idf_clang_tidy_ext', idf_extension)) + except ImportError: + pass + for name, extension in extensions: try: all_actions = merge_action_lists(all_actions, extension.action_extensions(all_actions, project_dir)) diff --git a/tools/idf_py_actions/core_ext.py b/tools/idf_py_actions/core_ext.py index 53130cbd6d..b67c2e82c4 100644 --- a/tools/idf_py_actions/core_ext.py +++ b/tools/idf_py_actions/core_ext.py @@ -69,6 +69,10 @@ def action_extensions(base_actions, project_path): subprocess.check_output(GENERATORS[args.generator]['dry_run'] + [target_name], cwd=args.build_dir) except Exception: + if target_name in ['clang-check', 'clang-html-report']: + raise FatalError('command "{}" requires an additional plugin "pyclang". ' + 'Please install it via "pip install --upgrade pyclang"'.format(target_name)) + raise FatalError( 'command "%s" is not known to idf.py and is not a %s target' % (target_name, args.generator))