Comments (6)
Have checked the configuration and both SA1300 and SX1309 are set to error.
However no error is shown for:
private const string _testing = "";
Only shown for
private const string _testing = "";
private string testing = "";
from stylecopanalyzers.
What about turning on SA1300 and SX1309?
from stylecopanalyzers.
This would not work because what we are trying to achieve is:
Private const use PascalCase starting with capital.
But we still want non const privates to start with a _
Turning on SX1309 would mean all fields need to start with _.
from stylecopanalyzers.
The code for SX1309 seems to suggest otherwise:
from stylecopanalyzers.
Have checked the configuration and both SA1300 and SX1309 are set to error.
However no error is shown for:
private const string _testing = "";
Only shown for
private const string _testing = ""; private string testing = "";
This is not the intended result, as outlined we want to enforce private const to start with Cap and not _.
And private to start with a _
from stylecopanalyzers.
What about using IDE1006 along with this in your .editorconfig
:
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = warning
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
dotnet_naming_symbols.private_constant_fields.required_modifiers = const
dotnet_naming_style.pascalcase.required_prefix =
dotnet_naming_style.pascalcase.required_suffix =
dotnet_naming_style.pascalcase.word_separator =
dotnet_naming_style.pascalcase.capitalization = pascal_case
That seems to do what you want
(I'm using this .editorconfig file, which was made by one of my colleages)
from stylecopanalyzers.
Related Issues (20)
- Please issue a new stable release HOT 1
- warning AD0001: Analyzer 'StyleCop.Analyzers.OrderingRules.SA1201ElementsMustAppearInTheCorrectOrder' threw an exception of type 'System.Collections.Generic.KeyNotFoundException' with message 'The given key was not present in the dictionary.'. HOT 1
- SAAllow primary constructor parameters to start with underscore.
- SA1313 Allow primary constructor parameters to start with underscore. HOT 1
- Inquiry about Adding Chinese Language Support to StyleCop.Analyzers
- SA1010 interferes with IDE0055 when = is followed by an array initialization HOT 4
- Make SA1201 configurable HOT 2
- Flags enums should be sorted HOT 1
- SA1013 fires for escaped closing brace in a multi-line interpolated verbatim string HOT 1
- conflict SA1024 and SA1009 HOT 1
- stylecop.analyzers is missing NuGet package README file
- `SA1629` code fix eats ending semicolon of XML entity
- `SA1402` Should not apply to file-scoped types HOT 1
- Missing period SA1629 should not trigger inside <example> tags. HOT 2
- `SA1629` should ignore `<example>` since a trailing period is often not valid input. HOT 2
- Rules contradicting C# naming conventions HOT 3
- SA1629 demands period for Value text HOT 2
- SA1202 fires for dependent members HOT 3
- SA1217 reporting incorrect order if System.* is placed alphabetically HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stylecopanalyzers.