bradley.ayers
bradley.ayers

Reputation: 38392

pylint raising R0801 for coding declaration lines

I have a Python project and am using the following line in some files:

# coding: utf-8

When I use pylint, it complains with a R0801 warning saying that there are many files with this same code. What's the best way to make pylint ignore these?

Upvotes: 3

Views: 3525

Answers (3)

Edward Hartnett
Edward Hartnett

Reputation: 961

Since utf-8 is the default encoding in Python 3.0+, you can remove these lines.

PEP 3120 -- Using UTF-8 as the default source encoding

Upvotes: 0

Michal Čihař
Michal Čihař

Reputation: 10091

As mentioned in comments, the root cause of this problem with Jenkins Violations scanner is that it does not properly parse Pylint output in this case and all code duplications are assigned to first line of one file.

Upvotes: 3

gurney alex
gurney alex

Reputation: 13655

Do you still have the issue if you use this syntax for encoding declaration:

# -*- coding: utf-8 -*-

Upvotes: 0

Related Questions