[Python-ideas] A PEP to define basical metric which allows to guarantee minimal code quality
Chris Barker - NOAA Federal
chris.barker at noaa.gov
Wed Sep 20 11:34:34 EDT 2017
More information about the Python-ideas mailing list
Wed Sep 20 11:34:34 EDT 2017
- Previous message (by thread): [Python-ideas] A PEP to define basical metric which allows to guarantee minimal code quality
- Next message (by thread): [Python-ideas] A PEP to define basical metric which allows to guarantee minimal code quality
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> How do we handle different organizational requirements? > By keeping linting out of the code ( and certainly out of "official" python), and in the organization's development process where it belongs. > @pylint([34]) > @pep([8,20]) > def f(a): > return math.sqrt(a) Yeach! But that's just my opinion -- if you really like this idea, you can certainly implement it in an external package. No need for a PEP or anything of the sort. > The other aspect that comes into code quality is unit tests. A decorator of what test functions need to be run on a function (and pass) would also be useful: > > def test_f_arg_negative(f): > try: > return f(-1) == 1 > except(e): > return False# ValueError: math domain error > > @tests([test_f_arg_positive, test_f_arg_negative, test_f_arg_zero, f_test_f_arg_int, test_f_arg_float]) > def f(a): > return math.sqrt(math.abs(a)) Again, I don't think it belongs there, but I do see your point. If you like this idea--implement it, put it on PyPi, and see if anyone else likes if as well. -CHB
- Previous message (by thread): [Python-ideas] A PEP to define basical metric which allows to guarantee minimal code quality
- Next message (by thread): [Python-ideas] A PEP to define basical metric which allows to guarantee minimal code quality
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list