Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

python - Pylint: overriding max-line-length in individual file

Is it possible to change max-line-length settings for one file out of a project (while performing all other checks defined in rc file on it)?

Ideally, it should behave like inline pylint: disable=x comments.

I've tried putting this line at the module level:

# pylint: max-line-length=240

PyLint failed to recognize it:

my_file.py:15: [E0011(unrecognized-inline-option), ] Unrecognized file option 'max-line-length

Edit: I know I can disable line-too-long check entirely, but to be honest I'd like to avoid doing so, just in case anyone would try to extend this module and add lines even longer than they are now.

question from:https://stackoverflow.com/questions/30667612/pylint-overriding-max-line-length-in-individual-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can create .pylintrc file in your python script to overwrite pylint settings and put inside

[FORMAT]
max-line-length=240

edit 240 based on your choice.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...