Skip to content

Commit 0421019

Browse files
author
Jianhui Harold
authored
{CI} Use azdev to honor local pylint and flake8 configuration (Azure#14402)
* found code style errors * fix useless-object-inheritance * found code style errors * fix wrong-import-order * fix chained-comparison * typo * remove install azdev from master * typo
1 parent 29d2a9e commit 0421019

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+138
-118
lines changed

pylintrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ reports=no
77
# locally-disabled: Warning locally suppressed using disable-msg
88
# cyclic-import: because of https://github.com/PyCQA/pylint/issues/850
99
# too-many-arguments: Due to the nature of the CLI many commands have large arguments set which reflect in large arguments set in corresponding methods.
10-
disable=missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code
10+
disable=
11+
missing-docstring,
12+
locally-disabled,
13+
fixme,
14+
cyclic-import,
15+
too-many-arguments,
16+
invalid-name,
17+
duplicate-code
1118

1219
[FORMAT]
1320
max-line-length=120

src/azure-cli-core/azure/cli/core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def invalidate(self):
579579
logger.debug("Command index has been invalidated.")
580580

581581

582-
class ModExtensionSuppress(object): # pylint: disable=too-few-public-methods
582+
class ModExtensionSuppress: # pylint: disable=too-few-public-methods
583583

584584
def __init__(self, mod_name, suppress_extension_name, suppress_up_to_version, reason=None, recommend_remove=False,
585585
recommend_update=False):

src/azure-cli-core/azure/cli/core/_help_loaders.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55

66
import abc
77
import os
8-
import yaml
98

109
from azure.cli.core._help import (HelpExample, CliHelpFile)
1110

1211
from knack.util import CLIError
1312
from knack.log import get_logger
1413

14+
import yaml
15+
1516
logger = get_logger(__name__)
1617

1718
try:
@@ -93,7 +94,7 @@ def _update_help_obj_params(help_obj, data_params, params_equal, attr_key_tups):
9394
help_obj.parameters = loaded_params
9495

9596

96-
class YamlLoaderMixin(object): # pylint:disable=too-few-public-methods
97+
class YamlLoaderMixin: # pylint:disable=too-few-public-methods
9798
"""A class containing helper methods for Yaml Loaders."""
9899

99100
# get the list of yaml help file names for the command or group

src/azure-cli-core/azure/cli/core/_profile.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
from copy import deepcopy
1616
from enum import Enum
1717

18+
from knack.log import get_logger
19+
from knack.util import CLIError
20+
1821
from azure.cli.core._environment import get_config_dir
1922
from azure.cli.core._session import ACCOUNT
2023
from azure.cli.core.util import get_file_json, in_cloud_console, open_page_in_browser, can_launch_browser,\
2124
is_windows, is_wsl
2225
from azure.cli.core.cloud import get_active_cloud, set_cloud_subscription
2326

24-
from knack.log import get_logger
25-
from knack.util import CLIError
2627

2728
logger = get_logger(__name__)
2829

@@ -139,7 +140,7 @@ def _get_cloud_console_token_endpoint():
139140

140141

141142
# pylint: disable=too-many-lines,too-many-instance-attributes
142-
class Profile(object):
143+
class Profile:
143144

144145
_global_creds_cache = None
145146

@@ -759,7 +760,7 @@ def get_installation_id(self):
759760
return installation_id
760761

761762

762-
class MsiAccountTypes(object):
763+
class MsiAccountTypes:
763764
# pylint: disable=no-method-argument,no-self-argument
764765
system_assigned = 'MSI'
765766
user_assigned_client_id = 'MSIClient'
@@ -785,7 +786,7 @@ def msi_auth_factory(cli_account_name, identity, resource):
785786
raise ValueError("unrecognized msi account name '{}'".format(cli_account_name))
786787

787788

788-
class SubscriptionFinder(object):
789+
class SubscriptionFinder:
789790
'''finds all subscriptions for a user or service principal'''
790791

791792
def __init__(self, cli_ctx, auth_context_factory, adal_token_cache, arm_client_factory=None):
@@ -970,7 +971,7 @@ def _find_using_specific_tenant(self, tenant, access_token):
970971
return all_subscriptions
971972

972973

973-
class CredsCache(object):
974+
class CredsCache:
974975
'''Caches AAD tokena and service principal secrets, and persistence will
975976
also be handled
976977
'''
@@ -1128,7 +1129,7 @@ def remove_all_cached_creds(self):
11281129
_delete_file(self._token_file)
11291130

11301131

1131-
class ServicePrincipalAuth(object):
1132+
class ServicePrincipalAuth:
11321133

11331134
def __init__(self, password_arg_value, use_cert_sn_issuer=None):
11341135
if not password_arg_value:

src/azure-cli-core/azure/cli/core/azlogging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def end_cmd_metadata_logging(self, exit_code): # leave it non '-' prefix to not
191191
self.command_metadata_logger = None
192192

193193

194-
class CommandLoggerContext(object):
194+
class CommandLoggerContext:
195195
def __init__(self, module_logger):
196196
self.logger = module_logger
197197
self.hdlr = logging.getLogger(AzCliLogging._COMMAND_METADATA_LOGGER) # pylint: disable=protected-access

src/azure-cli-core/azure/cli/core/cloud.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class CloudSuffixNotSetException(CLIError):
5353
pass
5454

5555

56-
class CloudEndpoints(object): # pylint: disable=too-few-public-methods,too-many-instance-attributes
56+
class CloudEndpoints: # pylint: disable=too-few-public-methods,too-many-instance-attributes
5757

5858
def __init__(self,
5959
management=None,
@@ -110,7 +110,7 @@ def __getattribute__(self, name):
110110
return val
111111

112112

113-
class CloudSuffixes(object): # pylint: disable=too-few-public-methods,too-many-instance-attributes
113+
class CloudSuffixes: # pylint: disable=too-few-public-methods,too-many-instance-attributes
114114

115115
def __init__(self,
116116
storage_endpoint=None,
@@ -212,7 +212,7 @@ def _arm_to_cli_mapper(arm_dict):
212212
acr_login_server_endpoint=arm_dict['suffixes']['acrLoginServer'] if 'acrLoginServer' in arm_dict['suffixes'] else None)) # pylint: disable=line-too-long
213213

214214

215-
class Cloud(object): # pylint: disable=too-few-public-methods
215+
class Cloud: # pylint: disable=too-few-public-methods
216216
""" Represents an Azure Cloud instance """
217217

218218
def __init__(self,

src/azure-cli-core/azure/cli/core/commands/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def _pre_command_table_create(cli_ctx, args):
118118

119119

120120
# pylint: disable=too-many-instance-attributes
121-
class CacheObject(object):
121+
class CacheObject:
122122

123123
def path(self, args, kwargs):
124124
from azure.cli.core._environment import get_config_dir
@@ -349,7 +349,7 @@ def get_models(self, *attr_args, **kwargs):
349349
operation_group=operation_group)
350350

351351
def update_context(self, obj_inst):
352-
class UpdateContext(object):
352+
class UpdateContext:
353353
def __init__(self, instance):
354354
self.instance = instance
355355

@@ -860,7 +860,7 @@ def _validate_arg_level(self, ns, **_): # pylint: disable=no-self-use
860860
pass
861861

862862

863-
class LongRunningOperation(object): # pylint: disable=too-few-public-methods
863+
class LongRunningOperation: # pylint: disable=too-few-public-methods
864864
def __init__(self, cli_ctx, start_msg='', finish_msg='', poller_done_interval_ms=1000.0):
865865

866866
self.cli_ctx = cli_ctx
@@ -1048,7 +1048,7 @@ def _load_module_command_loader(loader, args, mod):
10481048
return _load_command_loader(loader, args, mod, 'azure.cli.command_modules.')
10491049

10501050

1051-
class ExtensionCommandSource(object):
1051+
class ExtensionCommandSource:
10521052
""" Class for commands contributed by an extension """
10531053

10541054
def __init__(self, overrides_command=False, extension_name=None, preview=False, experimental=False):
@@ -1129,7 +1129,7 @@ def _merge_kwargs(patch_kwargs, base_kwargs, supported_kwargs=None):
11291129

11301130

11311131
# pylint: disable=too-few-public-methods
1132-
class CliCommandType(object):
1132+
class CliCommandType:
11331133

11341134
def __init__(self, overrides=None, **kwargs):
11351135
if isinstance(overrides, str):

src/azure-cli-core/azure/cli/core/commands/arm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232

3333
# pylint:disable=too-many-lines
34-
class ArmTemplateBuilder(object):
34+
class ArmTemplateBuilder:
3535

3636
def __init__(self):
3737
template = OrderedDict()

src/azure-cli-core/azure/cli/core/commands/progress.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
BAR_LEN = 70
1111

1212

13-
class ProgressViewBase(object):
13+
class ProgressViewBase:
1414
""" a view base for progress reporting """
1515
def __init__(self, out):
1616
self.out = out
@@ -28,7 +28,7 @@ def clear(self):
2828
pass # pylint: disable=unnecessary-pass
2929

3030

31-
class ProgressReporter(object):
31+
class ProgressReporter:
3232
""" generic progress reporter """
3333
def __init__(self, message='', value=None, total_value=None):
3434
self.message = message
@@ -45,7 +45,7 @@ def add(self, **kwargs):
4545
total_val = kwargs.get('total_val', self.total_val)
4646
value = kwargs.get('value', self.value)
4747
if value and total_val:
48-
assert value >= 0 and value <= total_val and total_val >= 0
48+
assert 0 <= value <= total_val
4949
self.closed = value == total_val
5050
self.total_val = total_val
5151
self.value = value
@@ -57,7 +57,7 @@ def report(self):
5757
return {'message': self.message, 'percent': percent}
5858

5959

60-
class ProgressHook(object):
60+
class ProgressHook:
6161
""" sends the progress to the view """
6262
def __init__(self):
6363
self.reporter = ProgressReporter()

src/azure-cli-core/azure/cli/core/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
# pylint: disable=too-few-public-methods
20-
class Completer(object):
20+
class Completer:
2121

2222
def __init__(self, func):
2323
self.func = func

0 commit comments

Comments
 (0)