Skip to content

Commit

Permalink
setup codeQL workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 committed May 10, 2024
1 parent f7c0244 commit e8c46fd
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
language: [go]
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion pkg/plugin/framework/common/server_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func ErrorStack(err error) *proto.Stack {

stackTrace.Frames = append(stackTrace.Frames, &proto.StackFrame{
File: location.File,
Line: int32(location.Line),
Line: location.Line,

Check warning on line 75 in pkg/plugin/framework/common/server_errors.go

View check run for this annotation

Codecov / codecov/patch

pkg/plugin/framework/common/server_errors.go#L75

Added line #L75 was not covered by tests
Function: location.Function,
})
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/util/logging/error_location_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (h *ErrorLocationHook) Fire(entry *logrus.Entry) error {
type LocationInfo struct {
File string
Function string
Line int
Line int32
}

// GetFrameLocationInfo returns the location of a frame.
Expand All @@ -101,15 +101,15 @@ func GetFrameLocationInfo(frame errors.Frame) LocationInfo {
tabIndex := strings.LastIndex(functionNameAndFileAndLine, "\t")
fileAndLine := strings.Split(functionNameAndFileAndLine[tabIndex+1:], ":")

line, err := strconv.Atoi(fileAndLine[1])
line, err := strconv.ParseInt(fileAndLine[1], 10, 32)
if err != nil {
line = -1
}

return LocationInfo{
File: fileAndLine[0],
Function: functionName,
Line: line,
Line: int32(line),
}
}

Expand Down
2 changes: 1 addition & 1 deletion site/layouts/docs/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h3>{{ .title }}</h3>
{{ range .subfolderitems }}
<li>
{{ if .github }}
<a href="{{ $gh }}{{ .url }}" target="_blank">{{ .page }}</a>
<a href="{{ $gh }}{{ .url }}" target="_blank" rel="noopener noreferrer">{{ .page }}</a>
{{ else }}
<a href="/docs/{{ $version }}{{ .url }}">{{ .page }}</a>
{{ end }}
Expand Down

0 comments on commit e8c46fd

Please sign in to comment.