-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up static code analysis and unit tests
This commit introduces static code analysis and unit tests to ensure code quality and catch potential errors early. The following changes have been made: 1. **Static Code Analysis**: - Integrated `pylint`, `flake8`, and `mypy` to analyze the code for potential errors and style issues. - Configured the tools to run on the following directories and files: - `BuyingModule/` - `DaoModule/` - `EmailModule/` - `ScraperModule/` - `TimeModule/` - `TokenManagementModule/` - `UI_Module/` - `main.py` - `transactions.py` - `test.py` 2. **Unit Tests**: - Added new unit tests in `test.py` to cover untested parts of the codebase using `pytest`. 3. **Continuous Integration (CI)**: - Set up a CI pipeline using GitHub Actions to automatically run static code analysis and unit tests on every push and pull request. - Example GitHub Actions workflow configuration added in `.github/workflows/ci.yml`. Additional configuration files: - `.pylintrc` for `pylint` settings. - `setup.cfg` for `flake8` and `mypy` settings. - Updated `requirements.txt` to include `pylint`, `flake8`, `mypy`, and `pytest`.
- Loading branch information
1 parent
7c7e7d0
commit c289a3f
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Static Code Analysis with pylint | ||
run: | | ||
pylint BuyingModule/ DaoModule/ EmailModule/ ScraperModule/ TimeModule/ TokenManagementModule/ UI_Module/ main.py transactions.py | ||
- name: Static Code Analysis with flake8 | ||
run: | | ||
flake8 BuyingModule/ DaoModule/ EmailModule/ ScraperModule/ TimeModule/ TokenManagementModule/ UI_Module/ main.py transactions.py | ||
- name: Static Type Checking with mypy | ||
run: | | ||
mypy BuyingModule/ DaoModule/ EmailModule/ ScraperModule/ TimeModule/ TokenManagementModule/ UI_Module/ main.py transactions.py | ||
- name: Run Unit Tests | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[MASTER] | ||
ignore=venv | ||
max-line-length=100 | ||
|
||
[MESSAGES CONTROL] | ||
disable=C0114,C0115,C0116 # Disable missing module, class, function docstrings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[flake8] | ||
max-line-length = 100 | ||
exclude = venv,.git,__pycache__ | ||
|
||
[mypy] | ||
python_version = 3.8 | ||
disallow_untyped_calls = True | ||
disallow_untyped_defs = True | ||
ignore_missing_imports = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,19 @@ | |
# print(values) | ||
|
||
# receiver = Receiver() | ||
# receiver.receive_data([{"login": "[email protected]", "password": "TestTest123$"}], [1,], buy_nft) | ||
# receiver.receive_data([{"login": "[email protected]", "password": "TestTest123$"}], [1,], buy_nft) | ||
|
||
import pytest | ||
|
||
@pytest.fixture | ||
def setup(): | ||
# Setup code if necessary | ||
pass | ||
|
||
def test_buy_transaction(): | ||
# Implement test for WaxBloksIoTransactions.buy | ||
assert True # Replace with actual assertions | ||
|
||
def test_deposit_transaction(): | ||
# Implement test for WaxBloksIoTransactions.deposit | ||
assert True # Replace with actual assertions |