1# 2# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. 3# 4# SPDX-License-Identifier: BSD-3-Clause 5# 6 7 8# References: 9# [LCS] Linux Coding Style 10# (https://www.kernel.org/doc/html/v4.10/process/coding-style.html) 11# [PEP8] Style Guide for Python Code 12# (https://www.python.org/dev/peps/pep-0008) 13 14root = true 15 16################################ 17# Default settings for all files 18[*] 19# Windows .bat files may have trouble with utf8 and will fail with lf line ends. 20# Currently no plans to add .bat files, but this can be an issue in the future. 21charset = uft-8 22end_of_line = lf 23trim_trailing_whitespace = true 24indent_size = 4 25indent_style = tab 26 27################################ 28#C and C++, follow LCS 29[*.{c,h,cpp,hpp}] 30 31# [LCS] Chapter 1: Indentation 32# "Tabs are 8 characters" 33tab_width = 8 34 35# [LCS] Chapter 1: Indentation 36# "and thus indentations are also 8 characters" 37indent_size = 8 38 39# [LCS] Chapter 1: Indentation 40# "Outside of comments,...spaces are never used for indentation" 41indent_style = tab 42 43# [LCS] Chapter 2: Breaking long lines and strings 44# "Statements may be up to 100 columns when appropriate." 45# This is a "soft" requirement for Arm-TF, and should not be the sole 46# reason for changes. 47max_line_length = 100 48 49# [LCS] Chapter 1: Indentation 50# "Get a decent editor and don't leave whitespace at the end of lines." 51# [LCS] Chapter 3.1: Spaces 52# "Do not leave trailing whitespace at the ends of lines." 53trim_trailing_whitespace = true 54 55 56################################ 57#CMake specific settings 58[{CMakeLists.txt,*.cmake}] 59charset = utf-8 60end_of_line = lf 61indent_size = 4 62indent_style = tab 63insert_final_newline = false 64max_line_length = 128 65trim_trailing_whitespace = true 66 67################################ 68#Documentation 69[*.{rst,md}] 70charset = utf-8 71end_of_line = lf 72indent_size = 4 73indent_style = space 74insert_final_newline = false 75max_line_length = 128 76tab_width = 4 77trim_trailing_whitespace = true 78 79################################ 80# Python code 81[*.py] 82# [PEP8] Indentation 83# "Use 4 spaces per indentation level." 84indent_size = 4 85indent_style = space 86# [PEP8] Maximum Line Length 87# "Limit all lines to a maximum of 79 characters." 88max_line_length = 79 89 90################################ 91# Makefiles 92[{Makefile,*.mk}] 93indent_style = tab 94indent_size = 4 95 96################################ 97# json,yaml and xml files 98[{*.json,*.yaml,*.xml}] 99indent_style = space 100indent_size = 4 101tab_width = 4 102trim_trailing_whitespace = true 103