Skip to content

{CI} Fix all style errors for pylint 4.x compatibility#33347

Open
YangAn-microsoft wants to merge 3 commits into
Azure:devfrom
YangAn-microsoft:fix/pylint4-compat
Open

{CI} Fix all style errors for pylint 4.x compatibility#33347
YangAn-microsoft wants to merge 3 commits into
Azure:devfrom
YangAn-microsoft:fix/pylint4-compat

Conversation

@YangAn-microsoft
Copy link
Copy Markdown
Contributor

@YangAn-microsoft YangAn-microsoft commented May 11, 2026

This PR contains Azure CLI code changes required to pass style checks with pylint 4.x.

What is included

  • Fix logging argument/type issues reported by pylint 4.x.
  • Remove duplicate function definitions flagged by pylint.
  • Replace deprecated codecs.open usage with open using explicit encoding.
  • Validate the result with azdev style --pylint CLI on Python 3.14 + pylint 4.x.

Scope

  • This PR includes only Azure CLI code fixes needed for pylint 4.x compatibility.
  • It does not include dependency constraint changes in azure-cli-dev-tools.

Coordination

  • Merge this PR first.
  • Then merge the companion azure-cli-dev-tools PR that bumps pylint constraint to >=4,<5.

… duplicate functions, codecs.open migration)
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 11, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 11, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@github-actions
Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 11, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@YangAn-microsoft YangAn-microsoft marked this pull request as ready for review May 11, 2026 03:32
Copilot AI review requested due to automatic review settings May 11, 2026 03:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Azure CLI source to pass azdev style --pylint under pylint 4.x (notably on Python 3.14), primarily by addressing logging-format issues, removing duplicate function definitions, and updating deprecated file-reading usage.

Changes:

  • Fix logging calls to use parameterized formatting compatible with pylint 4.x checks.
  • Remove duplicate helper function definitions flagged by pylint (keeping the canonical definitions).
  • Replace codecs.open with built-in open(..., encoding=...) in core file-reading utility.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/synapse/manual/operations/sqlpoolblobauditingpolicy.py Removes a duplicate diagnostic-settings helper implementation.
src/azure-cli/azure/cli/command_modules/cosmosdb/custom.py Removes a duplicate _handle_exists_exception helper definition.
src/azure-cli/azure/cli/command_modules/containerapp/_utils.py Removes a duplicate _remove_env_vars definition, keeping a single implementation.
src/azure-cli/azure/cli/command_modules/botservice/custom.py Adjusts log messages and fixes a logging call to be properly parameterized.
src/azure-cli/azure/cli/command_modules/batch/_command_type.py Tweaks Optional/Union(None) type-hint handling to satisfy pylint 4.x.
src/azure-cli/azure/cli/command_modules/appservice/custom.py Removes an unnecessary _list_app import (function is defined locally).
src/azure-cli/azure/cli/command_modules/apim/custom.py Fixes an incorrect logger.warning format string/arguments pairing.
src/azure-cli-core/azure/cli/core/util.py Replaces deprecated codecs.open usage with built-in open and explicit encodings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/azure-cli/azure/cli/command_modules/apim/custom.py
Copy link
Copy Markdown
Member

@necusjz necusjz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (azure-cli-core part

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment on lines 559 to +564
try:
# Extract the link from the response where results are stored
link = response_dict['additional_properties']['properties']['value']['link']
except KeyError:
logger.warning("Error exporting api from APIManagement. The expected link is not present in the response.")
return
Comment on lines +587 to +590
return
except requests.exceptions.ReadTimeout:
logger.warning("Timed out while exporting api from APIManagement.")
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants