‘dput.dcut’: Convert ‘print’ statements to ‘sys.stdout.write’ calls.
[dput.git] / TODO.code-style
blobdec9978d3d2ee2989a417a9c4eccb59fc2015bed
1 To Do list for improving code idioms
2 ####################################
4 To Do
5 =====
7 * Ensure all files explicitly opened are closed correctly.
9 * Encapsulate application state in a class.
11   * dput.dput.PackageUploadApplication
12   * dput.dcut.CommandUploadApplication
14 * Reduce ‘if __name__ == '__main__'’ block to minimum.
16 * Use idiomatic ‘configparser’ processing.
18   * Migrate to ‘ConfigParser.read’ method.
19   * Remove direct query to ‘DEFAULT’ config section.
21 * Use ‘str.format’ for all string formatting and interpolation.
23   * Remove usage of ‘%’ formatting operator.
25 * Use ‘argparse’ for command-line parsing.
27   * Remove usage of ‘getopt’.
29 * Use ‘logging’ module throughout for all messages.
31   * Remove usage of ‘print’ for debug-level messages.
32   * Remove usage of ‘print’ for Informational messages.
33   * Remove usage of ‘print’ for warning message.
34   * Remove usage of ‘print’ for error messages.
35   * Remove usage of ‘print’ for critical error messages.
37 * Use ‘sys.stdout.write’ for all normal output.
39   * Remove usage of ‘print’ for normal output.
41 * Use a Python native SSH library (e.g. Paramiko or Spur).
43   * Remove usage of subprocess for SSH.
45 * Use a Python native GnuPG library (e.g. ‘python-gnupg’).
47   * Remove usage of subprocess for GnuPG.
50 Done
51 ====
53 * Remove use of global variables.
55   * dput.dcut.progname
56   * dput.dcut.version
57   * dput.dcut.USAGE
58   * dput.dput.dput_version
59   * dput.dput.files_to_remove
60   * dput.dput.files_to_upload
61   * dput.dput.USAGE
62   * dput.dput.config_file
63   * dput.dput.config
64   * dput.dput.check_only
65   * dput.dput.dinstall
66   * dput.dput.delay_upload
67   * dput.dput.unsigned_upload
68   * dput.dput.simulate
69   * dput.dput.upload_methods
71 * Use ‘subprocess’ API for all subprocess interaction.
73   * Remove usage of ‘os.popen3’.
74   * Migrate ‘os.system’ → ‘subprocess.call’.
75   * Migrate ‘os.waitpid’ → ‘subprocess.check_call’.
76   * Migrate ‘os.popen’ → ‘subprocess.Popen’.
77   * Migrate ‘os.spawnv’ → ‘subprocess.check_call’.
81     Local variables:
82     coding: utf-8
83     mode: text
84     mode: rst
85     End:
86     vim: fileencoding=utf-8 filetype=rst :