Use settings keys, not error codes, for ERC/DRC reports

Error codes can shift around if the enum ordering is
not maintained, which is more fragile than the settings
key which should never be changed after a new code is
created.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6001
This commit is contained in:
Jon Evans 2020-10-13 18:03:07 -04:00
parent cb075d06c2
commit cb1d416e5a
3 changed files with 10 additions and 6 deletions

View File

@ -87,8 +87,8 @@ wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
if( mainItem && auxItem )
{
return wxString::Format( wxT( "ErrType(%d): %s %s\n %s: %s\n %s: %s\n" ),
GetErrorCode(),
return wxString::Format( wxT( "[%s]: %s %s\n %s: %s\n %s: %s\n" ),
GetSettingsKey(),
GetErrorMessage(),
severity,
ShowCoord( aUnits, mainItem->GetPosition() ),
@ -98,8 +98,8 @@ wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
}
else if( mainItem )
{
return wxString::Format( wxT( "ErrType(%d): %s %s\n %s: %s\n" ),
GetErrorCode(),
return wxString::Format( wxT( "[%s]: %s %s\n %s: %s\n" ),
GetSettingsKey(),
GetErrorMessage(),
severity,
ShowCoord( aUnits, mainItem->GetPosition() ),
@ -107,8 +107,8 @@ wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
}
else
{
return wxString::Format( wxT( "ErrType(%d): %s %s\n" ),
GetErrorCode(),
return wxString::Format( wxT( "[%s]: %s %s\n" ),
GetSettingsKey(),
GetErrorMessage(),
severity );
}

View File

@ -36,6 +36,8 @@
#undef _
#define _(s) s
// NOTE: Avoid changing the settings key for an ERC item after it has been created
ERC_ITEM ERC_ITEM::duplicateSheetName( ERCE_DUPLICATE_SHEET_NAME,
_( "Duplicate sheet names within a given sheet" ),
wxT( "duplicate_sheet_names" ) );

View File

@ -36,6 +36,8 @@
#undef _
#define _(s) s
// NOTE: Avoid changing the settings key for a DRC item after it has been created
DRC_ITEM DRC_ITEM::unconnectedItems( DRCE_UNCONNECTED_ITEMS,
_( "Unconnected items" ),
wxT( "unconnected_items" ) );