Skip to content

Commit

Permalink
Repo fix-up
Browse files Browse the repository at this point in the history
  • Loading branch information
tjprescott committed Jan 11, 2019
1 parent 7a21cb0 commit cbeffdd
Show file tree
Hide file tree
Showing 60 changed files with 439 additions and 277 deletions.
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
max-line-length = 120
max-complexity = 10
ignore =
E126,
E501,
F401,
F811,
C901
21 changes: 21 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[MESSAGES CONTROL]
# For all codes, run 'pylint --list-msgs' or go to 'http://pylint-messages.wikidot.com/all-codes'
# C0103 Invalid %s name "%s"
# I0011 Warning locally suppressed using disable-msg
disable=C0103,I0011,fixme,missing-docstring,too-many-arguments,too-few-public-methods,cyclic-import,useless-object-inheritance,useless-import-alias

# note: This is useful but some pylint suppressions only apply to Python 2 or 3
# and we run pylint on both Python 2 and 3. e.g. You may see some no-member useless-suppression messages.
enable=useless-suppression

[FORMAT]
max-line-length=120

[DESIGN]
# Maximum number of locals for function / method body
max-locals=25
# Maximum number of branch for function / method body
max-branches=20

[SIMILARITIES]
min-similarity-lines=10
21 changes: 21 additions & 0 deletions azdev.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Metadata-Version: 1.2
Name: azdev
Version: 0.0.1
Summary: Azure Developer Tools command line
Home-page: https://github.com/Azure/azure-cli-dev-tools
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT
Description: UNKNOWN
Keywords: azure
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Requires-Python: >=2.7,!=3.4,!=3.3,!=3.2,!=3.1,!=3.0,<=3.8
40 changes: 40 additions & 0 deletions azdev.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
README.md
setup.cfg
setup.py
azdev/__init__.py
azdev/commands.py
azdev/completer.py
azdev/help.py
azdev/params.py
azdev.egg-info/PKG-INFO
azdev.egg-info/SOURCES.txt
azdev.egg-info/dependency_links.txt
azdev.egg-info/entry_points.txt
azdev.egg-info/requires.txt
azdev.egg-info/top_level.txt
azdev/config/__init__.py
azdev/operations/__init__.py
azdev/operations/help.py
azdev/operations/legal.py
azdev/operations/performance.py
azdev/operations/pypi.py
azdev/operations/python_sdk.py
azdev/operations/resource.py
azdev/operations/setup.py
azdev/operations/style.py
azdev/operations/extensions/__init__.py
azdev/operations/extensions/util.py
azdev/operations/linter/__init__.py
azdev/operations/linter/linter.py
azdev/operations/linter/rule_decorators.py
azdev/operations/linter/util.py
azdev/operations/tests/__init__.py
azdev/operations/tests/pytest_runner.py
azdev/utilities/__init__.py
azdev/utilities/command.py
azdev/utilities/config.py
azdev/utilities/const.py
azdev/utilities/display.py
azdev/utilities/path.py
azdev/utilities/pypi.py
azdev/utilities/tools.py
1 change: 1 addition & 0 deletions azdev.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions azdev.egg-info/entry_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[console_scripts]
azdev = azdev:launch

15 changes: 15 additions & 0 deletions azdev.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
docutils
flake8
future
gitpython
knack~=0.5.1
pytest
pytest-xdist
tox
virtualenv

[:python_version<'3.0']
pylint~=1.9.2

[:python_version>='3.0']
pylint~=2.0.0
1 change: 1 addition & 0 deletions azdev.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
azdev
2 changes: 1 addition & 1 deletion src/azdev/__init__.py → azdev/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from azdev.utilities import get_azdev_config_dir


__VERSION__ = "0.1.0"
__VERSION__ = "0.0.1"


class AzDevCli(CLI):
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions src/azdev/commands.py → azdev/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from knack.commands import CommandGroup


def load_command_table(self, args):
def load_command_table(self, _):

def operation_group(name):
return 'azdev.operations.{}#{{}}'.format(name)
Expand All @@ -27,7 +27,6 @@ def operation_group(name):

with CommandGroup(self, 'verify', operation_group('pypi')) as g:
g.command('history', 'check_history')
#g.command('version', 'check_versions')
g.command('version', 'verify_versions')

with CommandGroup(self, 'verify', operation_group('help')) as g:
Expand Down
2 changes: 1 addition & 1 deletion src/azdev/completer.py → azdev/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# license information.
# -----------------------------------------------------------------------------


# TODO: import from Knack once it is moved
# pylint: disable=too-few-public-methods
class Completer(object):
Expand All @@ -22,4 +23,3 @@ def __call__(self, **kwargs):
def get_test_completion(cmd, prefix, namespace, **kwargs): # pylint: disable=unused-argument
# TODO: return the list of keys from the index
return ['storage', 'network', 'redis']

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/azdev/help.py → azdev/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# license information.
# -----------------------------------------------------------------------------

