Skip to content

Commit

Permalink
Update readme about the Black formatting (#5212)
Browse files Browse the repository at this point in the history
Add the Black formatting badge to the readme.
Update the STYLE_GUIDE.md

Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
  • Loading branch information
klecki authored Nov 30, 2023
1 parent 78de01b commit 8ac1812
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
|License| |Documentation|
|License| |Documentation| |Format|

NVIDIA DALI
===========
Expand Down Expand Up @@ -264,3 +264,6 @@ Simon Layton, Andrei Ivanov and Serge Panev.

.. |Documentation| image:: https://img.shields.io/badge/NVIDIA%20DALI-documentation-brightgreen.svg?longCache=true
:target: https://docs.nvidia.com/deeplearning/dali/user-guide/docs/index.html

.. |Format| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
21 changes: 14 additions & 7 deletions STYLE_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# DALI Coding Style Guide

This document describes DALI Coding Style Guide. Rules specified here take precedence
over [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) which should
be followed in the remaining cases.
This document describes DALI Coding Style Guide.

The code should always pass the current `make lint` check.
DALI's C++ code follows [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
with the exceptions detailed below.

DALI's Python code uses [Black](https://github.com/psf/black) for formatting, with the configuration
specified in the `pyproject.toml` file, and is checked with [flake8](https://github.com/PyCQA/flake8)
linter according to the `.flake8` configuration file.

The code should always pass the current `make lint` check, where C++ code and Python formatting
are verified.

## Changes compared to Google C++ Style Guide

Expand All @@ -13,7 +19,8 @@ C++ idioms or language features it is discouraged.

### C++ Version

DALI uses C++14 standard as this is the most recent version supported with CUDA.
DALI uses C++17 standard as this is the most recent version supported with CUDA versions used
in the project.

### Line length

Expand All @@ -27,8 +34,8 @@ and introduces ugly code like `foo(&bar)` or `(*buf)[i]`.

### Test suites naming guide

We use GTest for most of testing code in DALI. Names of TestSuites should start with a capital letter and end with `Test`.
Additionally, both suite and case name mustn't contain underscores (`_`).
We use GTest for most of testing code in DALI. Names of TestSuites should start with a capital letter and end with `Test`.
Additionally, both suite and case name mustn't contain underscores (`_`).
For details on the latter, cf. [GTest FAQ](https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore).
Examples:
```
Expand Down

0 comments on commit 8ac1812

Please sign in to comment.