Fix erc/drc severity args

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16924
This commit is contained in:
Marek Roszko 2024-02-11 19:13:52 -05:00
parent b588001b95
commit 51312ed407
2 changed files with 16 additions and 8 deletions

View File

@ -97,26 +97,30 @@ int CLI::PCB_DRC_COMMAND::doPerform( KIWAY& aKiway )
drcJob->m_reportAllTrackErrors = m_argParser.get<bool>( ARG_ALL_TRACK_ERRORS ); drcJob->m_reportAllTrackErrors = m_argParser.get<bool>( ARG_ALL_TRACK_ERRORS );
drcJob->m_exitCodeViolations = m_argParser.get<bool>( ARG_EXIT_CODE_VIOLATIONS ); drcJob->m_exitCodeViolations = m_argParser.get<bool>( ARG_EXIT_CODE_VIOLATIONS );
int severity = 0;
if( m_argParser.get<bool>( ARG_SEVERITY_ALL ) ) if( m_argParser.get<bool>( ARG_SEVERITY_ALL ) )
{ {
drcJob->m_severity = RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING | RPT_SEVERITY_EXCLUSION; severity = RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING | RPT_SEVERITY_EXCLUSION;
} }
if( m_argParser.get<bool>( ARG_SEVERITY_ERROR ) ) if( m_argParser.get<bool>( ARG_SEVERITY_ERROR ) )
{ {
drcJob->m_severity |= RPT_SEVERITY_ERROR; severity |= RPT_SEVERITY_ERROR;
} }
if( m_argParser.get<bool>( ARG_SEVERITY_WARNING ) ) if( m_argParser.get<bool>( ARG_SEVERITY_WARNING ) )
{ {
drcJob->m_severity |= RPT_SEVERITY_WARNING; severity |= RPT_SEVERITY_WARNING;
} }
if( m_argParser.get<bool>( ARG_SEVERITY_EXCLUSIONS ) ) if( m_argParser.get<bool>( ARG_SEVERITY_EXCLUSIONS ) )
{ {
drcJob->m_severity |= RPT_SEVERITY_EXCLUSION; severity |= RPT_SEVERITY_EXCLUSION;
} }
if( severity ) // override the default only if something we configured
drcJob->m_severity = severity;
drcJob->m_reportAllTrackErrors = m_argParser.get<bool>( ARG_ALL_TRACK_ERRORS ); drcJob->m_reportAllTrackErrors = m_argParser.get<bool>( ARG_ALL_TRACK_ERRORS );
wxString units = From_UTF8( m_argParser.get<std::string>( ARG_UNITS ).c_str() ); wxString units = From_UTF8( m_argParser.get<std::string>( ARG_UNITS ).c_str() );

View File

@ -90,26 +90,30 @@ int CLI::SCH_ERC_COMMAND::doPerform( KIWAY& aKiway )
ercJob->m_exitCodeViolations = m_argParser.get<bool>( ARG_EXIT_CODE_VIOLATIONS ); ercJob->m_exitCodeViolations = m_argParser.get<bool>( ARG_EXIT_CODE_VIOLATIONS );
ercJob->SetVarOverrides( m_argDefineVars ); ercJob->SetVarOverrides( m_argDefineVars );
int severity = 0;
if( m_argParser.get<bool>( ARG_SEVERITY_ALL ) ) if( m_argParser.get<bool>( ARG_SEVERITY_ALL ) )
{ {
ercJob->m_severity = RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING | RPT_SEVERITY_EXCLUSION; severity = RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING | RPT_SEVERITY_EXCLUSION;
} }
if( m_argParser.get<bool>( ARG_SEVERITY_ERROR ) ) if( m_argParser.get<bool>( ARG_SEVERITY_ERROR ) )
{ {
ercJob->m_severity |= RPT_SEVERITY_ERROR; severity |= RPT_SEVERITY_ERROR;
} }
if( m_argParser.get<bool>( ARG_SEVERITY_WARNING ) ) if( m_argParser.get<bool>( ARG_SEVERITY_WARNING ) )
{ {
ercJob->m_severity |= RPT_SEVERITY_WARNING; severity |= RPT_SEVERITY_WARNING;
} }
if( m_argParser.get<bool>( ARG_SEVERITY_EXCLUSIONS ) ) if( m_argParser.get<bool>( ARG_SEVERITY_EXCLUSIONS ) )
{ {
ercJob->m_severity |= RPT_SEVERITY_EXCLUSION; severity |= RPT_SEVERITY_EXCLUSION;
} }
if( severity ) // override the default only if something we configured
ercJob->m_severity = severity;
wxString units = From_UTF8( m_argParser.get<std::string>( ARG_UNITS ).c_str() ); wxString units = From_UTF8( m_argParser.get<std::string>( ARG_UNITS ).c_str() );
if( units == wxS( "mm" ) ) if( units == wxS( "mm" ) )