#4505 (Neues Test Ticket für Code-Test) – Trac 0.12 Demo Project 1 von 2 http://trac.edgewall.org/demo-0.12/ticket/4505 Ticket #4505 (new defect) Neues Test Ticket für Code-Test erstellt vor 8 Minuten zuletzt geändert vor 7 Minuten Erstellt von: anonym Verantwortlicher: Priorität: major Meilenstein: Komponente: another / with / space Version: Stichworte: Kopie: Beschreibung (zuletzt geändert von anonym) (Diff) Here comes some big code: insert into some_table (id, module, application, parent, sort_id, name_0, description_0 Some text below for testing: Well, I am a bit curious, so I just tested the 3 myself right after asking the question ;-) Ok, this is not a very serious review but here is what I can say : I tried the tools with the default settings (it's important because you can pretty much choose your check rules) on the following script : #!/usr/local/bin/python # by Daniel Rosengren modified by e-satis import sys, time stdout = sys.stdout BAILOUT = 16 MAX_ITERATIONS = 1000 class Iterator(object) : def init(self): print 'Rendering...' for y in xrange(-39, 39): stdout.write('\n') for x in xrange(-39, 39): if self.mandelbrot(x/40.0, y/40.0) : stdout.write(' ') else: stdout.write('*') def mandelbrot(self, x, y): cr = y - 0.5 ci = x zi = 0.0 zr = 0.0 for i in xrange(MAX_ITERATIONS) : temp = zr * zi zr2 = zr * zr 20.01.2012 09:18 #4505 (Neues Test Ticket für Code-Test) – Trac 0.12 Demo Project 2 von 2 http://trac.edgewall.org/demo-0.12/ticket/4505 zi2 = zi * zi zr = zr2 - zi2 + cr zi = temp + temp + ci if zi2 + zr2 > BAILOUT: return i return 0 t = time.time() Iterator() print '\nPython Elapsed %.02f' % (time.time() - t) As a result : Py Checker? is troublesome because it compiles the module to analyze it. If you don't want your code to run (e.g, it performs a SQL query), that's bad. Py Flakes? is supposed to be lite. Indeed, it decided that the code was perfect. I am looking for something quite severe so I don't think I'll go for it. Py Lint? has been very talkative and rated the code 3/10 (OMG, I'm a dirty coder !). Strongs points : Very descriptive and accurate report. Detect some code smells. Here it told me to drop my class to write something with functions because the OO approach was useless in this specific case. Something I knew, but never expected a computer to tell me :-p The fully corrected code run faster (no class, no reference binding...). Made by a French team. Ok it's not a plus for everybody, but I like it ;-) Cons : Some rules are really strict. I know that you can change it and that the default is to match PEP 8, but is it such a crime to write 'for x in seq' ? Apparently yes because you can't write a variable name with less than 3 letters. I will change that. Very very talkative. Be ready to use your eyes. Corrected script (with lazy doc strings and variable names) : Anhänge Änderungshistorie Vor 7 Minuten geändert durch anonym comment:1 Beschreibung geändert (Diff) Vor 7 Minuten geändert durch anonym comment:2 Beschreibung geändert (Diff) 20.01.2012 09:18