aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

Python pylint errors for intrinsic function calls after upgrading to v1.19.0

Open seabassapologist opened this issue 6 years ago • 9 comments

After upgrading to CDK v1.19.0 for Python, pylint is throwing "no value for argument in unbound method call" errors for aws_cdk.core Fn intrinsic functions calls. CDK can still synth and deploy my code despite the errors, but this does not happen when running CDK v1.18.0

Was there a change in the Fn intrinsic functions in CDK v1.19.0?

Reproduction Steps

  1. Upgrade CDK CLI to v1.19.0
  2. Upgrade Python CDK modules to v1.19.0
  3. Call a Fn intrinsic function in code
  4. Execute pylint on .py file

Example code using Fn.import_value from aws_cdk.core:

from aws_cdk import core

VPC_SUBNET = core.Fn.import_value("oPrivateSubnetA")

Error Log

(.env) PS C:\Development\pwc-tools\pwc_tools> pylint --disable="R,C,W" pwc_tools_stack.py
************* Module pwc_tools.pwc_tools_stack
pwc_tools_stack.py:44:28: E1120: No value for argument 'shared_value_to_import' in unbound method call (no-value-for-parameter)

------------------------------------------------------------------
Your code has been rated at 5.83/10 (previous run: 5.00/10, +0.83)

If shared_value_to_import or whichever respective argument is named in the function call like such

from aws_cdk import core

VPC_SUBNET = core.Fn.import_value(shared_value_to_import="oPrivateSubnetA")

pylint will report that argument cls has no value, but will still successfully synth and deploy

(.env) PS C:\Development\pwc-tools\pwc_tools> pylint --disable="R,C,W" .\pwc_tools_stack.py
************* Module pwc_tools.pwc_tools_stack
pwc_tools_stack.py:44:28: E1120: No value for argument 'cls' in unbound method call (no-value-for-parameter)

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

Environment

  • CLI Version : 1.19.0
  • Framework Version: 1.19.0
  • OS : Windows 10
  • Language : Python

Other


This is :bug: Bug Report

seabassapologist avatar Dec 19 '19 15:12 seabassapologist

I'm seeing this also and no guidance on what to do. I've also seen this in the route53 module for recordAlias.from_alias in 1.19.0 and today with 1.20.0.

gadams999 avatar Jan 08 '20 20:01 gadams999

I'm still seeing this in 1.20.0 as well. No issues deploying my code though

seabassapologist avatar Jan 13 '20 16:01 seabassapologist

Also seeing this for secrets (Secret.from_secret_arn)

KyleMuellerPFG avatar Jan 15 '20 16:01 KyleMuellerPFG

The same issue for lambda function - Code.from_asset, for core.Tag.add, and for iam role - from_aws_managed_policy_name. cdk 1.21.1, pylint for vscode

Flood-ctrl avatar Jan 21 '20 12:01 Flood-ctrl

I'm seeing this as well on ec2. CDK v1.32.2 pylint v2.4.2 python v3.7.4 vscode 1.44.1

michaelsimon avatar Apr 16 '20 21:04 michaelsimon

This is likely due to an update in MyPY that started checking things it didn't previously check.

RomainMuller avatar May 11 '20 08:05 RomainMuller

I actually think this is the same problem as the one reported in #6148.

RomainMuller avatar Aug 11 '20 12:08 RomainMuller

JSII issue - closing.

comcalvi avatar Jan 25 '23 21:01 comcalvi

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Jan 25 '23 21:01 github-actions[bot]