Skip to content

Fix newline between function name and open paren - #1356

Merged
gmaurel merged 1 commit into
uncrustify:masterfrom
brmqk3:fix_newline_function_open_paren
Sep 28, 2017
Merged

gmaurel merged 1 commit into
uncrustify:masterfrom
brmqk3:fix_newline_function_open_paren

Conversation

@brmqk3

@brmqk3 brmqk3 commented Sep 26, 2017

Copy link
Copy Markdown
Contributor

The current test cases don't accurately test what these
options are supposed to do, and the current implementation
doesn't work correctly either. This fixes both the
implementation and test cases so that they correctly format
the newline between the function name and open paren. Also
adds the options that these override, to prove they do in
fact override them.

@brmqk3 brmqk3 changed the title Fix newline between function and open paren Fix newline between function name and open paren Sep 26, 2017
@CDanU

CDanU commented Sep 26, 2017 •

Copy link
Copy Markdown
Collaborator

Good catch. I did not notice this change in the first PR.

Could you change the tests so that both variants are available:

function( 
)

and

function
()

It would also be nice if you could add a comment to the options that are going to be overridden.

The reason for this is that at some point I will continue to clean up the tests so that unnecessary options are going to be removed. See option_reducer.py, that script unfortunately bluntly removes unneeded options, including the ones that are going to be overridden. A comment in there would save up a lot of time while validating the results of this process.

@brmqk3

brmqk3 commented Sep 26, 2017

Copy link
Copy Markdown
Contributor Author

So as input the tests would look like:

function
    (
    )

and

function
    ()

And the ouptuts would respectively look like:

function(
    )

and

function()

That's what we are looking for right?

And should I add those comments in the config files for the tests?

@CDanU

CDanU commented Sep 26, 2017 •

Copy link
Copy Markdown
Collaborator

That's what we are looking for right?

almost, in the first variant the parenthesis should be on the line with function, but I guess having that 3rd variant is not bad either.
I am currently not entirely sure how the output would look like because of the closing parenthesis. Should it actually move with the opening parenthesis?

# Add or remove newline between a function name and the opening '(' in the declaration.
nl_func_paren                   = force    # ignore/add/remove/force

# Overrides nl_func_paren for functions with no parameters.
nl_func_paren_empty             = remove   # ignore/add/remove/force

The option description do not mention this, so I guess it should not.

And should I add those comments in the config files for the tests?

into the config files

@brmqk3

brmqk3 commented Sep 26, 2017

Copy link
Copy Markdown
Contributor Author

Okay for this input:

function(
    )

The output would be unchanged, since our config is to remove the newline between the function name and the open paren.

@CDanU

CDanU commented Sep 26, 2017 •

Copy link
Copy Markdown
Collaborator

In that case these inputs:

function
    (
    )
function(
    )
function
    ()

should create those outputs:

function(
    )
function(
    )
function()

@brmqk3

brmqk3 commented Sep 26, 2017

Copy link
Copy Markdown
Contributor Author

Correct. I will include all those permutations in the tests.

The current test cases don't accurately test what these
options are supposed to do, and the current implementation
doesn't work correctly either. This fixes both the
implementation and test cases so that they correctly format
the newline between the function name and open paren. Also
adds the options that these override, to prove they do in
fact override them.

Change-Id: Ibe2e45d254b558cbe9820769ffa5ed0e5a446532
Type: Bug Fix
@brmqk3
brmqk3 force-pushed the fix_newline_function_open_paren branch from 26bfee4 to f511cb9 Compare September 26, 2017 21:53
@gmaurel
gmaurel merged commit f6088f6 into uncrustify:master Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants