Skip to content

Commit

Permalink
feat: iac style updates (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch authored Sep 25, 2024
1 parent dc81228 commit 1c41d37
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 55 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/snyk/code-client-go v1.10.0
github.com/snyk/go-application-framework v0.0.0-20240923065347-2225879c171e
github.com/snyk/go-application-framework v0.0.0-20240925082317-bae184c4f01a
github.com/sourcegraph/go-lsp v0.0.0-20240223163137-f80c5dd31dfd
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ github.com/snyk/code-client-go v1.10.0 h1:t/hBINxj4lKvoo681uGhxHBpMued/j68p2sHbB
github.com/snyk/code-client-go v1.10.0/go.mod h1:orU911flV1kJQOlxxx0InUQkAfpBrcERsb2olfnlI8s=
github.com/snyk/error-catalog-golang-public v0.0.0-20240809094525-c48d19c27edb h1:w9tJhpTFxWqAhLeraGsMExDjGK9x5Dwj1NRFwb+t+QE=
github.com/snyk/error-catalog-golang-public v0.0.0-20240809094525-c48d19c27edb/go.mod h1:Ytttq7Pw4vOCu9NtRQaOeDU2dhBYUyNBe6kX4+nIIQ4=
github.com/snyk/go-application-framework v0.0.0-20240923065347-2225879c171e h1:WGxBh8+wVMNqP8JrUw9ocM50TR80dXQ+LyoV71ST+zE=
github.com/snyk/go-application-framework v0.0.0-20240923065347-2225879c171e/go.mod h1:LeMsRM1FxIfO/8QpOs9V/dI46ie/RAQl02ulAh6aKys=
github.com/snyk/go-application-framework v0.0.0-20240925082317-bae184c4f01a h1:9UNDG8FgDpdPwWxInsGD2VmsIfv9Ka9//h7M2u5bzTk=
github.com/snyk/go-application-framework v0.0.0-20240925082317-bae184c4f01a/go.mod h1:LeMsRM1FxIfO/8QpOs9V/dI46ie/RAQl02ulAh6aKys=
github.com/snyk/go-httpauth v0.0.0-20231117135515-eb445fea7530 h1:s9PHNkL6ueYRiAKNfd8OVxlUOqU3qY0VDbgCD1f6WQY=
github.com/snyk/go-httpauth v0.0.0-20231117135515-eb445fea7530/go.mod h1:88KbbvGYlmLgee4OcQ19yr0bNpXpOr2kciOthaSzCAg=
github.com/sourcegraph/go-lsp v0.0.0-20240223163137-f80c5dd31dfd h1:Dq5WSzWsP1TbVi10zPWBI5LKEBDg4Y1OhWEph1wr5WQ=
Expand Down
1 change: 1 addition & 0 deletions infrastructure/code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ func isNoFilesError(err error) bool {
_, ok := err.(noFilesError)
return ok
}

func (sc *Scanner) createBundle(ctx context.Context,
requestId string,
rootPath string,
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/iac/iac.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (iac *Scanner) toIssue(affectedFilePath string, issue iacIssue, fileContent
Start: snyk.Position{Line: issue.LineNumber, Character: rangeStart},
End: snyk.Position{Line: issue.LineNumber, Character: rangeEnd},
},
Message: fmt.Sprintf("%s (Snyk)", title),
Message: title,
FormattedMessage: iac.getExtendedMessage(issue),
Severity: iac.toIssueSeverity(issue.Severity),
AffectedFilePath: affectedFilePath,
Expand Down
94 changes: 48 additions & 46 deletions infrastructure/iac/template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; style-src 'self' 'nonce-{{.Nonce}}' 'nonce-ideNonce'; script-src 'nonce-{{.Nonce}}';">
content="style-src 'self' 'nonce-{{.Nonce}}' 'nonce-ideNonce' https://fonts.googleapis.com;
script-src 'nonce-{{.Nonce}}';
font-src 'self' https://fonts.gstatic.com;">
<!--noformat-->
<!-- @formatter:off -->
<style nonce="{{.Nonce}}">{{.Styles}}</style>
Expand All @@ -33,54 +35,54 @@
</head>

<body>
<div class="suggestion">
<!-- Panel header -->
<header class="panel-header">
<div class="severity-container">
{{.SeverityIcon}}
<h2 class="severity-title">{{.Issue.AdditionalData.Title}}</h2>
<div class="suggestion">
<!-- Panel header -->
<header class="panel-header">
<div class="severity-container">
{{.SeverityIcon}}
<h2 class="severity-title">{{.Issue.AdditionalData.Title}}</h2>
</div>
<div class="severity-type-container">
<div class="severity-type">Issue</div>
<span class="delimiter"></span>
<a class="styled-link" target="_blank" rel="noopener noreferrer"
href="{{.Issue.AdditionalData.Documentation}}">{{.Issue.ID}}</a>
</header>
<section class="delimiter-top summary">
<div class="summary-item description">
<div class="label">Description</div>
<div class="content">
{{.Description}}
</div>
<div class="severity-type-container">
<div class="severity-type">Issue</div>
<span class="delimiter"></span>
<a class="styled-link" target="_blank" rel="noopener noreferrer"
href="{{.Issue.AdditionalData.Documentation}}">{{.Issue.ID}}</a>
</header>
<section class="delimiter-top summary">
<div class="summary-item description">
<div class="label">Description</div>
<div class="content">
{{.Description}}
</div>
</div>
<div class="summary-item impact">
<div class="label">Impact</div>
<div class="content">
{{.Issue.AdditionalData.Impact}}
</div>
<div class="summary-item impact">
<div class="label">Impact</div>
<div class="content">
{{.Issue.AdditionalData.Impact}}
</div>
</div>
<div class="summary-item path">
<div class="label">Path</div>
<div class="content">
<pre><code class="path">{{.Path}}</code></pre>
</div>
<div class="summary-item path">
<div class="label">Path</div>
<div class="content">
<pre><code class="path">{{.Path}}</code></pre>
</div>
</div>
</section>
<section class="delimiter-top summary">
<h2>Remediation</h2>
<div class="summary-item sn-fix-wrapper">
<div class="remediation">{{.Remediation}}</div>
</div>
</section>
<section class="delimiter-top">
<h2>References</h2>
<div class="summary-items">
{{range .Issue.AdditionalData.References}}
<a class="styled-link" target="_blank" rel="noopener noreferrer" href="{{.}}">{{.}}</a>
{{end}}
</div>
</section>
</div>
</div>
</section>
<section class="delimiter-top summary">
<h2>Remediation</h2>
<div class="summary-item sn-fix-wrapper">
<div class="remediation">{{.Remediation}}</div>
</div>
</section>
<section class="delimiter-top">
<h2>References</h2>
<div class="summary-items">
{{range .Issue.AdditionalData.References}}
<a class="styled-link" target="_blank" rel="noopener noreferrer" href="{{.}}">{{.}}</a>
{{end}}
</div>
</section>
</div>
</body>

</html>
41 changes: 37 additions & 4 deletions infrastructure/iac/template/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
/* this is the IntelliJ new UI default font, and it's not available on a Mac standard install */
@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');

:root {
--default-font: ui-sans-serif, "SF Pro Text", "Segoe UI", "Ubuntu", Geneva, Verdana, Tahoma, sans-serif;
--default-font: "SF Pro Text", "Segoe UI", "Ubuntu", Geneva, Verdana, Tahoma, sans-serif;
--background-color: var();
--text-color: var();
--link-color: var();
--scroll-bar-hover-background-color: var(#595a5c);
--horizontal-border-color: var();
--code-background-color: var();
}

::-webkit-scrollbar {
Expand All @@ -11,13 +20,37 @@
}

::-webkit-scrollbar-thumb:hover {
background: #595a5c;
background: var(--scroll-bar-hover-background-color);
}

body {
background-color: var(--background-color);
font-family: var(--default-font);
overflow-y: auto;
overflow-x: hidden;
color: var(--text-color);
}

section {
padding: 20px;
}

.font-light {
font-weight: bold;
}

a,
.link {
color: var(--link-color);
}

.delimiter-top {
border-top: 1px solid var(--horizontal-border-color);
}

code {
background-color: var(--code-background-color);
padding: 1px 3px;
border-radius: 4px;
font-size: 1rem
}

h2 {
Expand Down
2 changes: 1 addition & 1 deletion internal/progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (t *Tracker) BeginWithMessage(title, message string) {
}

func (t *Tracker) ReportWithMessage(percentage int, message string) {
if time.Now().Before(t.lastReport.Add(time.Second)) || percentage <= t.lastReportPercentage {
if time.Now().Before(t.lastReport.Add(200 * time.Millisecond)) {
return
}
progress := types.ProgressParams{
Expand Down

0 comments on commit 1c41d37

Please sign in to comment.