CodingStyle-WhitesmithBraces¶
Use Whitesmith bracing style
Required inputs: IR
- Opening braces should be on a separate line with a specific column offset to the parent statement/expression.
- Closing braces should be on the same column as opening brace.
- Children should be on the same column as the braces.
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
all_children_misindented |
Use {} bracing style. All statements in this sequence should be corrected to start in column {}. |
None |
False |
child_should_be_indented |
Use {} bracing style. {} should be indented to start in column {}. |
None |
False |
child_should_be_outdented |
Use {} bracing style. {} should be outdented to start in column {}. |
None |
False |
close_wrong_column |
Use {} bracing style. Closing brace not in same column as opening one (should be in column {}, but is in column {}). |
None |
False |
open_wrong_column |
Use {} bracing style. Opening brace for body of {} in wrong column (should be in column {}, but is in column {}). |
None |
False |
open_wrong_line |
Use {} bracing style. Opening brace for body of {} in wrong line (should be in line {}). |
None |
False |
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
allow_single_line_empty_seq¶
allow_single_line_empty_seq : bool = False
allow_single_line_lambda_seq¶
allow_single_line_lambda_seq : bool = False
allow_single_line_seq¶
allow_single_line_seq : bool = False
always_relative_to_enclosing_braces¶
always_relative_to_enclosing_braces : bool = False
control_structure_indentation_mapping¶
control_structure_indentation_mapping
Dictionary mapping PIR class names to expected number of column offset for their braces. This varies between control structures. Statements inside this structure must start at the same column as the braces.Type: dict[bauhaus.ir.PIR_Class_Name, int | None]
Default:
{ 'C_For_Loop': 4, 'Do_While_Loop': 2, 'If_Statement': 3, 'Routine_Definition': 0, 'Switch_Case_Label': 5, 'Switch_Statement': 7, 'While_Loop': 6 }
empty_macro_invocations¶
empty_macro_invocations : set[str] | None = None
"" can be
considered as taking up a location. This is intended to support
constructs like Qt's emit signal_func() where emit expands
to "".
In this case, the column of emit should start the line of source code.
By default (value None): empty macro invocations will be supported as taking
up a location. If configured as set of strings, only the macros whose
name is in the set will be considered, other macros which expand to ""
will be ignored. If the set is empty, macros which expand to "" will
always be ignored.
expected_indent¶
expected_indent
Dictionary mapping PIR class names to expected number of indent columns for statements of this type. A missing value for a statement type means that these nodes are not checked at all, and a number string means that the node types have to be in exactly this column (not relative to surrounding sequence). Relative indents can be negative as well (clipped at 1).Type: dict[bauhaus.ir.PIR_Class_Name, list[int | str] | None]
Default:
{ 'Named_Label': ['1'], 'Statement': [0] }
Statement as key is used for
the default value. If the value is a list of the above, then the
element is accepted if any of the indents matches.
Preprocessor directives (Line_Directive, Macro_Definition,
Include_Declaration, Undef_Directive,
Conditional_Compilation_Interface, Pragma_Directive)
are expected to start in column 1 without being part of the map. The exact column
can be changed by adding an entry into the map. Explicitly using an empty list as
entry for a directive will disable corresponding violations.
ignore_braces_inside_lambdas¶
ignore_braces_inside_lambdas : bool = False