39 std::shared_ptr<RC_ITEMS_PROVIDER> aMarkersProvider,
40 std::shared_ptr<RC_ITEMS_PROVIDER> aRatsnestProvider,
41 std::shared_ptr<RC_ITEMS_PROVIDER> aFpWarningsProvider) :
59 FILE* fp = wxFopen( aFullFileName, wxT(
"w" ) );
64 std::map<KIID, EDA_ITEM*> itemMap;
65 m_board->FillItemMap( itemMap );
71 wxFileName fn(
m_board->GetFileName() );
72 fprintf( fp,
"** Drc report for %s **\n",
TO_UTF8( fn.GetFullName() ) );
80 fprintf( fp,
"\n** Found %d DRC violations **\n", count );
82 for(
int i = 0; i < count; ++i )
85 SEVERITY severity = item->GetParent()->GetSeverity();
90 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
95 fprintf( fp,
"\n** Found %d unconnected pads **\n", count );
97 for(
int i = 0; i < count; ++i )
102 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
107 fprintf( fp,
"\n** Found %d Footprint errors **\n", count );
109 for(
int i = 0; i < count; ++i )
114 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
117 fprintf( fp,
"\n** Ignored checks **\n" );
119 bool hasIgnored =
false;
123 int code = item.GetErrorCode();
125 if( code > 0 && bds.
Ignore( code ) )
127 fprintf( fp,
" - %s\n",
TO_UTF8( item.GetErrorMessage(
false ) ) );
133 fprintf( fp,
" - %s\n",
TO_UTF8(
_(
"None" ) ) );
135 fprintf( fp,
"\n** End of Report **\n" );
145 std::ofstream jsonFileStream( aFullFileName.fn_str() );
149 std::map<KIID, EDA_ITEM*> itemMap;
150 m_board->FillItemMap( itemMap );
154 wxFileName fn(
m_board->GetFileName() );
155 reportHead.
$schema =
"https://schemas.kicad.org/drc.v1.json";
156 reportHead.
source = fn.GetFullName();
174 SEVERITY severity = item->GetParent()->GetSeverity();
177 severity = bds.
GetSeverity( item->GetErrorCode() );
180 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
191 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
203 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
210 int code = item.GetErrorCode();
212 if( code > 0 && bds.
Ignore( code ) )
215 ignoredCheck.
key = item.GetSettingsKey();
216 ignoredCheck.
description = item.GetErrorMessage(
false );
221 nlohmann::json saveJson = nlohmann::json( reportHead );
222 jsonFileStream << std::setw( 4 ) << saveJson << std::endl;
223 jsonFileStream.flush();
224 jsonFileStream.close();
constexpr EDA_IU_SCALE pcbIUScale
wxString GetMajorMinorPatchVersion()
Get the major, minor and patch version in a string major.minor.patch This is extracted by CMake from ...
Container for design settings for a BOARD object.
bool Ignore(int aDRCErrorCode)
Return true if the DRC error code's severity is SEVERITY_IGNORE.
SEVERITY GetSeverity(int aDRCErrorCode)
Information pertinent to a Pcbnew printed circuit board.
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
std::shared_ptr< RC_ITEMS_PROVIDER > m_ratsnestProvider
bool WriteJsonReport(const wxString &aFullFileName)
std::shared_ptr< RC_ITEMS_PROVIDER > m_markersProvider
bool WriteTextReport(const wxString &aFullFileName)
DRC_REPORT(BOARD *aBoard, EDA_UNITS aReportUnits, std::shared_ptr< RC_ITEMS_PROVIDER > aMarkersProvider, std::shared_ptr< RC_ITEMS_PROVIDER > aRatsnestProvider, std::shared_ptr< RC_ITEMS_PROVIDER > aFpWarningsProvider)
std::shared_ptr< RC_ITEMS_PROVIDER > m_fpWarningsProvider
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
This file contains miscellaneous commonly used macros and functions.
KICOMMON_API wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
wxString formatSeverities(int aSeverities)
Convert a severity mask to a human-readable comma-separated string.
wxString GetISO8601CurrentDateTime()
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
std::vector< wxString > included_severities
std::vector< VIOLATION > unconnected_items
std::vector< IGNORED_CHECK > ignored_checks
std::vector< VIOLATION > violations
std::vector< VIOLATION > schematic_parity
wxString coordinate_units