question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule SA1009 should deal with closing parenthesis as the end of a value tuple

See original GitHub issue

The Rule SA1009 is defined as: "A closing parenthesis should never be preceded by whitespace. In most cases, a closing parenthesis should be followed by a single space, unless the closing parenthesis comes at the end of a cast, or the closing parenthesis is followed by certain types of operator symbols, such as positive signs, negative signs, and colons.

If the closing parenthesis is followed by whitespace, the next non-whitespace character should not be an opening or closing parenthesis or square bracket, or a semicolon or comma."

In some cases the closing parenthesis can be used to define a value tuple. If, for example, a list of value tuples is defined, the syntax can be like

IEnumerable<(string a, int b)> tupleList;.

I suggest to add the “greater-than-sign” as an additional exception for the rule SA1009 to allow these code structures.

Maybe code changes concerning this issue can be combined with a solution for the issue Rule SA1008 should add => for expression based properties/functions as exception by handling value tuples generally.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
msmolkacommented, Sep 1, 2017

I’m using .NET 4.6.2 and 1.1.0-beta4 and still seeing this error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto Fix StyleCop Warnings with Free Extensions - Mike Conrad
Warning Detail Code Formatter Code Maid SA1001 Commas should be followed by whitespace. Some Some SA1002 Semicolons should not be preceded by a space. Some...
Read more >
Why are tuples enclosed in parentheses? - python
The parentheses are just parentheses - they work by changing precedence. The only exception is if nothing is enclosed (ie () ) in...
Read more >
Tuple types - C# reference
Tuple types are value types; tuple elements are public fields. That makes tuples mutable value types. You can define tuples with an arbitrary ......
Read more >
Tuple Objects
For an empty (zero-element) tuple, a pair of empty parentheseis (()) can be used. But surrounding the value with parentheses is not enough...
Read more >
https://raw.githubusercontent.com/dotnet/runtime/8...
Uri return values should not be strings --> <Rule Id="CA1056" Action="None" /> <! ... Closing parenthesis should not be followed by a space...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found