Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name' object has no attribute 'value'`` (if possible, be more specific about what made pylint crash) #5813

Closed
tbarnier opened this issue Feb 16, 2022 · 1 comment
Labels
Downstream Bug 🪲 The problem happens in a lib depending on pylint, not pylint Duplicate 🐫 Duplicate of an already existing issue

Comments

@tbarnier
Copy link

Bug description

Content:
When parsing the following file:

# -*- coding: utf-8 -*-
[CODE REDACTED]
from datetime import timedelta
from typing import Any, Dict

from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.sensors.external_task_sensor import ExternalTaskSensor
from airflow.utils.dates import days_ago

default_args = {
    "owner": "airflow",
    "start_date": days_ago(29),
    "retries": 3,
    "depends_on_past": False,
    "on_failure_callback": notify_slack_on_failure,
    "execution_timeout": timedelta(hours=1),
    "schedule_interval": "@daily",
    "concurrency": 5,
    "catchup": True,
}

def create_dag(module: str, dag_id: str):
    dag = DAG(
        dag_id,
        default_args=default_args,
    )


    wait_for_upstream_dag = ExternalTaskSensor(
        task_id="wait_for_upstream_dag",
        external_dag_id="PARENT",
        dag=dag,
    )

    conversion_upload = BashOperator(
        task_id=f"conversion_upload",
        bash_command=[REDACTED],
        dag=dag,
    )

    # Dependencies between tasks
    wait_for_upstream_dag >>  conversion_upload # pylint: disable=W0104

    return dag
for module in ["a", "b", "c", ]:
    dag_id = f"pipeline_{module}"
    globals()[dag_id] = create_dag(module, dag_id)

### Configuration

```ini
load-plugins=pylint_airflow

Command used

pylint file.py

Pylint output

pylint crashed with a ``AttributeError`` and with the following stacktrace:

Traceback (most recent call last):
  File "/home/xxx/DEV/code/.venv/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1034, in _check_files
    self._check_file(get_ast, check_astroid_module, file)
  File "/home/xxx/DEV/code/.venv/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1069, in _check_file
    check_astroid_module(ast_node)
  File "/home/xxx/DEV/code/.venv/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1203, in check_astroid_module
    retval = self._check_astroid_module(
  File "/home/xxx/DEV/code/.venv/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1250, in _check_astroid_module
    walker.walk(node)
  File "/home/xxx/DEV/code/.venv/lib/python3.8/site-packages/pylint/utils/ast_walker.py", line 72, in walk
    callback(astroid)
  File "/home/xxx/DEV/code/.venv/lib/python3.8/site-packages/pylint_airflow/checkers/dag.py", line 101, in visit_module
    dagid, dagnode = _find_dag(assign.value, func)
  File "/home/xxx/DEV/code/.venv/lib/python3.8/site-packages/pylint_airflow/checkers/dag.py", line 93, in _find_dag
    return call_node.args[0].value, call_node
AttributeError: 'Name' object has no attribute 'value'


### Expected behavior

No crash

### Pylint version

```shell
pylint 2.12.2
astroid 2.9.3
Python 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0]

OS / Environment

inux laptop 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Additional dependencies

