Closed VakarisZ closed 3 years ago
Powershell script which could be a good start:
Push-Location -Path C:\Users\Vakaris\Desktop\infection_monkey
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude=monkey/common/cloud/scoutsuite
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=monkey/common/cloud/scoutsuite >> .\flake8_warnings.txt
Get-Content -Path .\flake8_warnings.txt
$PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT = 80
if ((Get-Item -Path .\flake8_warnings.txt | Get-Content -Tail 1) -gt $PYTHON_WARNINGS_AMOUNT_UPPER_LIMIT){
"Too many python linter warnings! Failing this build. Lower the amount of linter errors in this and try again. "
exit
}
python -m isort . -c -p common -p infection_monkey -p monkey_island --skip ./monkey/common/cloud/scoutsuite --skip ./monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_path_building/rule_path_creators_list.py --skip ./monkey/monkey_island/cc/ui -l 120 --wl 120
python -m isort . -p common -p infection_monkey -p monkey_island --skip ./monkey/common/cloud/scoutsuite --skip ./monkey/monkey_island/cc/services/zero_trust/scoutsuite/data_parsing/rule_path_building/rule_path_creators_list.py --skip ./monkey/monkey_island/cc/ui -l 120 --wl 120
python monkey_island/cc/environment/set_server_config.py testing
python -m pytest
Push-Location -Path .\monkey_island\cc\ui
eslint ./src -c ./.eslintrc
Pop-Location
Pop-Location
After we have the script working nicely, we should consider using git hooks to run the script automatically
After we have the script working nicely, we should consider using git hooks to run the script automatically
Have we considered using pre-commit?
Is your feature request related to a problem? Please describe. We should have an interactive validation script, that checks current codebase, shows warnings/errors and helps developer to fix them.
Describe the solution you'd like The interactive script should run the same validators travis runs: