Skip to content

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

Merged
YangAn-microsoft merged 9 commits into
Azure:devfrom
YangAn-microsoft:fix/pylint4-compat
May 14, 2026
Merged

{CI} Fix all style errors for pylint 4.x compatibility#33347
YangAn-microsoft merged 9 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
…rning

- Replace silent return statements with CLIError exceptions in apim_api_export
- Raises CLIError when response link is missing (KeyError)
- Raises CLIError when API export request returns non-OK status
- Raises CLIError when API export request times out
- This ensures proper error signaling in automation/CI pipelines (exit code non-zero on failure)
- Addresses review feedback: guard clauses must not mask failures
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 1 comment.

Comment thread src/azure-cli/azure/cli/command_modules/botservice/custom.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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 no new comments.

Comments suppressed due to low confidence (1)

src/azure-cli/azure/cli/command_modules/apim/custom.py:605

  • In apim_api_export, if the downloaded export payload is not valid JSON/YAML/XML, the nested parse attempts fall through after logging "Content is not in JSON, YAML, or XML format." without assigning exportedResultContent. The subsequent file-writing block then dereferences exportedResultContent, which will raise UnboundLocalError and hide the real payload/format issue. Ensure exportedResultContent is always assigned (e.g., default to exportedResults.text) or raise a CLIError when parsing fails so the command exits cleanly.
    try:
        # Try to parse as JSON
        exportedResultContent = json.loads(exportedResults.text)
    except json.JSONDecodeError:
        try:
            # Try to parse as YAML
            exportedResultContent = yaml.safe_load(exportedResults.text)
        except yaml.YAMLError:
            try:
                # Try to parse as XML
                exportedResultContent = ET.fromstring(exportedResults.text)
            except ET.ParseError:
                logger.warning("Content is not in JSON, YAML, or XML format.")

@YangAn-microsoft YangAn-microsoft requested review from necusjz and yanzhudd and removed request for yanzhudd May 12, 2026 04:23
necusjz
necusjz previously approved these changes May 12, 2026
yanzhudd
yanzhudd previously approved these changes May 13, 2026
Comment thread src/azure-cli/azure/cli/command_modules/botservice/custom.py
@YangAn-microsoft YangAn-microsoft dismissed stale reviews from yanzhudd and necusjz via 4b0879e May 14, 2026 04:52
@YangAn-microsoft YangAn-microsoft merged commit 6e1ff98 into Azure:dev May 14, 2026
50 checks passed
@YangAn-microsoft YangAn-microsoft deleted the fix/pylint4-compat branch May 14, 2026 10:55
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.

8 participants