From dec2735fbbd999bcaa595bedc7d9d34a11dcfb95 Mon Sep 17 00:00:00 2001 From: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com> Date: Sat, 28 Nov 2020 13:01:13 +0530 Subject: [PATCH 1/6] Update CONTRIBUTING.md --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eedcb0250169..c298b3ea2534 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -74,6 +74,13 @@ We want your work to be readable by others; therefore, we encourage you to note pip3 install flake8 # only required the first time flake8 . --ignore=E203,W503 --max-line-length=88 --show-source ``` +- All submissions will also have to pass **pre-commit**, this ensures that your code is perfectly formatted and does not have any trailing whitespaces, has empty line at the file ending. You can try this anytime between the pull request or before the pull request locally (This fixes most of the automated tests). + + ```bash + pip3 install pre-commit # only required the first time + pre-commit install + pre-commit run -a # This might show you that it failed but actually it didn't + ``` - Original code submission require docstrings or comments to describe your work. From 3ea402ba34e45fb3ff4a7426809bf2ae4c1aad44 Mon Sep 17 00:00:00 2001 From: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com> Date: Sat, 28 Nov 2020 15:20:59 +0530 Subject: [PATCH 2/6] Update CONTRIBUTING.md --- CONTRIBUTING.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c298b3ea2534..55c07431bd48 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,6 +48,14 @@ Algorithms should: * return all calculation results instead of printing or plotting them Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages but each algorithm in this repo should add unique value. +#### Pre-commit plugin +To forget about coding style, let [pre-commit](https://pre-commit.com/#installation) fix your `flake8`/`black`/`isort` issue. + +```bash +pip3 install pre-commit # required only once +pre-commit install +pre-commit run -a # this might show you that it failed but actually it didn't +``` #### Coding Style @@ -74,13 +82,6 @@ We want your work to be readable by others; therefore, we encourage you to note pip3 install flake8 # only required the first time flake8 . --ignore=E203,W503 --max-line-length=88 --show-source ``` -- All submissions will also have to pass **pre-commit**, this ensures that your code is perfectly formatted and does not have any trailing whitespaces, has empty line at the file ending. You can try this anytime between the pull request or before the pull request locally (This fixes most of the automated tests). - - ```bash - pip3 install pre-commit # only required the first time - pre-commit install - pre-commit run -a # This might show you that it failed but actually it didn't - ``` - Original code submission require docstrings or comments to describe your work. From b28c53c2708718186cd441b90e65a5455e06a4d0 Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Sat, 28 Nov 2020 17:41:23 +0530 Subject: [PATCH 3/6] Update CONTRIBUTING.md --- CONTRIBUTING.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 55c07431bd48..d1ee006a8265 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,13 +48,18 @@ Algorithms should: * return all calculation results instead of printing or plotting them Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages but each algorithm in this repo should add unique value. + #### Pre-commit plugin -To forget about coding style, let [pre-commit](https://pre-commit.com/#installation) fix your `flake8`/`black`/`isort` issue. +To forget about coding style, let [pre-commit](https://pre-commit.com/#installation) fix your formatting issues. ```bash -pip3 install pre-commit # required only once +pip3 install pre-commit # required only once pre-commit install -pre-commit run -a # this might show you that it failed but actually it didn't +``` +That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes. You can even run the plugin manually on all files: + +```bash +pre-commit run --all-files --show-diff-on-failure ``` #### Coding Style From 87c83515641d269b27b0f5dad26eee7f68bfea83 Mon Sep 17 00:00:00 2001 From: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com> Date: Sat, 28 Nov 2020 19:01:11 +0530 Subject: [PATCH 4/6] Update CONTRIBUTING.md Co-authored-by: Christian Clauss --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d1ee006a8265..035053aec289 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,7 @@ Algorithms in this repo should not be how-to examples for existing Python packag To forget about coding style, let [pre-commit](https://pre-commit.com/#installation) fix your formatting issues. ```bash -pip3 install pre-commit # required only once +python3 -m pip install pre-commit # required only once pre-commit install ``` That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes. You can even run the plugin manually on all files: From ad7e31084abdb2a605aaab6866a578841fabdc61 Mon Sep 17 00:00:00 2001 From: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com> Date: Sat, 28 Nov 2020 19:01:36 +0530 Subject: [PATCH 5/6] Update CONTRIBUTING.md Co-authored-by: Christian Clauss --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 035053aec289..e6b094aa1416 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,7 +50,7 @@ Algorithms should: Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages but each algorithm in this repo should add unique value. #### Pre-commit plugin -To forget about coding style, let [pre-commit](https://pre-commit.com/#installation) fix your formatting issues. +Use [pre-commit](https://pre-commit.com/#installation) to automatically format you code to match our coding style, ```bash python3 -m pip install pre-commit # required only once From b947e1ea9b82a31c0f3db8d84dfc0b8c4ccb152c Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Sat, 28 Nov 2020 19:04:30 +0530 Subject: [PATCH 6/6] Update CONTRIBUTING.md --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6b094aa1416..e4c81a5ecd98 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,7 +50,7 @@ Algorithms should: Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values. Those calculations or manipulations can use data types, classes, or functions of existing Python packages but each algorithm in this repo should add unique value. #### Pre-commit plugin -Use [pre-commit](https://pre-commit.com/#installation) to automatically format you code to match our coding style, +Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style: ```bash python3 -m pip install pre-commit # required only once @@ -77,14 +77,14 @@ We want your work to be readable by others; therefore, we encourage you to note - Please consider running [__psf/black__](https://github.com/python/black) on your Python file(s) before submitting your pull request. This is not yet a requirement but it does make your code more readable and automatically aligns it with much of [PEP 8](https://www.python.org/dev/peps/pep-0008/). There are other code formatters (autopep8, yapf) but the __black__ formatter is now hosted by the Python Software Foundation. To use it, ```bash - pip3 install black # only required the first time + python3 -m pip install black # only required the first time black . ``` - All submissions will need to pass the test __flake8 . --ignore=E203,W503 --max-line-length=88__ before they will be accepted so if possible, try this test locally on your Python file(s) before submitting your pull request. ```bash - pip3 install flake8 # only required the first time + python3 -m pip install flake8 # only required the first time flake8 . --ignore=E203,W503 --max-line-length=88 --show-source ```