check-style: Fix documentation and add usage example for modified files

This commit is contained in:
Eduardo Almeida
2023-10-03 15:27:43 +01:00
parent 7ea7504476
commit 738729e0ab
2 changed files with 9 additions and 6 deletions

View File

@@ -114,8 +114,8 @@ check-style-clang-format.py
To facilitate checking and fixing source code files according to the |ns3| coding style,
|ns3| maintains the ``check-style-clang-format.py`` Python script (located in ``utils/``).
This script is a wrapper to clang-format and provides useful options to check and fix
source code files. Additionally, it checks and fixes trailing whitespace and tabs in text
files.
source code files. Additionally, it performs other manual checks and fixes in text files
(described below).
We recommend running this script over your newly introduced C++ files prior to submission
as a Merge Request.
@@ -160,6 +160,9 @@ For quick-reference, the most used commands are listed below:
# Specific directory or file
/path/to/utils/check-style-clang-format.py --fix absolute_or_relative/path/to/directory_or_file
# Modified files
git diff --name-only | xargs ./utils/check-style-clang-format.py --fix
Clang-tidy
**********

View File

@@ -18,7 +18,7 @@
# Author: Eduardo Nuno Almeida <enmsa@outlook.pt> [INESC TEC and FEUP, Portugal]
"""
Check and apply the ns-3 coding style to all files in the PATH argument.
Check and apply the ns-3 coding style recursively to all files in the PATH arguments.
The coding style is defined with the clang-format tool, whose definitions are in
the ".clang-format" file. This script performs the following checks / fixes:
@@ -30,8 +30,8 @@ the ".clang-format" file. This script performs the following checks / fixes:
This script can be applied to all text files in a given path or to individual files.
NOTE: The formatting check requires clang-format (version >= 14) to be found on the path.
Trimming of trailing whitespace and conversion of tabs to spaces (via the "--no-formatting"
option) do not depend on clang-format.
The remaining checks do not depend on clang-format and can be executed by disabling clang-format
checking with the "--no-formatting" option.
"""
import argparse
@@ -680,7 +680,7 @@ def check_tabs_file(filename: str,
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Check and apply the ns-3 coding style to all files in a given PATH. '
description='Check and apply the ns-3 coding style recursively to all files in the given PATHs. '
'The script checks the formatting of the file with clang-format. '
'Additionally, it checks #include headers from the same module with the "ns3/" prefix, '
'the presence of trailing whitespace and tabs. '