agate==1.6.3
alembic==1.4.3
apache-airflow==1.10.15
apache-airflow-backport-providers-google==2020.11.23
apache-airflow-backport-providers-sftp==2021.3.3
apache-airflow-backport-providers-ssh==2021.3.3
apispec==1.3.3
appdirs==1.4.4
argcomplete==1.12.2
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
astroid==2.9.3
asttokens==2.0.5
attrs==20.3.0
Babel==2.9.0
backcall==0.2.0
bcrypt==3.2.0
black==22.1.0
bleach==4.1.0
cached-property==1.5.2
cachetools==4.2.4
cattrs==1.1.2
certifi==2020.11.8
cffi==1.14.4
cfgv==3.3.1
chardet==3.0.4
charset-normalizer==2.0.11
click==6.7
colorama==0.4.4
colorlog==4.0.2
configparser==3.5.3
croniter==0.3.36
cryptography==3.2.1
db-dtypes==0.3.1
dbt-bigquery==1.0.0
dbt-core==1.0.1
dbt-extractor==0.4.0
debugpy==1.5.1
decorator==5.1.1
defusedxml==0.6.0
diff-cover==6.4.4
dill==0.3.3
distlib==0.3.4
dnspython==1.16.0
docutils==0.15.2
email-validator==1.1.2
entrypoints==0.3
executing==0.8.2
filelock==3.4.2
Flask==1.1.2
Flask-Admin==1.5.4
Flask-AppBuilder==2.3.4
Flask-Babel==1.0.0
Flask-Caching==1.3.3
Flask-JWT-Extended==3.25.0
Flask-Login==0.4.1
Flask-OpenID==1.3.0
Flask-SQLAlchemy==2.4.4
flask-swagger==0.2.14
Flask-WTF==0.14.3
funcsigs==1.0.2
future==0.18.2
google-ads==7.0.0
google-api-core==1.31.5
google-api-python-client==1.12.10
google-auth==1.35.0
google-auth-httplib2==0.1.0
google-auth-oauthlib==0.4.6
google-cloud-appengine-logging==1.1.0
google-cloud-audit-log==0.2.0
google-cloud-automl==1.0.1
google-cloud-bigquery==2.32.0
google-cloud-bigquery-datatransfer==1.1.1
google-cloud-bigquery-storage==2.11.0
google-cloud-bigtable==1.7.0
google-cloud-container==1.0.1
google-cloud-core==1.7.2
google-cloud-datacatalog==0.7.0
google-cloud-dataproc==1.1.1
google-cloud-dlp==1.0.0
google-cloud-kms==1.4.0
google-cloud-language==1.3.0
google-cloud-logging==1.15.1
google-cloud-memcache==1.2.0
google-cloud-monitoring==1.1.0
google-cloud-os-login==1.0.0
google-cloud-pubsub==1.7.0
google-cloud-redis==1.0.0
google-cloud-secret-manager==1.0.0
google-cloud-spanner==1.19.1
google-cloud-speech==1.3.2
google-cloud-storage==1.44.0
google-cloud-tasks==1.5.0
google-cloud-texttospeech==1.0.1
google-cloud-translate==1.7.0
google-cloud-videointelligence==1.16.1
google-cloud-vision==1.0.0
google-cloud-workflows==1.5.0
google-crc32c==1.3.0
google-resumable-media==2.1.0
googleapis-common-protos==1.54.0
graphviz==0.15
greenlet==1.1.2
grpc-google-iam-v1==0.12.3
grpcio==1.43.0
grpcio-gcp==0.2.2
grpcio-status==1.43.0
gunicorn==20.0.4
hologram==0.0.14
httplib2==0.20.4
identify==2.4.7
idna==2.8
importlib-metadata==2.1.1
importlib-resources==1.5.0
iniconfig==1.1.1
ipykernel==6.8.0
ipython==8.0.1
ipython-genutils==0.2.0
ipywidgets==7.6.5
iso8601==0.1.13
isodate==0.6.1
isort==5.10.1
itsdangerous==1.1.0
jedi==0.18.1
Jinja2==2.11.2
jinja2-simple-tags==0.3.1
json-merge-patch==0.2
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==7.1.2
jupyter-console==6.4.0
jupyter-core==4.9.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.2
lazy-object-proxy==1.4.3
leather==0.3.4
libcst==0.4.1
lockfile==0.12.2
Logbook==1.5.3
Mako==1.1.3
Markdown==2.6.11
MarkupSafe==1.1.1
marshmallow==2.21.0
marshmallow-enum==1.5.1
marshmallow-sqlalchemy==0.23.1
mashumaro==2.9
matplotlib-inline==0.1.3
mccabe==0.6.1
minimal-snowplow-tracker==0.0.2
mistune==0.8.4
msgpack==1.0.3
mypy-extensions==0.4.3
natsort==7.1.0
nbclient==0.5.10
nbconvert==6.4.1
nbformat==5.1.3
nest-asyncio==1.5.4
networkx==2.6.3
nodeenv==1.6.0
notebook==6.4.8
nox==2022.1.7
numpy==1.19.4
oauthlib==3.2.0
packaging==20.7
pandas==1.1.4
pandas-gbq==0.17.0
pandocfilters==1.5.0
paramiko==2.9.2
parsedatetime==2.4
parso==0.8.3
pathspec==0.9.0
pendulum==1.4.4
pexpect==4.8.0
pickleshare==0.7.5
pipdeptree==2.2.1
platformdirs==2.4.1
pluggy==1.0.0
pre-commit==2.17.0
prison==0.1.3
prometheus-client==0.13.1
prompt-toolkit==3.0.26
proto-plus==1.19.9
protobuf==3.19.4
psutil==5.7.3
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0
pyarrow==6.0.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pydata-google-auth==1.3.0
Pygments==2.7.2
PyJWT==1.7.1
pylint==2.12.2
pylint-airflow==0.1.0a1
PyNaCl==1.5.0
pyOpenSSL==22.0.0
pyparsing==2.4.7
pyrsistent==0.17.3
pysftp==0.2.9
pytest==6.2.5
python-daemon==2.2.4
python-dateutil==2.8.1
python-editor==1.0.4
python-nvd3==0.15.0
python-slugify==4.0.1
python3-openid==3.2.0
pytimeparse==1.1.8
pytz==2020.4
pytzdata==2020.1
PyYAML==5.3.1
pyzmq==22.3.0
qtconsole==5.2.2
QtPy==2.0.1
regex==2022.1.18
requests==2.23.0
requests-oauthlib==1.3.1
rsa==4.8
Send2Trash==1.8.0
setproctitle==1.2
six==1.15.0
SQLAlchemy==1.3.20
SQLAlchemy-JSONField==0.9.0
SQLAlchemy-Utils==0.36.8
sqlfluff==0.10.0
sqlfluff-templater-dbt==0.10.0
sqlparse==0.4.2
sshtunnel==0.1.5
stack-data==0.1.4
tabulate==0.8.7
tblib==1.7.0
tenacity==4.12.0
terminado==0.13.1
testpath==0.5.0
text-unidecode==1.3
thrift==0.13.0
toml==0.10.2
tomli==2.0.0
tornado==6.1
tqdm==4.62.3
traitlets==5.1.1
typing-extensions==4.0.1
typing-inspect==0.7.1
tzlocal==1.5.1
unicodecsv==0.14.1
uritemplate==3.0.1
urllib3==1.25.11
virtualenv==20.13.0
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==0.16.1
widgetsnbextension==3.5.2
wrapt==1.13.3
WTForms==2.3.3
XlsxWriter==3.0.2
zipp==3.4.0
zope.deprecation==4.4.0

@tbarnier tbarnier added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Feb 16, 2022
@DanielNoord
Copy link
Collaborator

Duplicate of #5448.

Sadly this is not an issue with pylint, but rather with a downstream package. I would recommend checking if their repository has an open issue about this yet and if not open one there!

@DanielNoord DanielNoord added Downstream Bug 🪲 The problem happens in a lib depending on pylint, not pylint Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Downstream Bug 🪲 The problem happens in a lib depending on pylint, not pylint Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

2 participants