Formatting.

This commit is contained in:
Jeff Young 2025-07-30 17:56:45 +01:00
parent 0b90d941d3
commit 15468c86b9

View File

@ -1291,36 +1291,37 @@ int ERC_TESTER::TestSimilarLabels()
int errors = 0; int errors = 0;
std::unordered_map<wxString, std::vector<std::tuple<wxString, SCH_ITEM*, SCH_SHEET_PATH>>> generalMap; std::unordered_map<wxString, std::vector<std::tuple<wxString, SCH_ITEM*, SCH_SHEET_PATH>>> generalMap;
auto logError = [&]( const wxString& normalized, SCH_ITEM* item, const SCH_SHEET_PATH& sheet, auto logError =
const std::tuple<wxString, SCH_ITEM*, SCH_SHEET_PATH>& other ) [&]( const wxString& normalized, SCH_ITEM* item, const SCH_SHEET_PATH& sheet,
{ const std::tuple<wxString, SCH_ITEM*, SCH_SHEET_PATH>& other )
auto& [otherText, otherItem, otherSheet] = other; {
ERCE_T typeOfWarning = ERCE_SIMILAR_LABELS; auto& [otherText, otherItem, otherSheet] = other;
ERCE_T typeOfWarning = ERCE_SIMILAR_LABELS;
if( item->Type() == SCH_PIN_T && otherItem->Type() == SCH_PIN_T ) if( item->Type() == SCH_PIN_T && otherItem->Type() == SCH_PIN_T )
{ {
//Two Pins //Two Pins
typeOfWarning = ERCE_SIMILAR_POWER; typeOfWarning = ERCE_SIMILAR_POWER;
} }
else if( item->Type() == SCH_PIN_T || otherItem->Type() == SCH_PIN_T ) else if( item->Type() == SCH_PIN_T || otherItem->Type() == SCH_PIN_T )
{ {
//Pin and Label //Pin and Label
typeOfWarning = ERCE_SIMILAR_LABEL_AND_POWER; typeOfWarning = ERCE_SIMILAR_LABEL_AND_POWER;
} }
else else
{ {
//Two Labels //Two Labels
typeOfWarning = ERCE_SIMILAR_LABELS; typeOfWarning = ERCE_SIMILAR_LABELS;
} }
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( typeOfWarning ); std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( typeOfWarning );
ercItem->SetItems( item, otherItem ); ercItem->SetItems( item, otherItem );
ercItem->SetSheetSpecificPath( sheet ); ercItem->SetSheetSpecificPath( sheet );
ercItem->SetItemsSheetPaths( sheet, otherSheet ); ercItem->SetItemsSheetPaths( sheet, otherSheet );
SCH_MARKER* marker = new SCH_MARKER( std::move( ercItem ), item->GetPosition() ); SCH_MARKER* marker = new SCH_MARKER( std::move( ercItem ), item->GetPosition() );
sheet.LastScreen()->Append( marker ); sheet.LastScreen()->Append( marker );
}; };
for( const std::pair<NET_NAME_CODE_CACHE_KEY, std::vector<CONNECTION_SUBGRAPH*>> net : m_nets ) for( const std::pair<NET_NAME_CODE_CACHE_KEY, std::vector<CONNECTION_SUBGRAPH*>> net : m_nets )
{ {
@ -1360,9 +1361,7 @@ int ERC_TESTER::TestSimilarLabels()
SCH_PIN* pin = static_cast<SCH_PIN*>( item ); SCH_PIN* pin = static_cast<SCH_PIN*>( item );
if( !pin->IsPower() ) if( !pin->IsPower() )
{
continue; continue;
}
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( pin->GetParentSymbol() ); SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( pin->GetParentSymbol() );
wxString unnormalized = symbol->GetValue( true, &sheet, false ); wxString unnormalized = symbol->GetValue( true, &sheet, false );
@ -1390,6 +1389,7 @@ int ERC_TESTER::TestSimilarLabels()
} }
} }
} }
return errors; return errors;
} }