@@ -41,12 +41,14 @@ type Type struct {
4141 Summary summaryReportType `json:"summary"`
4242}
4343
44+ // toolConfigurationReportType is the type for the arduino-lint tool configuration.
4445type toolConfigurationReportType struct {
4546 Paths paths.PathList `json:"paths"`
4647 ProjectType string `json:"projectType"`
4748 Recursive bool `json:"recursive"`
4849}
4950
51+ // projectReportType is the type for the individual project reports.
5052type projectReportType struct {
5153 Path * paths.Path `json:"path"`
5254 ProjectType string `json:"projectType"`
@@ -55,12 +57,14 @@ type projectReportType struct {
5557 Summary summaryReportType `json:"summary"`
5658}
5759
60+ // projectConfigurationReportType is the type for the individual project tool configurations.
5861type projectConfigurationReportType struct {
5962 Compliance string `json:"compliance"`
6063 LibraryManager string `json:"libraryManager"`
6164 Official bool `json:"official"`
6265}
6366
67+ // ruleReportType is the type of the rule reports.
6468type ruleReportType struct {
6569 Category string `json:"category"`
6670 Subcategory string `json:"subcategory"`
@@ -72,6 +76,7 @@ type ruleReportType struct {
7276 Message string `json:"message"`
7377}
7478
79+ // summaryReportType is the type of the rule result summary reports.
7580type summaryReportType struct {
7681 Pass bool `json:"pass"`
7782 WarningCount int `json:"warningCount"`
@@ -210,11 +215,12 @@ func (results Type) SummaryText() string {
210215 return fmt .Sprintf ("Finished linting projects. Results:\n Warning count: %v\n Error count: %v\n Rules passed: %v" , results .Summary .WarningCount , results .Summary .ErrorCount , results .Summary .Pass )
211216}
212217
213- // JSONReport returns a JSON formatted report of rules on all projects.
218+ // JSONReport returns a JSON formatted report of rules on all projects in string encoding .
214219func (results Type ) JSONReport () string {
215220 return string (results .jsonReportRaw ())
216221}
217222
223+ // jsonReportRaw returns the report marshalled into JSON format in byte encoding.
218224func (results Type ) jsonReportRaw () []byte {
219225 reportJSON , err := json .MarshalIndent (results , "" , " " )
220226 if err != nil {
@@ -251,6 +257,7 @@ func (results Type) Passed() bool {
251257 return results .Summary .Pass
252258}
253259
260+ // getProjectReportIndex returns the index of the existing entry in the results.Projects array for the given project, or the next available index if there is no existing entry.
254261func (results Type ) getProjectReportIndex (projectPath * paths.Path ) (bool , int ) {
255262 var index int
256263 var projectReport projectReportType
0 commit comments