Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Pr workflow

on:
push:
branches:
- main
paths-ignore:
- "**/*.go"
- "go.mod"
- "go.sum"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '>=1.22'
check-latest: true

- name: Golangci-lint
uses: golangci/[email protected]

audit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Verify dependencies
run: go mod verify

- name: Build
run: go build -v ./...

- name: Run go vet
run: go vet ./...

- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest

- name: Run staticcheck
run: staticcheck ./...

- name: Install golint
run: go install golang.org/x/lint/golint@latest

- name: Run golint
run: golint ./...

- name: Run tests
run: go test -race -vet=off ./...


test:
runs-on: ubuntu-latest
steps:
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
queries: security-and-quality

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

greetings:
runs-on: ubuntu-latest
steps:
- name: Greeting to the Contributors
run: |
echo "Hello, contributors! Thank you for your hard work and dedication. Your contributions are greatly appreciated!"
echo "Keep up the great work!"
echo "Best regards,"
echo "The Team"





34 changes: 34 additions & 0 deletions cmd/program/search.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package program

import(
"fmt"
"github.com/go-git/go-git/v5"
)

type Error struct {
Messafe string
}

func (e*Error) Error() string {
return fmt.Sprintf("Error: %s", e.Messafe)
}

func Search(args[]string) (string,error) {
searchTerm := args[0]

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This definition of searchTerm is never used.
option := ["-un", "-nt", "-np"]

Check failure on line 18 in cmd/program/search.go

View workflow job for this annotation

GitHub Actions / lint

unexpected comma; expecting ]
if len(args) == 0 {
return "", &Error{Messafe: "No search term provided"}
}

switch option {
case "-un":
repos,err := git.PlainOpen(".")
if err != nil {
return "", &Error{Messafe: "Failed to open git repository"}
}
}
if err:= &Error{Messafe: "Not implemented"}; err != nil {

Check failure on line 30 in cmd/program/search.go

View workflow job for this annotation

GitHub Actions / lint

expected boolean expression, found assignment (missing parentheses around composite literal?)

Check warning

Code scanning / CodeQL

Unreachable statement Warning

This statement is unreachable.

Check warning

Code scanning / CodeQL

Unreachable statement Warning

This statement is unreachable.

Check warning

Code scanning / CodeQL

Unreachable statement Warning

This statement is unreachable.

Check warning

Code scanning / CodeQL

Expression has no effect Warning

This expression has no effect.
return "", err

Check failure on line 31 in cmd/program/search.go

View workflow job for this annotation

GitHub Actions / lint

expected operand, found 'return'
}
Comment on lines +30 to +32

Check warning

Code scanning / CodeQL

Expression has no effect Warning

This expression has no effect.

}
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module github.com/bupd/git-donkey

go 1.23.0
go 1.23


require (
github.com/charmbracelet/bubbles v0.21.0
Expand Down
Loading