Gyorgy Szing | 05ece0e | 2019-10-08 12:56:59 +0200 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2019, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
| 7 | # Trusted Firmware-A Unit Test Coding style spec for editors. (Modified LCS.) |
| 8 | |
| 9 | # References: |
| 10 | # [EC] http://editorconfig.org/ |
| 11 | # [CONT] contributing.rst |
| 12 | # [LCS] Linux Coding Style |
| 13 | # (https://www.kernel.org/doc/html/v4.10/process/coding-style.html) |
| 14 | |
| 15 | |
| 16 | root = true |
| 17 | |
| 18 | # set default to match [LCS] .c/.h settings. |
| 19 | # This will also apply to .S, .mk, .sh, Makefile, .dts, etc. |
| 20 | [*.{c,h,cpp,hpp}] |
| 21 | # Not specified, but fits current ARM-TF sources. |
| 22 | charset = utf-8 |
| 23 | |
| 24 | # Not specified, but implicit for "LINUX coding style". |
| 25 | end_of_line = lf |
| 26 | |
| 27 | # Override LCS on indentation settings. |
| 28 | indent_size = 2 |
| 29 | indent_style = space |
| 30 | tab_width = 2 |
| 31 | |
| 32 | # Not specified by [LCS], but sensible |
| 33 | insert_final_newline = true |
| 34 | |
| 35 | # [LCS] Chapter 2: Breaking long lines and strings |
| 36 | # "The limit on the length of lines is 80 columns" |
| 37 | # This is a "soft" requirement for Arm-TF, and should not be the sole |
| 38 | # reason for changes. |
| 39 | max_line_length = 80 |
| 40 | |
| 41 | # [LCS] Chapter 1: Indentation |
| 42 | # "Get a decent editor and don't leave whitespace at the end of lines." |
| 43 | # [LCS] Chapter 3.1: Spaces |
| 44 | # "Do not leave trailing whitespace at the ends of lines." |
| 45 | trim_trailing_whitespace = true |
| 46 | |
| 47 | #Makefiles must use tabs, so set indentation accordingly. |
| 48 | [makefile, *.mk] |
| 49 | indent_size = 4 |
| 50 | indent_style = tab |
| 51 | tab_width = 4 |
| 52 | |
| 53 | # Adjustment for existing .rst files with different format |
| 54 | [*.{rst,md}] |
| 55 | indent_size = 4 |
| 56 | indent_style = space |
| 57 | max_line_length = 180 |
| 58 | # 180 only selected to prevent changes to existing text. |
| 59 | tab_width = 4 |
| 60 | |
| 61 | # Python code |
| 62 | [*.py] |
| 63 | charset = utf-8 |
| 64 | indent_style = space |
| 65 | indent_size = 2 |
| 66 | indent_size = 2 |
| 67 | max_line_length = 180 |
| 68 | tab_width = 4 |
| 69 | |
| 70 | #Cmake files |
| 71 | [*.cmake, CMakeLists.txt] |
| 72 | charset = utf-8 |
| 73 | indent_style = space |
| 74 | indent_size = 2 |
| 75 | indent_size = 2 |
| 76 | max_line_length = 180 |
| 77 | tab_width = 4 |