40 std::shared_ptr<RC_ITEMS_PROVIDER> aMarkersProvider,
41 std::shared_ptr<RC_ITEMS_PROVIDER> aRatsnestProvider,
42 std::shared_ptr<RC_ITEMS_PROVIDER> aFpWarningsProvider) :
60 FILE* fp = wxFopen( aFullFileName, wxT(
"w" ) );
65 std::map<KIID, EDA_ITEM*> itemMap;
66 m_board->FillItemMap( itemMap );
72 wxFileName fn(
m_board->GetFileName() );
73 fprintf( fp,
"** Drc report for %s **\n",
TO_UTF8( fn.GetFullName() ) );
81 fprintf( fp,
"\n** Found %d DRC violations **\n", count );
83 for(
int i = 0; i < count; ++i )
86 SEVERITY severity = item->GetParent()->GetSeverity();
91 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
96 fprintf( fp,
"\n** Found %d unconnected pads **\n", count );
98 for(
int i = 0; i < count; ++i )
103 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
108 fprintf( fp,
"\n** Found %d Footprint errors **\n", count );
110 for(
int i = 0; i < count; ++i )
115 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( &unitsProvider, severity, itemMap ) ) );
118 fprintf( fp,
"\n** Ignored checks **\n" );
120 bool hasIgnored =
false;
124 int code = item.GetErrorCode();
126 if( code > 0 && bds.
Ignore( code ) )
134 fprintf( fp,
" - %s\n",
TO_UTF8(
_(
"None" ) ) );
136 fprintf( fp,
"\n** End of Report **\n" );
146 std::ofstream jsonFileStream( aFullFileName.fn_str() );
150 std::map<KIID, EDA_ITEM*> itemMap;
151 m_board->FillItemMap( itemMap );
155 wxFileName fn(
m_board->GetFileName() );
156 reportHead.
$schema =
"https://schemas.kicad.org/drc.v1.json";
157 reportHead.
source = fn.GetFullName();
175 SEVERITY severity = item->GetParent()->GetSeverity();
178 severity = bds.
GetSeverity( item->GetErrorCode() );
181 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
192 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
204 item->GetJsonViolation( violation, &unitsProvider, severity, itemMap );
211 int code = item.GetErrorCode();
213 if( code > 0 && bds.
Ignore( code ) )
216 ignoredCheck.
key = item.GetSettingsKey();
222 nlohmann::json saveJson = nlohmann::json( reportHead );
223 jsonFileStream << std::setw( 4 ) << saveJson << std::endl;
224 jsonFileStream.flush();
225 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
static wxString StripMarkup(const wxString &aValue)
Flatten [label](url) markup, keeping just the label.
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