github-actions · GitHub

@Piraty

* use a map of pylint codes -> messages to replace all occurences,
  see below script
* format with black
* fix broken ignore rules after black added line breaks
Closes: python-telegram-bot#2664
    #!/bin/sh -e
    check() { grep -E -r -e '#.*pylint.*disable.*=[CW]+[0-9]+' | wc -l ;}
    check
    src_files="$(git ls-files '*.py')"
    pylint --list-msgs |
	    grep '^:' |
	    cut -d: -f2 |
	    sed -e 's/(//g' -e 's/)//g' \
		    >/tmp/pylint-map-codes-to-msg
    while read -r msg code; do
	    echo "checking code: $code"
	    sed \
		    -e "s/${code}$/$msg/" \
		    -e "s/${code},/${msg}, /" \
		    -i $src_files
	    # double-check ;)
	    grep -e "$code" $src_files && echo 'OH NO!!'
    done </tmp/pylint-map-codes-to-msg
    check

Read the original on github.com ↗