swsnu / swppfall2019

31 stars 23 forks source link

[Project] pylint 관련 질문 #194

Open ByungHeeCha opened 4 years ago

ByungHeeCha commented 4 years ago

pylint를 쓰다보면 이런 에러가 나올때가 있습니다. E1101: Class 'Profile' has no 'objects' member (no-member)(Profile은 모델입니다) 아마 pylint가 django를 이해하지 못해서 일어나는 일인것 같은데 이런 부분은 무시해도 되는건가요?

ktaebum commented 4 years ago

확실하게 확인해본 사항은 아니지만 https://github.com/PyCQA/pylint-django 이 플러그인이 도움이 될 것 같습니다

ktaebum commented 4 years ago

확인해보니 django를 사용함으로써 생길 수 있는 lint error들은 다 걸러주는 것 같아서 이거 사용하시면 편할 것 같습니다

ByungHeeCha commented 4 years ago

감사합니다!

ktaebum commented 4 years ago

그리고 minor한 사항들은 rc에 disable 시켜도 괜찮습니다 linter 사용 권장하는 이유는 여러 사람이 작업을 할 때 하나의 coding style을 유지하면서 하는 것을 연습하기 위함이지 얼마나 수많은 lint error들을 통과하냐는 아닙니다 따라서 팀원들간 협의하에 편한 방향으로 사용하시면 됩니다.

예를 들어 PyTorch 같은 open source project는 https://github.com/pytorch/pytorch/blob/master/.flake8

ignore =
    E203,E305,E402,E501,E721,E741,F403,F405,F821,F841,F999,W503,W504,C408,E302,W291,E303,
    # these ignores are from flake8-bugbear; please fix!
    B007,B008,
    # these ignores are from flake8-comprehensions; please fix!
    C400,C401,C402,C403,C404,C405,C407,C411,

이와 같은 사항들을 ignore 하고 있고

TensorFlow 같은 open source project는 https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/ci_build/pylintrc

disable=design,similarities,no-self-use,attribute-defined-outside-init,locally-disabled,star-args,pointless-except,bad-option-value,global-statement,fixme,suppressed-message,useless-suppression,locally-enabled,no-member,no-name-in-module,import-error,unsubscriptable-object,unbalanced-tuple-unpacking,undefined-variable,not-context-manager

이와 같은 항목들을 ignore 하고 있고 style guide에 대한 문서로 https://github.com/google/styleguide/blob/gh-pages/pyguide.md 를 제공하고 있습니다