Skip to content

Fix violations for one line switch conditionals #709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2017

Conversation

kapilmb
Copy link

@kapilmb kapilmb commented Feb 9, 2017

Consider the following expression:

switch ($x) {
{"a" -eq $_} {"a";break}
{"b" -eq $_} {"b";break}
}

If OnSameLine switch is on, this would get formatted to:

switch ($x) { {"a" -eq $_} {"a";break} {"b" -eq $_} {"b";break}
}

With this commit, it ignores these one-line conditional expression and so the output will be the same as the input in this case, i.e.,

switch ($x) {
{"a" -eq $_} {"a";break}
{"b" -eq $_} {"b";break}
}

Consider the following expression:
switch ($x) {
{"a" -eq $_} {"a";break}
{"b" -eq $_} {"b";break}
}

If OnSameLine switch is `on`, this would get formatted to:
switch ($x) { {"a" -eq $_} {"a";break} {"b" -eq $_} {"b";break}
}

With this commit, it ignores these one-line conditional expression and so the output will be the same as the input in this case, i.e.,
switch ($x) {
{"a" -eq $_} {"a";break}
{"b" -eq $_} {"b";break}
}
@kapilmb
Copy link
Author

kapilmb commented Feb 10, 2017

@daviwil Thanks!

@kapilmb kapilmb merged commit 853c3d8 into development Feb 10, 2017
@kapilmb kapilmb deleted the kapilmb/fix-open-brace-rule branch February 16, 2017 00:45
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