Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp2 #3

Closed
wants to merge 9 commits into from
Closed
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
34 changes: 34 additions & 0 deletions .github/workflows/code-review-gpt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Code Review GPT

on:
pull_request:
branches: [master]

permissions:
pull-requests: write
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install code-review-gpt
run: npm install code-review-gpt

- name: Run code review script
run: npx code-review-gpt review --ci=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
MODEL: 'gpt-3.5-turbo'
GITHUB_SHA: ${{ github.sha }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
20 changes: 20 additions & 0 deletions .github/workflows/pr_agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
pull_request:
types: [opened, reopened, ready_for_review]
issue_comment:
jobs:
pr_agent_job:
if: ${{ github.event.sender.type != 'Bot' }}
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
name: Run pr agent on every pull request, respond to user comments
steps:
- name: PR Agent action step
id: pragent
uses: Codium-ai/pr-agent@main
env:
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
275 changes: 275 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
name: reviewdog
on:
push:
branches:
- master
pull_request:

jobs:
reviewdog-github-check:
permissions:
checks: write
contents: read
pull-requests: write
name: reviewdog (github-check)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

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

- name: Setup reviewdog
# uses: reviewdog/action-setup@v1
run: |
go install ./cmd/reviewdog

- name: Run reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
golint ./... | reviewdog -f=golint -name=golint-github-check -reporter=github-check -level=warning

- name: Run reviewdog with sub-dir (github-check)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && golint ./... | reviewdog -f=golint -name=golint-check-subdir -reporter=github-check -level=info -filter-mode=nofilter

- name: Custom rdjson test (github-check)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat ./_testdata/custom_rdjson.json | \
reviewdog -name="custom-rdjson" -f=rdjson -reporter=github-check -level=info

reviewdog-pr:
permissions:
checks: write
contents: read
pull-requests: write
if: github.event_name == 'pull_request'
name: reviewdog on Pull Request
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

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

- name: Setup reviewdog
# uses: reviewdog/action-setup@v1
run: |
go install ./cmd/reviewdog

- name: Run reviewdog (github-pr-check)
continue-on-error: true
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
reviewdog -reporter=github-pr-check -runners=golint,govet -fail-on-error

- name: Run reviewdog (github-pr-review with tee)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Remove Go Problem Matchers [1] as it reports duplicate results with
# reviewdog.
# [1]: https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers
echo "::remove-matcher owner=go::"
golint ./... | reviewdog -f=golint -name=golint-pr-review -reporter=github-pr-review -tee

- name: Run reviewdog with sub-dir (github-pr-review)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && golint ./... | reviewdog -f=golint -name=golint-pr-review-subdir -reporter=github-pr-review -tee

- name: Run reviewdog with sub-dir (local+fail-on-error)
run: |
echo 'var LocalTest = 14' >> ./_testdata/golint.go
cd ./_testdata/ && golint ./... | reviewdog -f=golint -diff="git diff" -fail-on-error || EXIT_CODE=$?
git reset --hard @
test "${EXIT_CODE}" = 1

- name: Run reviewdog (github-pr-check with fail-on-error)
continue-on-error: true
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && golint ./... | reviewdog -f=golint -name=golint-pr-check-fail-on-error -reporter=github-pr-check -fail-on-error

- name: Run reviewdog (github-pr-check with -filter-mode=file)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
golint | reviewdog -f=golint -name=golint-pr-check-filter-mode-file -reporter=github-pr-check -filter-mode=file -level=warning

- name: Run reviewdog (github-pr-review -filter-mode=nofilter)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && golint ./... | reviewdog -f=golint -name=golint-pr-review-nofilter -reporter=github-pr-review -filter-mode=nofilter -fail-on-error || EXIT_CODE=$?
test "${EXIT_CODE}" = 1

- name: Unexpected failure (github-pr-review)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && reviewdog -conf=reviewdog_error.yml \
-reporter=github-pr-review || EXIT_CODE=$?
test "${EXIT_CODE}" = 1
- name: Unexpected failure (github-check)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./_testdata/ && reviewdog -conf=reviewdog_error.yml \
-reporter=github-check || EXIT_CODE=$?
test "${EXIT_CODE}" = 1
- name: Unexpected failure (local)
run: |
cd ./_testdata/ && reviewdog -conf=reviewdog_error.yml \
-reporter=local -diff='git diff master' || EXIT_CODE=$?
test "${EXIT_CODE}" = 1
- name: Suggestion (rdjsonl)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat ./_testdata/suggestions.json | \
reviewdog -name="suggestion-test" -f=rdjsonl -reporter=github-pr-review

- name: Custom rdjsonl test (github-pr-review)
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat ./_testdata/custom_rdjson.json | \
reviewdog -name="custom-rdjson" -f=rdjson -reporter=github-pr-review

- name: gofmt -s with reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gofmt -s -d . | \
reviewdog -name="gofmt" -f=diff -f.diff.strip=0 -reporter=github-pr-review

golangci-lint:
permissions:
checks: write
contents: read
pull-requests: write
if: github.event_name == 'pull_request'
name: runner / golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-golangci-lint@v2
with:
github_token: ${{ secrets.github_token }}
golangci_lint_flags: "--timeout 2m"
level: "warning"
reporter: github-pr-check

staticcheck:
permissions:
checks: write
contents: read
pull-requests: write
if: github.event_name == 'pull_request'
name: runner / staticcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- uses: reviewdog/action-staticcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
filter_mode: nofilter
fail_on_error: true
# workdir: ./_testdata/

misspell:
name: runner / misspell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.github_token }}
locale: "US"
reporter: github-check

languagetool:
name: runner / languagetool
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-languagetool@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: info
patterns: |
**/*.md
!**/testdata/**

shellcheck:
if: github.event_name == 'pull_request'
name: runner / shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review

alex:
name: runner / alex
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-alex@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-check
level: info

textlint:
name: runner / textlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-setup@v1
- run: npm install
- name: textlint
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx textlint -f checkstyle README.md | \
reviewdog -f=checkstyle -name="textlint" -reporter=github-check -level=info

sarif:
name: runner / textlint sarif
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-setup@v1
- run: npm install
- name: textlint sarif
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx textlint -f @microsoft/eslint-formatter-sarif README.md | \
reviewdog -f=sarif -name="textlint" -reporter=github-check -level=info

33 changes: 33 additions & 0 deletions error_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Syntax error - missing colon
def greet(name)
print("Hello,", name)

# Linting error - using single quotes instead of double quotes
print('This is a linting error')

# Syntax error - invalid syntax in print statement
print("This will cause a syntax error" # missing closing parenthesis

# Linting error - unused variable
x = 10

# Syntax error - invalid syntax in variable assignment
y = 10 # Missing semicolon

# Linting error - indentation error
def my_function():
print("Indentation error")

# Syntax error - invalid syntax in function definition
def my_function() # Missing colon
print("This will cause a syntax error")

# Linting error - line too long
this_is_a_long_variable_name_that_should_be_shortened_to_avoid_line_too_long_error = 10

# Syntax error - invalid syntax in if statement
if x == 10 # Missing colon
print("This will cause a syntax error")

# Linting error - multiple imports on one line
import os, sys
Loading
Loading