Skip to content

Commit

Permalink
Merge pull request #1393 from 0xArty/feature/pre-commit-formatter
Browse files Browse the repository at this point in the history
Feature/pre commit formatter
  • Loading branch information
richbeales authored Apr 14, 2023
2 parents 55eef98 + 19a011c commit 1b3f82e
Show file tree
Hide file tree
Showing 50 changed files with 1,195 additions and 613 deletions.
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]
max-line-length = 88
extend-ignore = E203
exclude =
.tox,
__pycache__,
*.pyc,
.env
venv/*
.venv/*
reports/*
dist/*
134 changes: 130 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
## Original ignores
autogpt/keys.py
autogpt/*json
autogpt/node_modules/
Expand All @@ -19,10 +20,135 @@ log.txt
log-ingestion.txt
logs

# Coverage reports
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
plugins/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
htmlcov/
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# For Macs Dev Environs: ignoring .Desktop Services_Store
.DS_Store
# Pyre type checker
.pyre/
llama-*
vicuna-*
10 changes: 10 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
profile = black
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
line_length = 88
skip = venv,env,node_modules,.env,.venv,dist
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
repos:
- repo: https://github.com/sourcery-ai/sourcery
rev: v1.1.0 # Get the latest tag from https://github.com/sourcery-ai/sourcery/tags
hooks:
- id: sourcery

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v0.9.2
hooks:
- id: check-added-large-files
args: [ '--maxkb=500' ]
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements

- repo: local
hooks:
- id: isort
name: isort-local
entry: isort
language: python
types: [ python ]
exclude: .+/(dist|.venv|venv|build)/.+
pass_filenames: true
- id: black
name: black-local
entry: black
language: python
types: [ python ]
exclude: .+/(dist|.venv|venv|build)/.+
pass_filenames: true
71 changes: 71 additions & 0 deletions .sourcery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 🪄 This is your project's Sourcery configuration file.

# You can use it to get Sourcery working in the way you want, such as
# ignoring specific refactorings, skipping directories in your project,
# or writing custom rules.

# 📚 For a complete reference to this file, see the documentation at
# https://docs.sourcery.ai/Configuration/Project-Settings/

# This file was auto-generated by Sourcery on 2023-02-25 at 21:07.

version: '1' # The schema version of this config file

ignore: # A list of paths or files which Sourcery will ignore.
- .git
- venv
- .venv
- build
- dist
- env
- .env
- .tox

rule_settings:
enable:
- default
- gpsg
disable: [] # A list of rule IDs Sourcery will never suggest.
rule_types:
- refactoring
- suggestion
- comment
python_version: '3.9' # A string specifying the lowest Python version your project supports. Sourcery will not suggest refactorings requiring a higher Python version.

# rules: # A list of custom rules Sourcery will include in its analysis.
# - id: no-print-statements
# description: Do not use print statements in the test directory.
# pattern: print(...)
# language: python
# replacement:
# condition:
# explanation:
# paths:
# include:
# - test
# exclude:
# - conftest.py
# tests: []
# tags: []

# rule_tags: {} # Additional rule tags.

# metrics:
# quality_threshold: 25.0

# github:
# labels: []
# ignore_labels:
# - sourcery-ignore
# request_review: author
# sourcery_branch: sourcery/{base_branch}

# clone_detection:
# min_lines: 3
# min_duplicates: 2
# identical_clones_only: false

# proxy:
# url:
# ssl_certs_file:
# no_ssl_verify: false
32 changes: 20 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,49 @@ To contribute to this GitHub project, you can follow these steps:
```
git clone https://github.com/<YOUR-GITHUB-USERNAME>/Auto-GPT
```
3. Create a new branch for your changes using the following command:
3. Install the project requirements
```
pip install -r requirements.txt
```
4. Install pre-commit hooks
```
pre-commit install
```
5. Create a new branch for your changes using the following command:

```
git checkout -b "branch-name"
```
4. Make your changes to the code or documentation.
6. Make your changes to the code or documentation.
- Example: Improve User Interface or Add Documentation.


5. Add the changes to the staging area using the following command:
7. Add the changes to the staging area using the following command:
```
git add .
```

6. Commit the changes with a meaningful commit message using the following command:
8. Commit the changes with a meaningful commit message using the following command:
```
git commit -m "your commit message"
```
7. Push the changes to your forked repository using the following command:
9. Push the changes to your forked repository using the following command:
```
git push origin branch-name
```
8. Go to the GitHub website and navigate to your forked repository.
10. Go to the GitHub website and navigate to your forked repository.

9. Click the "New pull request" button.
11. Click the "New pull request" button.

10. Select the branch you just pushed to and the branch you want to merge into on the original repository.
12. Select the branch you just pushed to and the branch you want to merge into on the original repository.

11. Add a description of your changes and click the "Create pull request" button.
13. Add a description of your changes and click the "Create pull request" button.

12. Wait for the project maintainer to review your changes and provide feedback.
14. Wait for the project maintainer to review your changes and provide feedback.

13. Make any necessary changes based on feedback and repeat steps 5-12 until your changes are accepted and merged into the main project.
15. Make any necessary changes based on feedback and repeat steps 5-12 until your changes are accepted and merged into the main project.

14. Once your changes are merged, you can update your forked repository and local copy of the repository with the following commands:
16. Once your changes are merged, you can update your forked repository and local copy of the repository with the following commands:

```
git fetch upstream
Expand Down
Loading

0 comments on commit 1b3f82e

Please sign in to comment.