Skip to content
Merged
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
18 changes: 18 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[flake8]
max-line-length = 100
extend-ignore = E203, E501, W503, E713, E712, E402, F401, F841, F811, F821, F541, D100, D101, D102, D103, D104, D105, D107, D200, D202, D205, D209, D301, D400, D401, D403
exclude =
.git,
__pycache__,
build,
dist,
*.egg-info,
.venv,
venv,
tmp*,
external,
llm_cache,
output,
logs,
benchmark*,
utils/lynette
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Description
<!-- Provide a brief description of the changes in this PR -->

## Type of Change
<!-- Mark the relevant option with an 'x' -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring

## Checklist
<!-- Mark completed items with an 'x' -->

- [ ] My code follows the code style of this project
- [ ] I have run pre-commit hooks locally (`pre-commit run --all-files`)
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes

## Testing
<!-- Describe the tests that you ran to verify your changes -->

## Additional Notes
<!-- Add any additional notes, context, or screenshots about the PR here -->
90 changes: 90 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# GitHub Configuration

This directory contains GitHub-specific configuration files for the VerusAgent repository.

## Pre-commit Hooks

This repository uses [pre-commit](https://pre-commit.com/) to ensure code quality and consistency.

### Setup

1. **Install pre-commit:**

```bash
pip install pre-commit
```

2. **Install the git hooks:**

```bash
pre-commit install
```

3. **Run manually (optional):**

```bash
# Run on all files
pre-commit run --all-files

# Run on staged files only
pre-commit run
```

### What Gets Checked

The pre-commit hooks run the following checks:

- **General:** Trailing whitespace, end-of-file fixes, YAML/JSON/TOML validation
- **Python:** Code formatting (black), import sorting (isort), linting (flake8)
- **Rust:** Code formatting (rustfmt), linting (clippy)
- **Shell:** Script linting (shellcheck)
- **Markdown:** Linting and formatting
- **Security:** Detect private keys, large files

### Skipping Hooks

If you absolutely need to skip the pre-commit hooks (not recommended):

```bash
git commit --no-verify
```

## GitHub Actions

### Pre-commit Workflow

The `.github/workflows/pre-commit.yml` workflow runs on every push and pull request to ensure all code meets quality standards. This workflow:

- Runs all pre-commit hooks
- Fails if any checks don't pass
- Provides detailed error messages

## Troubleshooting

### Pre-commit failing on existing files

If pre-commit fails on files you didn't modify:

```bash
# Auto-fix what can be fixed
pre-commit run --all-files

# Commit the fixes
git add -u
git commit -m "Apply pre-commit fixes"
```

### Updating pre-commit hooks

```bash
pre-commit autoupdate
```

### Rust tools not found

Install Rust toolchain:

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup component add rustfmt clippy
```
53 changes: 53 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Pre-commit Checks

on:
push:
branches:
- main
- master
- develop
- new-workflow
pull_request:
branches:
- main
- master
- develop
- new-workflow

jobs:
pre-commit:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Cache pre-commit hooks
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-

- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure

- name: Annotate with pre-commit results
if: failure()
run: |
echo "::error::Pre-commit checks failed. Please run 'pre-commit run --all-files' locally and commit the fixes."
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,36 @@ output/
prompt/
log
log2

# Cursor-generated documentation and analysis files
*_REFLECTION.md
*_SUMMARY.md
*_ANALYSIS.md
*_GUIDE.md
*_IMPROVEMENTS.md
*_PLAN.md
*_diagnosis.md
*_debug_report.md
abstraction_*.md
benchmark_*.md
examples_based_teaching.md
planning_recommendations.md
repair_system_improvements.md
view_inference_coverage.md
COMPLETE_*.md
EXPERIMENT_*.md
FINAL_*.md
PARALLEL_*.md
README_IMPROVEMENTS.md
REPAIR_*.md
TIMEOUT_*.md
VEVAL_ERROR_*.md
.git-commit-guide.md
results_summary.md
examples/repair_*.md
docs/repair_*.md

# Additional generated files
TIMEOUT_IMPLEMENTATION_SUMMARY.txt
benchmark_summary_*.txt
check_benchmark_status.sh
13 changes: 13 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"default": true,
"MD013": false,
"MD024": false,
"MD025": false,
"MD029": false,
"MD033": false,
"MD034": false,
"MD036": false,
"MD040": false,
"MD041": false,
"MD001": false
}
90 changes: 77 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,81 @@
# Pre-commit configuration for VerusAgent
# Install pre-commit: pip install pre-commit
# Install hooks: pre-commit install
# Run manually: pre-commit run --all-files

repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black"]
- repo: https://github.com/psf/black
rev: 22.6.0
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: check-toml
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-private-key
- id: mixed-line-ending
args: ['--fix=lf']

# Python code formatting with black
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
- id: black
language_version: python3
args: ['--line-length=100']

# Python import sorting
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: isort
args: ['--profile', 'black', '--line-length', '100']

# Python linting with flake8
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8

# Python type checking (optional - can be slow)
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.8.0
# hooks:
# - id: mypy
# args: [--ignore-missing-imports]
# additional_dependencies: [types-all]

# Shell script linting
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck

# Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
hooks:
- id: markdownlint
args: ['--fix']

# Exclude certain directories and files
exclude: |
(?x)^(
.*\.log|
.*\.out|
tmp.*|
llm_cache/.*|
output/.*|
logs/.*|
external/.*|
\.git/.*|
benchmark.*/.*|
benchmarks-.*/.*
)$
15 changes: 15 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ShellCheck configuration
# Disable certain checks that are informational or not critical

disable=SC2012 # Use of ls is OK for simple cases
disable=SC2009 # Use of ps aux + grep is acceptable
disable=SC2126 # grep | wc -l is more readable than grep -c
disable=SC2046 # Word splitting is intentional in these scripts
disable=SC2086 # Quote warnings - scripts work as intended
disable=SC2162 # read without -r is acceptable here
disable=SC2013 # Reading words from cat is intended behavior
disable=SC2002 # Useless cat - style preference
disable=SC2001 # sed is more readable than parameter expansion
disable=SC2144 # glob with -f - known limitation
disable=SC2148 # Scripts without shebang - some are sourced
disable=SC2236 # Style preferences for -z vs -n
Loading