Skip to content

Commit

Permalink
style: fix typo (#1592)
Browse files Browse the repository at this point in the history
* style: fix typo

* style: add comment
  • Loading branch information
MaineK00n authored Feb 22, 2023
1 parent 897fef2 commit 4e486da
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions detector/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ func fetchDependencyGraph(r *models.ScanResult, httpClient *http.Client, owner,
return nil
}

// DependencyGraph is a GitHub API response
type DependencyGraph struct {
Data struct {
Repository struct {
Expand Down
3 changes: 3 additions & 0 deletions models/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// key: BlobPath
type DependencyGraphManifests map[string]DependencyGraphManifest

// DependencyGraphManifest has filename, repository, dependencies
type DependencyGraphManifest struct {
BlobPath string `json:"blobPath"`
Filename string `json:"filename"`
Expand Down Expand Up @@ -76,13 +77,15 @@ func (m DependencyGraphManifest) Ecosystem() string {
}
}

// Dependency has dependency package information
type Dependency struct {
PackageName string `json:"packageName"`
PackageManager string `json:"packageManager"`
Repository string `json:"repository"`
Requirements string `json:"requirements"`
}

// Version returns version
func (d Dependency) Version() string {
s := strings.Split(d.Requirements, " ")
if len(s) == 2 && s[0] == "=" {
Expand Down
2 changes: 2 additions & 0 deletions models/vulninfos.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ type GitHubSecurityAlert struct {
DismissReason string `json:"dismissReason"`
}

// RepoURLPackageName returns a string connecting the repository and package name
func (a GitHubSecurityAlert) RepoURLPackageName() string {
return fmt.Sprintf("%s %s", a.Repository, a.Package.Name)
}
Expand All @@ -319,6 +320,7 @@ func (a GitHubSecurityAlert) RepoURLManifestPath() string {
return fmt.Sprintf("%s/%s", a.Repository, a.Package.ManifestPath)
}

// GSAVulnerablePackage has vulnerable package information
type GSAVulnerablePackage struct {
Name string `json:"name"`
Ecosystem string `json:"ecosystem"`
Expand Down
1 change: 1 addition & 0 deletions reporter/chatwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type ChatWorkWriter struct {
Proxy string
}

// Write results to ChatWork
func (w ChatWorkWriter) Write(rs ...models.ScanResult) (err error) {

for _, r := range rs {
Expand Down
1 change: 1 addition & 0 deletions reporter/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type EMailWriter struct {
Cnf config.SMTPConf
}

// Write results to Email
func (w EMailWriter) Write(rs ...models.ScanResult) (err error) {
var message string
sender := NewEMailSender(w.Cnf)
Expand Down
1 change: 1 addition & 0 deletions reporter/googlechat.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type GoogleChatWriter struct {
Proxy string
}

// Write results to Google Chat
func (w GoogleChatWriter) Write(rs ...models.ScanResult) (err error) {
re := regexp.MustCompile(w.Cnf.ServerNameRegexp)

Expand Down
1 change: 1 addition & 0 deletions reporter/localfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type LocalFileWriter struct {
Gzip bool
}

// Write results to Local File
func (w LocalFileWriter) Write(rs ...models.ScanResult) (err error) {
if w.FormatOneLineText {
path := filepath.Join(w.CurrentDir, "summary.txt")
Expand Down
1 change: 1 addition & 0 deletions reporter/sbom/cyclonedx.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/future-architect/vuls/models"
)

// GenerateCycloneDX generates a string in CycloneDX format
func GenerateCycloneDX(format cdx.BOMFileFormat, r models.ScanResult) ([]byte, error) {
bom := cdx.NewBOM()
bom.SerialNumber = uuid.New().URN()
Expand Down
1 change: 1 addition & 0 deletions reporter/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type message struct {
Attachments []slack.Attachment `json:"attachments"`
}

// Write results to Slack
func (w SlackWriter) Write(rs ...models.ScanResult) (err error) {

for _, r := range rs {
Expand Down
1 change: 1 addition & 0 deletions reporter/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func (w StdoutWriter) WriteScanSummary(rs ...models.ScanResult) {
fmt.Printf("%s\n", formatScanSummary(rs...))
}

// Write results to stdout
func (w StdoutWriter) Write(rs ...models.ScanResult) error {
if w.FormatOneLineText {
fmt.Print("\n\n")
Expand Down
1 change: 1 addition & 0 deletions reporter/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type SyslogWriter struct {
Cnf config.SyslogConf
}

// Write results to syslog
func (w SyslogWriter) Write(rs ...models.ScanResult) (err error) {
facility, _ := w.Cnf.GetFacility()
severity, _ := w.Cnf.GetSeverity()
Expand Down
1 change: 1 addition & 0 deletions reporter/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type TelegramWriter struct {
Proxy string
}

// Write results to Telegram
func (w TelegramWriter) Write(rs ...models.ScanResult) (err error) {
for _, r := range rs {
msgs := []string{fmt.Sprintf("*%s*\n%s\n%s\n%s",
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (h VulsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}

// sever subcmd doesn't have diff option
// server subcmd doesn't have diff option
reports = append(reports, reporter.LocalFileWriter{
CurrentDir: dir,
FormatJSON: true,
Expand Down

0 comments on commit 4e486da

Please sign in to comment.