Skip to content

Commit aa1d880

Browse files
Merge pull request #1 from EuclidStellar/llm
Llm
2 parents c415773 + c82de17 commit aa1d880

File tree

10 files changed

+634
-8
lines changed

10 files changed

+634
-8
lines changed

.github/workflows/ai-review.yml

Lines changed: 468 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Static Analysis
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- '**.go'
8+
- '**.js'
9+
- '**.jsx'
10+
- '.github/workflows/static-analysis.yml'
11+
12+
jobs:
13+
lint_and_fix_go:
14+
name: Go Static Analysis
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.21'
26+
27+
- name: Cache Go modules
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
~/.cache/go-build
32+
./code/go.sum
33+
key: ${{ runner.os }}-go-${{ hashFiles('./code/go.sum') }}
34+
35+
- name: Ensure Go module exists and tidy
36+
run: |
37+
if [ ! -f go.mod ]; then
38+
go mod init github.com/${{ github.repository }}
39+
fi
40+
go mod tidy
41+
working-directory: ./code
42+
43+
- name: Install reviewdog
44+
run: |
45+
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b /usr/local/bin
46+
47+
- name: Install golangci-lint
48+
run: |
49+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2
50+
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
51+
working-directory: ./code
52+
53+
- name: Run golangci-lint and report via reviewdog
54+
run: |
55+
golangci-lint run --out-format=checkstyle ./... | reviewdog -f=checkstyle -name="golangci-lint" -reporter=github-pr-review -fail-on-error=true
56+
env:
57+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
working-directory: ./code
59+
60+
- name: Upload golangci-lint summary
61+
if: always()
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: golangci-lint-summary
65+
path: ./code
66+
67+
- name: Summarize lint results
68+
if: always()
69+
uses: actions/github-script@v7
70+
with:
71+
script: |
72+
core.summary.addRaw("## Go Static Analysis Run in ./code\n")
73+
74+
75+
lint_js:
76+
name: JavaScript Static Analysis
77+
runs-on: ubuntu-latest
78+
permissions:
79+
contents: read
80+
pull-requests: write
81+
steps:
82+
- uses: actions/checkout@v4
83+
84+
- name: Find all JS/TS projects
85+
id: find_projects
86+
run: |
87+
find . -name package.json -not -path "*/node_modules/*" > projects.txt
88+
cat projects.txt
89+
90+
- name: Set up Node.js
91+
uses: actions/setup-node@v4
92+
with:
93+
node-version: '18'
94+
95+
- name: Run ESLint via reviewdog (PR review)
96+
uses: reviewdog/action-eslint@v1
97+
with:
98+
github_token: ${{ secrets.GITHUB_TOKEN }}
99+
reporter: github-pr-review
100+
eslint_flags: '**/*.{js,jsx,ts,tsx} --no-error-on-unmatched-pattern'
101+
fail_level: error
102+
workdir: ./js-code

.golangci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
linters:
2+
enable:
3+
- gofmt
4+
- goimports
5+
- gosimple
6+
- govet
7+
- ineffassign
8+
- misspell
9+
- staticcheck
10+
- unused
11+
- errcheck
12+
13+
linters-settings:
14+
gofmt:
15+
simplify: true
16+
goimports:
17+
local-prefixes: github.com/keploy/code-review-agent
18+
19+
issues:
20+
exclude-rules:
21+
- path: _test\.go
22+
linters:
23+
- errcheck
24+
25+
run:
26+
timeout: 5m

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Code Review Agent
2+
3+

code/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package code

go.mod

Lines changed: 0 additions & 3 deletions
This file was deleted.

js-code/.eslintrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// runs-on: ubuntu-latest
2+
{
3+
"env": {
4+
"browser": true,
5+
"es2021": true,
6+
"node": true
7+
},
8+
"extends": "eslint:recommended",
9+
"parserOptions": {
10+
"ecmaVersion": "latest",
11+
"sourceType": "module"
12+
},
13+
"rules": {
14+
"no-unused-vars": "warn",
15+
"semi": ["error", "always"],
16+
"no-console": "off"
17+
18+
}
19+
}

js-code/main.js

Whitespace-only changes.

js-code/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "js-code",
3+
"version": "1.0.0",
4+
"description": "JavaScript code for static analysis",
5+
"main": "main.js",
6+
"scripts": {
7+
"lint": "eslint . --ext .js,.jsx"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"devDependencies": {
13+
"eslint": "^8.0.0"
14+
}
15+
}

main.go

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)