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.

Proposal: SA1407 configurability

See original GitHub issue

Would it be possible to configure ‘aggressivity’ of SA1407 some how? It’s nice rule, but we’re not using it now because of its excessive agressivity.

Some examples where the precedence is obvious and required bracket makes only cluter:

a * b + c
a * b + c * d
a + b / c

versus

(a * b) + c
(a * b) + (c * d)
a + (b / c)

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sharwellcommented, May 23, 2016

It looks like this is a wontfix based on the current responses.

1reaction
GregReddickcommented, Apr 27, 2016

👎 I think the point of the rule is that a programmer doesn’t need to count on the order of precedence of operators in C#. When I did C programming, I kept a little chart on the precedence of the various operators taped to my monitor so I could figure out what was actually happening with some of the more complex C statements written by other people. With this rule in place, there is no need for a chart like that. Remember that unsafe code is almost C.

Of course, if a statement only has * and + in it, most people know the order, but I think it still makes the code more clear. I also makes it really clear what the programmer who wrote the code intended.

Read more comments on GitHub >

github_iconTop Results From Across the Web

StyleCopAnalyzers/documentation/SA1407.md at master
An implementation of StyleCop rules using the .NET Compiler Platform - StyleCopAnalyzers/documentation/SA1407.md at master · DotNetAnalyzers/StyleCopAnalyzers.
Read more >
Use StyleCop to maintain coding standards · Issue #1035
If you just plug StyleCop into the build, with no configuration at all, ... 18 - SA1407: Arithmetic expressions should declare precedence ...
Read more >
Style and Consistency Rules with StyleCop
Learn how to enforce style and consistency rules to your automated tests' code. I will show you how to configure and use StyleCop...
Read more >
Auto Fix StyleCop Warnings with Free Extensions - Mike Conrad
SA0001, XML comment analysis is disabled due to project configuration. SA1001, Commas should be followed by whitespace. Some, Some.
Read more >
.NET Programming Standards & Reference Guide Version ...
To increase long-term maintainability of the code-base, each file should contain at most one namespace. SA1407: Arithmetic Expressions Must Declare Precedence.
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