Debian Codegraph @

TODO.code-style

raw
1 To Do list for improving code idioms
2 ####################################
3
4 To Do
5 =====
6
7 * Remove use of global variables.
8
9 * dput.dput:debug
10
11 * Ensure all files explicitly opened are closed correctly.
12
13 * Encapsulate application state in a class.
14
15 * dput.dput.PackageUploadApplication
16 * dput.dcut.CommandUploadApplication
17
18 * Use standard OS exit status values.
19
20 * dput.helper.dputhelper.EXIT_STATUS_SUCCESS → os.EX_OK
21 * dput.helper.dputhelper.EXIT_STATUS_FAILURE →
22 * os.EX_USAGE (“the command was used incorrectly”)
23 * os.EX_NOINPUT (“an input file did not exist or was not readable”)
24 * os.EX_UNAVAILABLE (”a required service is unavailable”)
25 * os.EX_SOFTWARE (“an internal software error was detected”)
26 * os.EX_OSERR (“an operating system error was detected”)
27 * os.EX_OSFILE (“some system file did not exist, could not be opened, or had
28 some other kind of error”)
29 * os.EX_CANTCREAT (“a user specified output file could not be created”)
30 * os.EX_IOERR (“an error occurred while doing I/O on some file”)
31 * os.EX_TEMPFAIL (“a temporary failure occurred. This indicates something
32 that may not really be an error”)
33 * os.EX_PROTOCOL (“a protocol exchange was illegal, invalid, or not
34 understood”)
35 * os.EX_NOPERM (“there were insufficient permissions to perform the
36 operation (but not intended for file system problems)”
37 * os.EX_CONFIG (“some kind of configuration error occurred”)
38
39 * Use idiomatic ‘configparser’ processing.
40
41 * Migrate to ‘ConfigParser.read’ method.
42
43 * Use ‘argparse’ for command-line parsing.
44
45 * Remove usage of ‘getopt’.
46
47 * Use ‘logging’ module throughout for all messages.
48
49 * Remove usage of ‘sys.std{out,err}.write’ for debug-level messages.
50 * Remove usage of ‘sys.std{out,err}.write’ for informational messages.
51 * Remove usage of ‘sys.std{out,err}.write’ for warning message.
52 * Remove usage of ‘sys.std{out,err}.write’ for error messages.
53 * Remove usage of ‘sys.std{out,err}.write’ for critical error messages.
54
55 * Migrate use of ‘os.path’ → ‘pathlib’ for filesystem path functionality.
56
57 * dput/configfile.py
58 * dput/dcut.py
59 * dput/dput.py
60 * dput/helper/dputhelper.py
61 * dput/methods/ftp.py
62 * dput/methods/http.py
63 * dput/methods/local.py
64 * dput/methods/rsync.py
65 * dput/methods/scp.py
66 * setup.py
67 * test/helper.py
68 * test/test_changesfile.py
69 * test/test_configfile.py
70 * test/test_dcut.py
71 * test/test_dput.py
72 * test/test_dput_main.py
73 * test/test_methods.py
74
75 * Generate text output content each in an explicit generator function.
76
77 * dcut:write_commands
78 * dput:create_upload_file
79
80 * Write text output files from a passed-in iterable for text lines.
81
82 * dcut:write_commands
83 * dput:create_upload_file
84
85 * Replace `dputhelper.FileWithProgress` with a robust third-party implementation
86 of a progress display.
87
88 * Possible candidate: ‘python3-progress’
89 <URL: https://pypi.org/project/progress/>
90 * Possible candidate: ‘python3-ttystatus’
91 <URL: UNKNOWN>
92 * Possible candidate: ‘python3-rich’
93 <URL: https://pypi.org/project/rich/>
94 * Possible candidate: ‘python3-tqdm’
95 <URL: https://pypi.org/project/tqdm/>
96
97
98 Done
99 ====
100
101 * Remove use of global variables.
102
103 * dput.dcut.progname
104 * dput.dcut.version
105 * dput.dcut.USAGE
106 * dput.dput.dput_version
107 * dput.dput.files_to_remove
108 * dput.dput.files_to_upload
109 * dput.dput.USAGE
110 * dput.dput.config_file
111 * dput.dput.config
112 * dput.dput.check_only
113 * dput.dput.dinstall
114 * dput.dput.delay_upload
115 * dput.dput.unsigned_upload
116 * dput.dput.simulate
117 * dput.dput.upload_methods
118
119 * Use ‘subprocess’ API for all subprocess interaction.
120
121 * Remove usage of ‘os.popen3’.
122 * Migrate ‘os.system’ → ‘subprocess.call’.
123 * Migrate ‘os.waitpid’ → ‘subprocess.check_call’.
124 * Migrate ‘os.popen’ → ‘subprocess.Popen’.
125 * Migrate ‘os.spawnv’ → ‘subprocess.check_call’.
126
127 * Use ‘sys.stdout.write’ for all normal output.
128
129 * Remove usage of ‘print’ for normal output.
130
131 * Use ‘str.format’ for all string formatting and interpolation.
132
133 * Remove usage of ‘%’ formatting operator.
134
135 * Reduce ‘if __name__ == '__main__'’ block to minimum.
136
137 * Install top-level programs using Setuptools ‘entry_points’ feature.
138
139 * Use idiomatic ‘configparser’ processing.
140
141 * Use ‘ConfigParser.default_section’ instance attribute instead of hard-coded
142 'DEFAULT' name.
143
144
145 ..
146 Local variables:
147 coding: utf-8
148 mode: text
149 mode: rst
150 End:
151 vim: fileencoding=utf-8 filetype=rst :