anti-idiom checker?
Hi, As I teach Py after C, guys like to index list items more than needed... Maybe you know some check'er which would automatically detect such and similar stuff (and propose the idioms :). https://en.wikibooks.org/wiki/Python_Programming/Idioms#Data_types Thanks :) ps.: I imagine I could make sth via AST analysis... -- Jurgis Pralgauskis tel: 8-616 77613; Don't worry, be happy and make things better ;) http://galvosukykla.lt
ps.: I imagine I could make sth via AST analysis... --
Or maybe some regex that looks for "for bar in range(len(foo)): ...foo[bar]" # (in the for's scope) 'cept I don't know regexes well enough to write that. :-D It could just say "slap with wet fish ("for block" starting line 10)" in a nagnanny.log file someplace, with the user option to care (a "Pythonic" toggle). Kirby
Hi, I found good collection + tool to match code patterns. Guys made a system to crowdsource the (anti)patterns for auto-checking! :) http://docs.quantifiedcode.com/python-anti-patterns/ The tool http://docs.quantifiedcode.com/patterns/language/index.html On Wed, Apr 20, 2016 at 11:14 PM, kirby urner <kirby.urner@gmail.com> wrote:
ps.: I imagine I could make sth via AST analysis... --
Or maybe some regex that looks for
"for bar in range(len(foo)): ...foo[bar]" # (in the for's scope)
'cept I don't know regexes well enough to write that. :-D
It could just say
"slap with wet fish ("for block" starting line 10)"
in a nagnanny.log file someplace, with the user option to care (a "Pythonic" toggle).
Kirby
-- Jurgis Pralgauskis tel: 8-616 77613; Don't worry, be happy and make things better ;) http://galvosukykla.lt
Excellent resource! I've clued a number of folks in my network within minutes of seeing this (shout out to Steve Holden). Thanks! Treating security and maintainability holes together under the heading of "anti-patterns" makes so much sense. Risk based thinking <--> awareness of anti-patterns (how to find them, how to not fall into using them). Kirby On Wed, Apr 27, 2016 at 12:59 PM, Jurgis Pralgauskis < jurgis.pralgauskis@gmail.com> wrote:
Hi,
I found good collection + tool to match code patterns.
Guys made a system to crowdsource the (anti)patterns for auto-checking! :)
http://docs.quantifiedcode.com/python-anti-patterns/
The tool http://docs.quantifiedcode.com/patterns/language/index.html
On Wed, Apr 20, 2016 at 11:14 PM, kirby urner <kirby.urner@gmail.com> wrote:
ps.: I imagine I could make sth via AST analysis... --
Or maybe some regex that looks for
"for bar in range(len(foo)): ...foo[bar]" # (in the for's scope)
'cept I don't know regexes well enough to write that. :-D
It could just say
"slap with wet fish ("for block" starting line 10)"
in a nagnanny.log file someplace, with the user option to care (a "Pythonic" toggle).
Kirby
-- Jurgis Pralgauskis tel: 8-616 77613; Don't worry, be happy and make things better ;) http://galvosukykla.lt
participants (2)
-
Jurgis Pralgauskis
-
kirby urner