Skip to content

Make indentation uniform; add .editorconfig file #10

@seanm

Description

@seanm

Summary: the codebase does not have a unified style. Most annoyingly, some indentation is 2 spaces, some 3, and some 4. In the same function even.

I used whatstyle to create uncrustify and clang-format config files that hopefully best match the existing style in the niftilib subfolder.

It came up with something for both, but clang-format makes many more changes to the files, so uncrustify seems the better choice, at least for a first pass.

Both tools determined that 3 spaces is the most common indent size. (Though we could consider changing that.)

I then applied uncrustify, manually reviewed its changes, and changed some settings with the goal of reducing the amount of changes. There are so many options in uncrustify, but I've got it (almost) changing only indentation with this:

cmt_indent_multi = false
disable_processing_nl_cont = true
indent_columns = 3
indent_comment = false
indent_ignore_case_brace = true
indent_ignore_first_continue = true
indent_paren_close = 2
indent_switch_case = 3
indent_with_tabs = 0
mod_enum_last_comma = ignore
sp_after_type = add
sp_skip_vbrace_tokens = true
use_indent_func_call_param = false
sp_before_semi = ignore
indent_comma_brace = -1
indent_comma_paren = -1
sp_before_comma = ignore
sp_after_comma = ignore
sp_paren_comma = ignore
sp_not = ignore

I'll create a draft PR soon...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions