From 95f8ee9738073547bd32a18684db96a091372963 Mon Sep 17 00:00:00 2001 From: Troy Dai Date: Wed, 29 Nov 2017 10:18:01 -0800 Subject: [PATCH] Exclude non-converted source code from flake8 --- .flake8 | 25 ++++++++++++++++++- scripts/ci/precheck_pep8.sh | 8 +++--- .../azure/cli/testsdk/base.py | 1 + .../azure/cli/testsdk/preparers.py | 1 - src/azure-cli/azure/cli/__main__.py | 4 ++- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.flake8 b/.flake8 index b916336c5f..be6716961b 100644 --- a/.flake8 +++ b/.flake8 @@ -7,4 +7,27 @@ ignore = F401, # imported but unused, too many violations, to be removed in the future F811, # redefinition of unused, to be removed in the future C901 # code flow is too complex, too many violations, to be removed in the future - +exclude = + azure_bdist_wheel.py + build + tools + scripts + doc + build_scripts + src/command_modules/azure-cli-storage + src/command_modules/azure-cli-keyvault + src/command_modules/azure-cli-lab + src/command_modules/azure-cli-rdbms + src/command_modules/azure-cli-lab + src/command_modules/azure-cli-sql + src/command_modules/azure-cli-vm + src/command_modules/azure-cli-acr + src/command_modules/azure-cli-acs + src/command_modules/azure-cli-batch + src/command_modules/azure-cli-cognitiveservices + src/command_modules/azure-cli-cosmosdb + src/command_modules/azure-cli-dla + src/command_modules/azure-cli-dls + src/command_modules/azure-cli-iot + src/command_modules/azure-cli-monitor + src/azure-cli-testsdk/azure/cli/testsdk/vcr_test_base.py # will eventually be removed diff --git a/scripts/ci/precheck_pep8.sh b/scripts/ci/precheck_pep8.sh index 6f8a6fa090..fafa8a2de2 100755 --- a/scripts/ci/precheck_pep8.sh +++ b/scripts/ci/precheck_pep8.sh @@ -2,12 +2,12 @@ set -e -# build packages -. $(cd $(dirname $0); pwd)/artifacts.sh - # install flake 8 pip install -qqq flake8 echo "Run flake8." -flake8 --statistics --exclude=azure_bdist_wheel.py --append-config=./.flake8 ./src +flake8 --statistics --config=./.flake8 + +# build packages +. $(cd $(dirname $0); pwd)/artifacts.sh diff --git a/src/azure-cli-testsdk/azure/cli/testsdk/base.py b/src/azure-cli-testsdk/azure/cli/testsdk/base.py index 5c437e2063..31623997e9 100644 --- a/src/azure-cli-testsdk/azure/cli/testsdk/base.py +++ b/src/azure-cli-testsdk/azure/cli/testsdk/base.py @@ -26,6 +26,7 @@ from .utilities import find_recording_dir logger = logging.getLogger('azure.cli.testsdk') + class CheckerMixin(object): def _apply_kwargs(self, val): diff --git a/src/azure-cli-testsdk/azure/cli/testsdk/preparers.py b/src/azure-cli-testsdk/azure/cli/testsdk/preparers.py index 13cf9c2e60..af8154cc0e 100644 --- a/src/azure-cli-testsdk/azure/cli/testsdk/preparers.py +++ b/src/azure-cli-testsdk/azure/cli/testsdk/preparers.py @@ -36,7 +36,6 @@ class ResourceGroupPreparer(AbstractPreparer, SingleValueReplacer): return {self.parameter_name: self.dev_setting_name, self.parameter_name_for_location: self.dev_setting_location} - template = 'az group create --location {} --name {} --tag use=az-test' execute(self.cli_ctx, template.format(self.location, name)) self.test_class_instance.kwargs[self.key] = name diff --git a/src/azure-cli/azure/cli/__main__.py b/src/azure-cli/azure/cli/__main__.py index dea8c88cee..7cb5faecef 100644 --- a/src/azure-cli/azure/cli/__main__.py +++ b/src/azure-cli/azure/cli/__main__.py @@ -20,9 +20,11 @@ from knack.log import get_logger logger = get_logger(__name__) + def cli_main(cli, args): return cli.invoke(args) + az_cli = AzCli(cli_name='az', config_dir=GLOBAL_CONFIG_DIR, config_env_var_prefix=ENV_VAR_PREFIX, @@ -38,7 +40,7 @@ try: telemetry.start() exit_code = cli_main(az_cli, sys.argv[1:]) - + if exit_code and exit_code != 0: telemetry.set_failure() else: