Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
384 stars 1.25k forks source link

I tried running `azdev style <YOUR_EXT>` in a codespace, but it crashes. #6794

Open jessehouwing opened 1 year ago

jessehouwing commented 1 year ago

I tried running azdev style <YOUR_EXT> in the codespace, but it crashes.

@jessehouwing ➜ /workspaces/azure-cli-extensions (patch-1) $ azdev style init
Traceback (most recent call last):
  File "/home/codespace/.python/current/bin/azdev", line 8, in <module>
    sys.exit(main())
  File "/usr/local/python/3.10.8/lib/python3.10/site-packages/azdev/__main__.py", line 39, in main
    config_dir=get_azdev_config_dir())
  File "/usr/local/python/3.10.8/lib/python3.10/site-packages/azdev/utilities/config.py", line 24, in get_azdev_config_dir
    _, env_name = os.path.splitdrive(get_env_path())
  File "/usr/local/python/3.10.8/lib/python3.10/posixpath.py", line 134, in splitdrive
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

had to run pip install azdev, it would be nice if the default codespace config for this repo included azdev by default.

Originally posted by @jessehouwing in https://github.com/Azure/azure-cli-extensions/issues/6793#issuecomment-1730091737

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

jessehouwing commented 1 year ago

I tried reproducing the steps to sucessfully built the repo, but failed. I got beyond this error by this specific error, but now it can't find azure-cli. I'd love a devcontainer.json that will be able to build the extensions inside this repo upon launch.

jessehouwing commented 1 year ago

Ok, I got a bit further, but still encounter all kind sof strange errors left and right.

what I did so far, and this should really be part of the devcontainer.json

cd /workspaces
git clone https://github.com/Azure/azure-cli.git azure-cli
python3 -m venv env
source env/bin/activate
python -m pip install -U pip
pip install azdev
azdev setup --cli ./azure-cli --repo ./azure-cli-extensions

and then to scan my changes to the init extension:

azdev extension add init
azdev style init

************* Module /workspaces/azure-cli-extensions/pylintrc
azure-cli-extensions/pylintrc:1:0: E0015: Unrecognized option found: module-name-hint, const-name-hint, class-name-hint, class-attribute-name-hint, attr-name-hint, method-name-hint, function-name-hint, argument-name-hint, variable-name-hint, inlinevar-name-hint (unrecognized-option)
************* Module azext_init
azure-cli-extensions/src/init/azext_init/__init__.py:17:8: R1725: Consider using Python 3 style super() without arguments (super-with-arguments)
************* Module azext_init._utils
azure-cli-extensions/src/init/azext_init/_utils.py:37:43: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/_utils.py:72:49: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/_utils.py:74:49: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
************* Module azext_init.custom
azure-cli-extensions/src/init/azext_init/custom.py:57:43: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/custom.py:59:71: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/custom.py:76:43: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/custom.py:79:71: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/custom.py:115:42: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/custom.py:116:42: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/custom.py:133:54: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/custom.py:182:42: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
azure-cli-extensions/src/init/azext_init/custom.py:189:27: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)

------------------------------------------------------------------
Your code has been rated at 9.42/10 (previous run: 9.42/10, +0.00)

Pylint: FAILED

Running flake8 on extensions...
Traceback (most recent call last):
  File "/home/codespace/.python/current/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/codespace/.python/current/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/workspaces/env/lib/python3.10/site-packages/flake8/__main__.py", line 7, in <module>
    raise SystemExit(main())
  File "/workspaces/env/lib/python3.10/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "/workspaces/env/lib/python3.10/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "/workspaces/env/lib/python3.10/site-packages/flake8/main/application.py", line 186, in _run
    self.initialize(argv)
  File "/workspaces/env/lib/python3.10/site-packages/flake8/main/application.py", line 165, in initialize
    self.plugins, self.options = parse_args(argv)
  File "/workspaces/env/lib/python3.10/site-packages/flake8/options/parse_args.py", line 53, in parse_args
    opts = aggregator.aggregate_options(option_manager, cfg, cfg_dir, rest)
  File "/workspaces/env/lib/python3.10/site-packages/flake8/options/aggregator.py", line 30, in aggregate_options
    parsed_config = config.parse_config(manager, cfg, cfg_dir)
  File "/workspaces/env/lib/python3.10/site-packages/flake8/options/config.py", line 131, in parse_config
    raise ValueError(
ValueError: Error code '#' supplied to 'ignore' option does not match '^[A-Z]{1,3}[0-9]{0,3}$'

Flake8: FAILED
wangzelin007 commented 1 year ago

Hi @jessehouwing Sorry for replying so late. I have been so busy recently that I just took the time to look into this issue today. Next I will delve into codespace and plan to add support for the Azure CLI repository and the Azure CLI extension repository.