From 8907e1020e7a04e496dfa6da358c66babd6c927c Mon Sep 17 00:00:00 2001 From: Aditya Sharma Date: Sun, 7 Apr 2019 00:47:04 +0530 Subject: [PATCH 1/2] Add a linter --- .pre-commit-config.yaml | 8 ++++++++ docs/README.md | 12 ++++++++++++ tox.ini | 20 ++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 tox.ini diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..3ff63ad3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: +- repo: https://gitlab.com/pycqa/flake8 + rev: '3.7.7' + hooks: + - id: flake8 + additional_dependencies: [flake8-docstrings, pep8-naming, flake8-import-order] + + diff --git a/docs/README.md b/docs/README.md index ba7acb3d..5ec82c50 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,11 +5,18 @@ Blog and management platform for PSF for running GSoC ## Installation Requires python 3.6+ +To install development dependncies:- ```bash pip install -r requirements.txt ``` +To install pre-commit package manager for linting support using pip:- +$ pip install pre-commit + +or +Run $pre-commit install to install pre-commit into your git hooks. +pre-commit will now run on every commit. Every time you clone a project using pre-commit running pre-commit install should always be the first thing you do. ## Usage ```python @@ -54,6 +61,11 @@ You can create a virtualenv using the following command: $ virtualenv my_name After running this command, a directory named my_name will be created. This is the directory which contains all the necessary executables to use the packages that a Python project would need. This is where Python packages will be installed. +Now after creating virtual environment, you need to activate it. Remember to activate the relevant virtual environment every time you work on the project. This can be done using the following command:- + +$ source virtualenv_name/bin/activate + +Once the virtual environment is activated, the name of your virtual environment will appear on left side of terminal. This will let you know that the virtual environment is currently active. Now you can install dependencies related to the project in this virtual environment. For example if you are using Django 1.9 for a project, you can install it like you install other packages. (virtualenv_name)$ pip install Django==1.9 diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..6b44b3c0 --- /dev/null +++ b/tox.ini @@ -0,0 +1,20 @@ +[flake8] +max-line-length = 110 +exclude = +# No need to traverse our git directory +.git, +#Contains mostly auto generated files +*/migrations/*, +*/static/CACHE/*, +#Contains documentation for the project +docs +count = True +format=pylint +hang-closing = True +show-source = True +statistics = True +output-file = output.txt +tee = True +#Enable PyFlakes syntax checking of doctests in docstrings +doctests = True + From e57813e119f516170000ce8eb5f40588d24b8b1a Mon Sep 17 00:00:00 2001 From: Aditya Sharma Date: Sun, 7 Apr 2019 10:18:57 +0530 Subject: [PATCH 2/2] Add a linter changes --- docs/README.md | 7 ------- requirements.txt | 1 + 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/README.md b/docs/README.md index 5ec82c50..cf45a8b8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,13 +10,6 @@ To install development dependncies:- ```bash pip install -r requirements.txt ``` -To install pre-commit package manager for linting support using pip:- - -$ pip install pre-commit - -or -Run $pre-commit install to install pre-commit into your git hooks. -pre-commit will now run on every commit. Every time you clone a project using pre-commit running pre-commit install should always be the first thing you do. ## Usage ```python diff --git a/requirements.txt b/requirements.txt index 74de513f..52128903 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,3 +22,4 @@ fredirc==0.3.0 pdfminer.six==20181108 chardet==3.0.4 phonenumbers==8.10.6 +pre-commit>=1.14.4