Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Documentation/components/tools/checkpatch.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _checkpatch.sh:

=================
``checkpatch.sh``
=================
Expand Down
19 changes: 10 additions & 9 deletions Documentation/contributing/coding_style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,29 @@ C Coding Standard
NuttX follows a specific coding style which needs to be followed at all times
a contribution to be accepted. Please read this document before working on
new code so that you can follow the style from the start. To check your code
for conformance to the coding style, you should use the checkpatch.sh script
(that calls the `nxstyle <#nxstyle>`_ tool) included under ``tools/`` in the
main NuttX repository, or enable the pre-commit functionality described in
`pre-commit <#precommit>`__.
for conformance to the coding style, you should use the :ref:`checkpatch.sh`
script (that calls the `nxstyle <#nxstyle>`_ tool) included under ``tools/``
in the main NuttX repository, or enable the pre-commit functionality
described in `pre-commit <#precommit>`__.

**************************
Quick Check for Compliance
**************************

You should check for coding style issues before submitting your Pull Request.
There is a script that you can run to check for coding styles issue:
Please verify formatting of your git commits before a Pull Request is
submitted/updated. Use :ref:`checkpatch.sh` script that will verify the coding
style, encoding, and spelling issues:

.. code-block:: bash

./tools/checkpatch.sh -g HEAD~...HEAD
./tools/checkpatch.sh -c -u -m -g HEAD~...HEAD

Alternatevily you can run this script passing the .c file or .h header you
want to check:
want to check using ``-f`` switch:

.. code-block:: bash

./tools/checkpatch.sh -f path/to/your/file.c
./tools/checkpatch.sh -c -u -m -f path/to/your/file.c

*******************
General Conventions
Expand Down