pythonbitbucketpylintbitbucket-pipelinespylintrc

Linting error on BitBucket: TypeError: 'LinterStats' object is not subscriptable


I am using BitBucket pipelines to perform linting checks with pylint. It was working fine a few hours ago. I have been facing the following error even though the final score is well past the minimum criteria (8.0):

Your code has been rated at 9.43/10

Traceback (most recent call last):
  File "/usr/local/bin/pylint-fail-under", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/pylint_fail_under/__main__.py", line 42, in main
    score = results.linter.stats["global_note"]
TypeError: 'LinterStats' object is not subscriptable

Solution

  • Do not use pylint-fail-under, pylint has a fail-under option since pylint 2.5.0, and pylint-fail-under's maintener will not update their package for newer pylint.

    Change pylint-fail-under --fail_under 8.0 to pylint --fail-under=8.0 and remove the dependency to pylint-fail-under.

    See also https://github.com/PyCQA/pylint/issues/5405, and: https://github.com/TNThieding/pylint-fail-under/issues/8#issuecomment-626369567