I want to add a customized check to my pylintrc file to check and report
cases whenever I define a function in a python file like this:
def foo( var1, name1=value, *args ):
The problem that I want to deal with is that we should not have keyword
arguments( *name1* ) before positional arguments( **args* ). Although the
function can still be called by passing *name1* as positional argument but
there would be no way to not specify *name1* but specify **args*.
How can I add this check to pylintrc file?
Thanks in advance!
I decided to check my
via pylint, but this
failed with error "Unexpected keyword argument 'field1' in constructor call
(unexpected-keyword-arg)". What should I do to
do to fix this error?
he test project two files: __init __.
# coding: utf-8
from pony.orm import sql_debug, db_session, Database, Required
db = Database()
db.bind('sqlite', '/tmp/dns11.sqlite', create_db=True)
For quite some time, since the very first 'Forget the past' commit I have
access to, pylint had the ability of providing additional reports, such as
Global evaluation, Messages by category, Statistics by type etc.
For those of you who are unfamiliar with them, they look like this
pylint provides an easy way to disable them, by using the --reports
flag, as in `--reports=y|n`.
After using pylint for some time, they're started to feel useless for me
and I'm always disabling them when running pylint.
They don't provide that much value, except maybe scaring new users
with all sorts of numbers, percentages and negative scores
(yes, the default formula allows the global evaluation
score to become negative).
For pylint users, what do you think about the removal of these
reports from pylint? Would it cause problems for you?
Are these reports in any sense useful for you?
If there's no negative push-back, we'll go through the normal deprecation
procedures, so they won't be removed until two releases for now
or until Pylint 2.0. As a benefit, we'll get rid of a lot of code that no one
is happy to maintain and the maintainers can focus on developing
the analysis capabilities instead.
Rene Zhang is doing his internship at Google, and has helped debug some
parts of our internal pylint stack. Doing this he has uncovered some issues
for which he will be sending in some patches he developed at Google.
*Daniel Balparda de Carvalho* 梅巴達 <balparda(a)google.com>
Python Team, Google US-MTV-CL2 3K5B, +1-650-933-8587
I use some of the reports some of the time. The external dependencies
report is by far the most important for me, my typical use is for
analyzing packages to figure out what blocks a given package from
running on PyPy or Python 3. I haven't been able to find a good
replacement, so I'd be sad to see it go. I sometimes use the raw
metrics to get a picture of how much actual code there is in messy
projects, my own or others'. Duplicated lines is something I find
useful mostly in hunting for duplication in code written by other people
I need to refactor. I could probably write scripts to replace this
functionality, though, or use other tools. The rest I can't ever
remember using. The numeric evaluation is actively misleading, which I
think is reason enough to eliminate it.
According to the flake8 docs you can set your preferences in
~/.config/flake8 on Linux -- and this works fine.
But the docs don't mention Windows. I tried \User\mark\ and I tried the
root of my Python project (as flake8, as tox.ini, and as setup.cfg), but
nothing seemed to work.
Mark Summerfield, Qtrac Ltd.
DiffPDFc windows command line PDF comparison tool
I've recently started using flake8 and rather like it.
However, there are some cases where I want to turn off particular
For example, in one .py file I have many lines like this:
if DEBUG: print(...)
Using # noqa on these doesn't work.
What I'd like to do is put at the top of this file:
# flake8: ignore = E701
since normally I do want this warning.
I'm using Debian stable:
$ py3 -m flake8 --version
2.2.2 (pep8: 1.4.6, pyflakes: 0.8.1, mccabe: 0.2.1) CPython 3.4.3+ on Linux
Mark Summerfield, Qtrac Ltd.
"Python in Practice" - Dr Dobbs JOLT best book award winner
Recently I submitted such piece of code to one of my projects:
if 'text' in d.get('a'):
# do something
Obviously that was expected to be something like:
if 'text' in d.get('a', ''):
# do something
because .get() might return None, and checking if something is contained in
None gives you TypeError. Maybe it was too late, I was trying to finish
this piece of code asap and I expected flakes8 to detect this for me, so
when PR became green I merged it. When I realized this piece of code is
buggy it was too late :)
As I don't want to repeat this mistake I decided to take measures. As I was
using flakes8 at the moment and it didn't notice this bug - I thought "Hm,
maybe I should use some better tool, maybe pyflakes is too simple to catch
that". So I tried pylint and prospector. They do almost everything, I
believe both tools can bring you coffee in the bed. But they cannot detect
such a simple error. No success. And that makes me really unhappy. Do you
guys know any Python code analyzer which is able to catch such problem? Is
there a chance this can be implemented in pyflakes? If so - should I create
bug on https://bugs.launchpad.net/pyflakes/+filebug?