Opened 14 years ago

Last modified 9 years ago

#1327 new defect

[python] DebCheck QA: undefined name 'main'

Reported by: hamish Owned by: grass-dev@…
Priority: minor Milestone: 6.4.6
Component: Python Version: 6.4.0
Keywords: d.rast3d, code analysis, pyflakes, static code analysis Cc:
CPU: Unspecified Platform: Linux

Description

(see #1311, http://qa.debian.org/daca/pyflakes/sid/grass_6.4.0-2_i386.html)

  • ./usr/lib/grass64/etc/gui/scripts/d.rast3d:36: undefined name 'main'

thanks, Hamish

Change History (5)

comment:1 by neteler, 14 years ago

The script is here: etc/wxpython/scripts/d.rast3d (no idea why Debian has it in etc/gui/...).

Differences:

d.rast3d (DebCheck QA complains):

...
from grass.script import core as grass

if __name__ == "__main__":
    options, flags = grass.parser()
    main()

p.rast (same directory, DebCheck QA does not complain):

...
import sys
import os
import grass.script as grass

def construct_command(cmd):
...
if __name__ == "__main__":
    options, flags = grass.parser()
    main()

comment:2 by neteler, 13 years ago

A more recent test is at http://qa.debian.org/daca/pyflakes/sid/grass_6.4.1-1_i386.html (note some of those modules are no longer in 6.4.2)

comment:3 by wenzeslaus, 10 years ago

Keywords: code analysis pyflakes static code analysis added
Milestone: 6.4.26.4.5
Priority: normalminor

Note that you can use pep8, pyflakes, pylint or pychecker by yourself to check the code in order to avoid downstream reporting trivial errors. See GRASS-specific configuration files in tools directory.

See also suggestions to test code quality and a script in sandbox dedicated to this purpose. DACA web page is also interesting.

However, I'm not sure if we will ever fix this for 6.x. Some of the Python developers are working on 7.x to minimize number of these "code smells" for example using pep8 or pylint. So, this might be wontfix for 6.x but it is a big goal for 7.x which might be described and discussed in several mega tickets if desired.

comment:4 by martinl, 9 years ago

Milestone: 6.4.5

Ticket retargeted after milestone closed

comment:5 by martinl, 9 years ago

Milestone: 6.4.6
Note: See TracTickets for help on using tickets.