added the rules:
1) if properties of type have same normalized names -> DAP046 is reported:
Properties have same name '{normalizedMemberName}' after normalization and can be conflated
example:
public class Data
{
public string First_Name { get; set; }
public string FirstName { get; set; }
}
2) if fields of type have same normalized names -> DAP047 is reported:
Fields have same name '{normalizedMemberName}' after normalization and can be conflated
public class Data
{
public string first_name;
public string _firstName;
}
Note: I changed the locations calculations reported for properties.
For ElementMember representing public string Name { get; set; } property, calling member.GetLocation() will return Span, wrapping the whole property definition (including modifiers, getter and setter).
I thought that standard way of reporting errors is to link the diagnostic with the member name. For example (not related to Dapper) - duplicate property names of type:
So I decided to bring such a consistency to the diagnostics. Also fields are reported only on the names (not the full field definition). Let me know if that change should be reverted
Original issue: https://github.com/DapperLib/Dapper/issues/1993
added the rules: 1) if properties of type have same normalized names ->
DAP046
is reported:Properties have same name '{normalizedMemberName}' after normalization and can be conflated
example:2) if fields of type have same normalized names ->
DAP047
is reported:Fields have same name '{normalizedMemberName}' after normalization and can be conflated
Note: I changed the locations calculations reported for properties. For
ElementMember
representingpublic string Name { get; set; }
property, callingmember.GetLocation()
will returnSpan
, wrapping the whole property definition (including modifiers, getter and setter).I thought that standard way of reporting errors is to link the diagnostic with the member name. For example (not related to Dapper) - duplicate property names of type:
So I decided to bring such a consistency to the diagnostics. Also fields are reported only on the names (not the full field definition). Let me know if that change should be reverted
Closes #65