Skip to content

Commit

Permalink
fix(tools/kconfig): Moved check_konfigs.py to esp-idf-kconfig package
Browse files Browse the repository at this point in the history
Closes #10872
  • Loading branch information
jakub-kocka committed Oct 6, 2023
1 parent f71b2cb commit 22dcc26
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 686 deletions.
15 changes: 0 additions & 15 deletions .gitlab/ci/pre_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,6 @@ check_api_usage:
- tools/ci/check_api_violation.sh
- tools/ci/check_examples_extra_component_dirs.sh

test_check_kconfigs:
extends: .pre_check_template
artifacts:
when: on_failure
paths:
- components/*/Kconfig*.new
- examples/*/*/*/Kconfig*.new
- examples/*/*/*/*/Kconfig*.new
- tools/*/Kconfig*.new
- tools/*/*/Kconfig*.new
- tools/*/*/*/Kconfig*.new
expire_in: 1 week
script:
- python ${IDF_PATH}/tools/ci/test_check_kconfigs.py

check_blobs:
extends:
- .pre_check_template
Expand Down
1 change: 0 additions & 1 deletion .gitlab/ci/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@
- "components/**/*"

- "tools/ci/test_autocomplete.py"
- "tools/ci/test_check_kconfigs.py"

- "tools/mass_mfg/**/*"

Expand Down
6 changes: 5 additions & 1 deletion docs/en/api-reference/kconfig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ Format rules for Kconfig files are as follows:
Format Checker
--------------

``tools/ci/check_kconfigs.py`` is provided for checking Kconfig files against the above format rules. The checker checks all Kconfig and ``Kconfig.projbuild`` files in the ESP-IDF directory, and generates a new file with suffix ``.new`` with some suggestions about how to fix issues (if there are any). Please note that the checker cannot correct all format issues and the responsibility of the developer is to final check and make corrections in order to pass the tests. For example, indentations will be corrected if there is not any misleading formatting, but it cannot come up with a common prefix for options inside a menu.
``kconfcheck`` tool in esp-idf-kconfig_ package is provided for checking Kconfig files against the above format rules. The checker checks all Kconfig and ``Kconfig.projbuild`` files given as arguments, and generates a new file with suffix ``.new`` with some suggestions about how to fix issues (if there are any). Please note that the checker cannot correct all format issues and the responsibility of the developer is to final check and make corrections in order to pass the tests. For example, indentations will be corrected if there is not any misleading formatting, but it cannot come up with a common prefix for options inside a menu.


The ``esp-idf-kconfig`` package is available in ESP-IDF environments, where the checker tool can be invoked by running command: ``python -m kconfcheck <path_to_kconfig_file>``
For more information, see `esp-idf-kconfig package documentation <https://github.com/espressif/esp-idf-kconfig/blob/master/docs/DOCUMENTATION.md>`_

.. _configuration-options-compatibility:

Expand Down
5 changes: 2 additions & 3 deletions tools/ci/check_deprecated_kconfigs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0

from __future__ import print_function, unicode_literals
Expand All @@ -11,7 +11,6 @@
from io import open
from typing import Set, Tuple

from check_kconfigs import valid_directory
from idf_ci_utils import get_submodule_dirs

# FILES_TO_CHECK used as "startswith" pattern to match sdkconfig.defaults variants
Expand All @@ -34,7 +33,7 @@ def _parse_path(path: 'os.PathLike[str]', sep: str=None) -> Set:
return ret


def _valid_directory(path: 'os.PathLike[str]') -> 'os.PathLike[str]':
def valid_directory(path: str) -> str:
if not os.path.isdir(path):
raise argparse.ArgumentTypeError('{} is not a valid directory!'.format(path))
return path
Expand Down
Loading

0 comments on commit 22dcc26

Please sign in to comment.