Pyflakes builder should check example code

Bug #1152533 reported by Richard Wall
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Twisted Buildbot Configuration
New
Undecided
Unassigned

Bug Description

This is part of the Twisted Better Examples plan:
 * https://twistedmatrix.com/trac/wiki/Plan/BetterExamples#Pyflakesbuildershouldcheckexamplecode

In the comments for http://tm.tl/84, jml and spiv have both suggested that we
should run a linter on the examples.

[https://twistedmatrix.com/documents/current/core/development/policy/writing-standard.html#auto8 The writing standard]
suggests that "example code should conform to
the coding standard" which implies that examples should be tested in
the same way as the main twisted code. That includes pyflakes.

The pyflakes builder does not currently scan the doc folder and the
Python files within.

 * https://buildbot.twistedmatrix.com/builders/pyflakes/builds/76/steps/pyflakes/logs/stdio
 * pyflakes twisted

So we should alter the current pyflakes builder to scan everything.

This would also catch problems with the setuptools files.

There are 116 pyflakes errors in the existing documentation examples
and in the setup.py files.

{{{

[richard@zorin testable-examples-84]$ pyflakes doc setup* | wc -l

doc/historic/2003/pycon/deferex/deferex-bad-adding.py:6: invalid
syntax ... ^ doc/historic/2003/pycon/deferex/deferex-listing2.py:6:
invalid syntax ... ^
doc/historic/2003/pycon/deferex/deferex-listing0.py:8: invalid syntax
... ^

116
}}}

But the pyflakes builder is a "ratchet" test, so these errors will
only show up as "new errors" in initial builds, after which, the
errors can be fixed incrementally in future tickets.

When this task is done, we will raise tickets for fixing the pyflakes
errors in each example.

Some further notes based on comments in http://tm.tl/84.

There are some example python files which contain only partial
code. This is done in some howtos which only want to highlight the
changes to an example, inbetween narrative paragraphs. There are only
a few of these and in time these will be updated to use sphinx or
lore's ability to include parts of an example file. Ultimately all
example python files will be complete runnable examples.

The "historic" examples can not be updated and therefore should not
not be scanned by pyflakes.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.