github.com/khulnasoft/codebase@v0.0.0-20231214144635-a707781cbb24/doghouse/service.go (about)

     1  package doghouse
     2  
     3  import (
     4  	"github.com/khulnasoft/codebase/filter"
     5  	"github.com/khulnasoft/codebase/proto/rdf"
     6  )
     7  
     8  // CheckRequest represents doghouse GitHub check request.
     9  type CheckRequest struct {
    10  	// Commit SHA.
    11  	// Required.
    12  	SHA string `json:"sha,omitempty"`
    13  	// PullRequest number.
    14  	// Optional.
    15  	PullRequest int `json:"pull_request,omitempty"`
    16  	// Owner of the repository.
    17  	// Required.
    18  	Owner string `json:"owner,omitempty"`
    19  	// Repository name.
    20  	// Required.
    21  	Repo string `json:"repo,omitempty"`
    22  
    23  	// Branch name.
    24  	// Optional.
    25  	// Deprecated: No need to fill this field.
    26  	Branch string `json:"branch,omitempty"`
    27  
    28  	// Annotations associated with the repository's commit and Pull Request.
    29  	Annotations []*Annotation `json:"annotations,omitempty"`
    30  
    31  	// Name of the annotation tool.
    32  	// Optional.
    33  	Name string `json:"name,omitempty"`
    34  
    35  	// Level is report level for this request.
    36  	// One of ["info", "warning", "error"]. Default is "error".
    37  	// Optional.
    38  	Level string `json:"level"`
    39  
    40  	// Deprecated: Use FilterMode == filter.NoFilter instead.
    41  	//
    42  	// OutsideDiff represents whether it report results in outside diff or not as
    43  	// annotations. It's useful only when PullRequest != 0. If PullRequest is
    44  	// empty, it will always report results all results including outside diff
    45  	// (because there are no diff!).
    46  	// Optional.
    47  	OutsideDiff bool `json:"outside_diff"`
    48  
    49  	// FilterMode represents a way to filter checks results
    50  	// Optional.
    51  	FilterMode filter.Mode `json:"filter_mode"`
    52  }
    53  
    54  // CheckResponse represents doghouse GitHub check response.
    55  type CheckResponse struct {
    56  	// ReportURL is report URL of check run.
    57  	// Optional.
    58  	ReportURL string `json:"report_url,omitempty"`
    59  
    60  	// CheckedResults is checked annotations result.
    61  	// This field is expected to be filled for GitHub Actions integration and
    62  	// filled when ReportURL is not available. i.e. codebase doesn't have write
    63  	// permission to Check API.
    64  	// It's also not expected to be passed over network via JSON.
    65  	// TODO(haya14busa): Consider to move this type to this package to avoid
    66  	// (cyclic) import.
    67  	// Optional.
    68  	CheckedResults []*filter.FilteredDiagnostic `json:"checked_results"`
    69  
    70  	// Conclusion of check result, which is same as GitHub's conclusion of Check
    71  	// API. https://developer.github.com/v3/checks/runs/#parameters-1
    72  	Conclusion string `json:"conclusion,omitempty"`
    73  }
    74  
    75  // Annotation represents an annotation to file or specific line.
    76  type Annotation struct {
    77  	// Diagnostic.Location.Path must be relative path to the project root.
    78  	// Optional.
    79  	Diagnostic *rdf.Diagnostic `json:"diagnostic,omitempty"`
    80  
    81  	// Deprecated fields below. Need to support them for the old codebase CLI
    82  	// version.
    83  
    84  	// Deprecated: Use Diagnostic.
    85  	Path string `json:"path,omitempty"`
    86  	// Deprecated: Use Diagnostic.
    87  	Line int `json:"line,omitempty"`
    88  	// Deprecated: Use Diagnostic.
    89  	Message string `json:"message,omitempty"`
    90  	// Deprecated: Use Diagnostic.
    91  	RawMessage string `json:"raw_message,omitempty"`
    92  }