Skip to content

Commit 7bb6f00

Browse files
committed
Merge branch 'master' of https://github.com/GoASTScanner/gas into nosec-specify-rule
2 parents 18700c2 + 57dd25a commit 7bb6f00

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

.github/issue_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### Summary
2+
3+
### Steps to reproduce the behavior
4+
5+
### Gas version
6+
7+
### Go version (output of 'go version')
8+
9+
### Operating system / Environment
10+
11+
### Expected behavior
12+
13+
### Actual behavior

Godeps/Godeps.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ $ gas -nosec=true ./...
105105

106106
### Output formats
107107

108-
Gas currently supports text, json, csv and JUnit XML output formats. By default
108+
Gas currently supports text, json, yaml, csv and JUnit XML output formats. By default
109109
results will be reported to stdout, but can also be written to an output
110110
file. The output format is controlled by the '-fmt' flag, and the output file is controlled by the '-out' flag as follows:
111111

cmd/gas/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var (
5959
flagIgnoreNoSec = flag.Bool("nosec", false, "Ignores #nosec comments when set")
6060

6161
// format output
62-
flagFormat = flag.String("fmt", "text", "Set output format. Valid options are: json, csv, junit-xml, html, or text")
62+
flagFormat = flag.String("fmt", "text", "Set output format. Valid options are: json, yaml, csv, junit-xml, html, or text")
6363

6464
// output file
6565
flagOutput = flag.String("out", "", "Set output file for results")

output/formatter.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
plainTemplate "text/template"
2424

2525
"github.com/GoASTScanner/gas"
26+
"gopkg.in/yaml.v2"
2627
)
2728

2829
// ReportFormat enumrates the output format for reported issues
@@ -72,6 +73,8 @@ func CreateReport(w io.Writer, format string, issues []*gas.Issue, metrics *gas.
7273
switch format {
7374
case "json":
7475
err = reportJSON(w, data)
76+
case "yaml":
77+
err = reportYAML(w, data)
7578
case "csv":
7679
err = reportCSV(w, data)
7780
case "junit-xml":
@@ -99,6 +102,15 @@ func reportJSON(w io.Writer, data *reportInfo) error {
99102
return err
100103
}
101104

105+
func reportYAML(w io.Writer, data *reportInfo) error {
106+
raw, err := yaml.Marshal(data)
107+
if err != nil {
108+
return err
109+
}
110+
_, err = w.Write(raw)
111+
return err
112+
}
113+
102114
func reportCSV(w io.Writer, data *reportInfo) error {
103115
out := csv.NewWriter(w)
104116
defer out.Flush()

0 commit comments

Comments
 (0)