From 70de28589a1b00bf6b6712ba228797257eca0015 Mon Sep 17 00:00:00 2001 From: Ivar Stangeby Date: Mon, 3 May 2021 18:44:08 +0200 Subject: [PATCH 1/4] Added mypy --- .pre-commit-config.yaml | 27 +++++++++++++++++++++++++++ README.md | 17 ++++------------- 2 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..807a2f0d709 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,27 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/psf/black + rev: 21.4b2 + hooks: + - id: black + - repo: https://github.com/pycqa/flake8 + rev: 3.9.1 + hooks: + - id: flake8 + entry: flake8 --max-line-length=122 --ignore=E203,W503 + - repo: https://github.com/codespell-project/codespell + rev: v2.0.0 + hooks: + - id: codespell + entry: codespell + args: [ '--ignore-words-list="mape","ba","hist"', '--quiet-level=2', '--skip=".git,*.yaml,*.json,./tests"' ] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: 'v0.812' + hooks: + - id: mypy + args: [--ignore-missing-imports] diff --git a/README.md b/README.md index 3b4ae343c73..b96f9fc3dcc 100644 --- a/README.md +++ b/README.md @@ -88,8 +88,6 @@ As a modern Python-based environment, GamestonkTerminal opens access to numerous ## Getting Started ### Install -If you'd like to see a video recording of the installation process, @JohnnyDankseed has made one available [here](https://www.twitch.tv/videos/1008414642). - This project was originally written and tested with Python 3.6.8. It should now support Python 3.6, 3.7, and 3.8. Our current recommendation is to use this project with Anaconda's Python distribution - either full [__Anaconda3 Latest__](https://repo.anaconda.com/archive/) or [__Miniconda3 Latest__](https://repo.anaconda.com/archive/). Several features in this project utilize Machine Learning. Machine Learning Python dependencies are optional. If you decided to add Machine Learning features at a later point, you will likely have better user experience with Anaconda's Python distribution. @@ -145,8 +143,6 @@ conda activate gst ``` *The `conda deactivate` -> `conda activate` in the middle is on purpose, this is sometimes required to avoid issues with poetry* -7.2. If on Windows, install/update Microsoft C++ Build Tools from here: https://visualstudio.microsoft.com/visual-cpp-build-tools/ - 8. Install poetry dependencies ``` poetry install @@ -160,7 +156,7 @@ python terminal.py ``` 10. (Windows - Optional) Speeding up opening process in the future -After you've installed Gamestonk Terminal, you'll find a file named "Gamestonk Terminal.bat". You can use this file to open Gamestonk Terminal quicker. This file can be moved to your desktop if you'd like. If you run into issues while trying to run the batch file. If you run into issues with the batch files, edit the file and check to see if the directories match up. This file assumes you used the default directories when installing. +After you've installed Gamestonk Terminal, you'll find a file named "Gamestonk Terminal.bat". You can use this file to open Gamestonk Terminal quicker. This file can be moved to your desktop if you'd like. If you run into issues while trying to run the batch file. If you run into issues with the batch files, edit the file and check to see if the directories match up. This file assumes you used the default directories when installing. **NOTE:** When you close the terminal and re-open it, the only command you need to re-call is `conda activate gst` before you call `python terminal.py` again. @@ -228,9 +224,6 @@ These are the ones where a key is necessary: * News API: https://newsapi.org * Tradier: https://developer.tradier.com/getting_started * Oanda API: https://developer.oanda.com - * CoinMarketCap API: https://coinmarketcap.com/api/ - * Finhub API: https://finnhub.io - * Binance: https://binance.us (US) / https://binance.com (Outside US) When these are obtained, don't forget to update [config_terminal.py](/gamestonk_terminal/config_terminal.py). @@ -299,9 +292,9 @@ Recommended if you bought the dip, and the share price keeps dipping. You may as 1. Fork the Project 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) -4. Appease the linters and commit again if needed - 1. Install and run `black` for every change you've made - 2. Install and run `flake8` for every change you've made. `flake8 . --count --ignore=E203,W503 --max-line-length=122 --show-source --statistics` +4. Install the pre-commit hooks by running: + ```pre-commit install```. + Any time you commit a change, linters will be run automatically. On changes, you will have to re-commit. 5. Push to your Branch (`git push origin feature/AmazingFeature`) 6. Open a Pull Request @@ -333,8 +326,6 @@ Distributed under the MIT License. See [LICENSE](https://github.com/DidierRLopes "A few things I am not. I am not a cat. I am not an institutional investor, nor am I a hedge fund. I do not have clients and I do not provide personalized investment advice for fees or commissions." DFV -Trading in financial instruments involves high risks including the risk of losing some, or all, of your investment amount, and may not be suitable for all investors. Before deciding to trade in financial instrument you should be fully informed of the risks and costs associated with trading the financial markets, carefully consider your investment objectives, level of experience, and risk appetite, and seek professional advice where needed. The data contained in GST is not necessarily accurate. GST and any provider of the data contained in this website will not accept liability for any loss or damage as a result of your trading, or your reliance on the information displayed. - ## Contacts [Didier Rodrigues Lopes](https://www.linkedin.com/in/didier-lopes/) - dro.lopes@campus.fct.unl.pt From 9cc09158712eb99d4efc039b0a3f1a9374cb21b4 Mon Sep 17 00:00:00 2001 From: Ivar Stangeby Date: Mon, 3 May 2021 18:50:01 +0200 Subject: [PATCH 2/4] Added pylint --- .pre-commit-config.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 807a2f0d709..27bb06d6fac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,4 +24,9 @@ repos: rev: 'v0.812' hooks: - id: mypy - args: [--ignore-missing-imports] + args: [ --ignore-missing-imports ] + - repo: https://github.com/pre-commit/mirrors-pylint + rev: 'v3.0.0a3' + hooks: + - id: pylint + entry: pylint terminal.py gamestonk_terminal tests From 43806015d5588dc651834b26af76ce9d6b2bc0dc Mon Sep 17 00:00:00 2001 From: Ivar Stangeby Date: Mon, 3 May 2021 18:56:30 +0200 Subject: [PATCH 3/4] Added detect-secrets as pre-commit hook. Scanned the repository for a secrets baseline. --- .pre-commit-config.yaml | 8 +++- .secrets.baseline | 103 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 .secrets.baseline diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27bb06d6fac..29a1f38c2d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,13 @@ repos: - id: mypy args: [ --ignore-missing-imports ] - repo: https://github.com/pre-commit/mirrors-pylint - rev: 'v3.0.0a3' + rev: 'v3.0.0a3' hooks: - id: pylint entry: pylint terminal.py gamestonk_terminal tests + - repo: https://github.com/Yelp/detect-secrets + rev: v1.1.0 + hooks: + - id: detect-secrets + args: [ '--baseline', '.secrets.baseline' ] + exclude: package.lock.json diff --git a/.secrets.baseline b/.secrets.baseline new file mode 100644 index 00000000000..10a1fe2c470 --- /dev/null +++ b/.secrets.baseline @@ -0,0 +1,103 @@ +{ + "version": "1.1.0", + "plugins_used": [ + { + "name": "ArtifactoryDetector" + }, + { + "name": "AWSKeyDetector" + }, + { + "name": "AzureStorageKeyDetector" + }, + { + "name": "Base64HighEntropyString", + "limit": 4.5 + }, + { + "name": "BasicAuthDetector" + }, + { + "name": "CloudantDetector" + }, + { + "name": "HexHighEntropyString", + "limit": 3.0 + }, + { + "name": "IbmCloudIamDetector" + }, + { + "name": "IbmCosHmacDetector" + }, + { + "name": "JwtTokenDetector" + }, + { + "name": "KeywordDetector", + "keyword_exclude": "" + }, + { + "name": "MailchimpDetector" + }, + { + "name": "NpmDetector" + }, + { + "name": "PrivateKeyDetector" + }, + { + "name": "SlackDetector" + }, + { + "name": "SoftlayerDetector" + }, + { + "name": "SquareOAuthDetector" + }, + { + "name": "StripeDetector" + }, + { + "name": "TwilioKeyDetector" + } + ], + "filters_used": [ + { + "path": "detect_secrets.filters.allowlist.is_line_allowlisted" + }, + { + "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies", + "min_level": 2 + }, + { + "path": "detect_secrets.filters.heuristic.is_indirect_reference" + }, + { + "path": "detect_secrets.filters.heuristic.is_likely_id_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_lock_file" + }, + { + "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_potential_uuid" + }, + { + "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign" + }, + { + "path": "detect_secrets.filters.heuristic.is_sequential_string" + }, + { + "path": "detect_secrets.filters.heuristic.is_swagger_file" + }, + { + "path": "detect_secrets.filters.heuristic.is_templated_secret" + } + ], + "results": {}, + "generated_at": "2021-05-03T16:53:30Z" +} From 376d7f39b2f62e82bc1155e3de83deb2ac65a2c4 Mon Sep 17 00:00:00 2001 From: Ivar Stangeby Date: Mon, 3 May 2021 19:10:30 +0200 Subject: [PATCH 4/4] Fixed README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index b96f9fc3dcc..496050b2059 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ As a modern Python-based environment, GamestonkTerminal opens access to numerous ## Getting Started ### Install +If you'd like to see a video recording of the installation process, @JohnnyDankseed has made one available [here](https://www.twitch.tv/videos/1008414642). + This project was originally written and tested with Python 3.6.8. It should now support Python 3.6, 3.7, and 3.8. Our current recommendation is to use this project with Anaconda's Python distribution - either full [__Anaconda3 Latest__](https://repo.anaconda.com/archive/) or [__Miniconda3 Latest__](https://repo.anaconda.com/archive/). Several features in this project utilize Machine Learning. Machine Learning Python dependencies are optional. If you decided to add Machine Learning features at a later point, you will likely have better user experience with Anaconda's Python distribution. @@ -143,6 +145,8 @@ conda activate gst ``` *The `conda deactivate` -> `conda activate` in the middle is on purpose, this is sometimes required to avoid issues with poetry* +7.2. If on Windows, install/update Microsoft C++ Build Tools from here: https://visualstudio.microsoft.com/visual-cpp-build-tools/ + 8. Install poetry dependencies ``` poetry install @@ -224,6 +228,9 @@ These are the ones where a key is necessary: * News API: https://newsapi.org * Tradier: https://developer.tradier.com/getting_started * Oanda API: https://developer.oanda.com + * CoinMarketCap API: https://coinmarketcap.com/api/ + * Finhub API: https://finnhub.io + * Binance: https://binance.us (US) / https://binance.com (Outside US) When these are obtained, don't forget to update [config_terminal.py](/gamestonk_terminal/config_terminal.py). @@ -326,6 +333,8 @@ Distributed under the MIT License. See [LICENSE](https://github.com/DidierRLopes "A few things I am not. I am not a cat. I am not an institutional investor, nor am I a hedge fund. I do not have clients and I do not provide personalized investment advice for fees or commissions." DFV +Trading in financial instruments involves high risks including the risk of losing some, or all, of your investment amount, and may not be suitable for all investors. Before deciding to trade in financial instrument you should be fully informed of the risks and costs associated with trading the financial markets, carefully consider your investment objectives, level of experience, and risk appetite, and seek professional advice where needed. The data contained in GST is not necessarily accurate. GST and any provider of the data contained in this website will not accept liability for any loss or damage as a result of your trading, or your reliance on the information displayed. + ## Contacts [Didier Rodrigues Lopes](https://www.linkedin.com/in/didier-lopes/) - dro.lopes@campus.fct.unl.pt