from knack.help_files import helps # pylint: disable=unused-import
from knack.help_files import helps


helps[''] = """
Expand Down Expand Up @@ -76,7 +76,7 @@


helps['verify history'] = """
short-summary: Verify the README and HISTORY files for each module so they format correctly on PyPI.
short-summary: Verify the README and HISTORY files for each module so they format correctly on PyPI.
"""


Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# --------------------------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------

from collections import OrderedDict
import os
import shutil

from azdev.utilities import (
pip_cmd, display, get_ext_repo_paths, find_files, get_azure_config, get_env_config)

from knack.log import get_logger
from knack.util import CLIError

from azdev.utilities import (
pip_cmd, display, get_ext_repo_paths, find_files, get_azure_config, get_env_config)

logger = get_logger(__name__)


Expand All @@ -22,7 +23,6 @@ def add_extension(extensions):

paths_to_add = []
for path in all_extensions:
target_path = None
folder = os.path.dirname(path)
long_name = os.path.basename(folder)
if long_name in extensions:
Expand All @@ -45,7 +45,6 @@ def remove_extension(extensions):
paths_to_remove = []
names_to_remove = []
for path in installed_paths:
target_path = None
folder = os.path.dirname(path)
long_name = os.path.basename(folder)
if long_name in extensions:
Expand Down Expand Up @@ -183,7 +182,7 @@ def update_extension_index(extension):
whl_cache = {}
ext_file = get_whl_from_url(whl_path, extension_name, whl_cache_dir, whl_cache)

with open(os.join(ext_path, 'src', 'index.json'), 'r') as infile:
with open(os.path.join(ext_path, 'src', 'index.json'), 'r') as infile:
curr_index = json.loads(infile.read())

try:
Expand All @@ -198,5 +197,5 @@ def update_extension_index(extension):

# update index and write back to file
curr_index['extensions'][extension_name] = entry
with open(os.join(ext_path, 'src', 'index.json'), 'w') as outfile:
with open(os.path.ßjoin(ext_path, 'src', 'index.json'), 'w') as outfile:
outfile.write(json.dumps(curr_index, indent=4, sort_keys=True))
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# --------------------------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------

import os
import json
Expand Down
1 change: 0 additions & 1 deletion src/azdev/operations/help.py → azdev/operations/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from __future__ import print_function

import os
import sys
import json

from knack.util import CLIError
Expand Down
8 changes: 4 additions & 4 deletions src/azdev/operations/legal.py → azdev/operations/legal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
# license information.
# -----------------------------------------------------------------------------

import sys
import os

from knack.util import CLIError

from azdev.utilities import (
display, heading, subheading, get_cli_repo_path)

from knack.util import CLIError


LICENSE_HEADER = """# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -42,5 +41,6 @@ def check_license_headers():

subheading('Results')
if files_without_header:
raise CLIError("{}\nError: {} files don't have the required license headers.".format('\n'.join(files_without_header), len(files_without_header)))
raise CLIError("{}\nError: {} files don't have the required license headers.".format(
'\n'.join(files_without_header), len(files_without_header)))
display('License headers verified OK.')
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# --------------------------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------

import os
import sys
Expand All @@ -23,6 +24,7 @@
logger = get_logger(__name__)


# pylint:disable=too-many-locals
def run_linter(modules=None, rule_types=None, rules=None, ci_mode=False):
from azure.cli.core import get_default_cli
from azure.cli.core.file_util import (
Expand All @@ -35,8 +37,10 @@ def run_linter(modules=None, rule_types=None, rules=None, ci_mode=False):
exclusions = {}
path_table = get_path_table(include_only=modules)

selected_mod_names = list(path_table['mod'].keys()) + list(path_table['core'].keys()) + list(path_table['ext'].keys())
selected_mod_paths = list(path_table['mod'].values()) + list(path_table['core'].values()) + list(path_table['ext'].values())
selected_mod_names = list(path_table['mod'].keys()) + list(path_table['core'].keys()) + \
list(path_table['ext'].keys())
selected_mod_paths = list(path_table['mod'].values()) + list(path_table['core'].values()) + \
list(path_table['ext'].values())

# collect all rule exclusions
for path in selected_mod_paths:
Expand Down Expand Up @@ -83,7 +87,8 @@ def run_linter(modules=None, rule_types=None, rules=None, ci_mode=False):
rule_inclusions=rules)

subheading('Results')
logger.info('Running linter: %i commands, %i help entries', len(command_loader.command_table), len(help_file_entries))
logger.info('Running linter: %i commands, %i help entries',
len(command_loader.command_table), len(help_file_entries))
exit_code = linter_manager.run(
run_params=not rule_types or 'params' in rule_types,
run_commands=not rule_types or 'commands' in rule_types,
Expand Down
Loading

0 comments on commit cbeffdd

Please sign in to comment.