Tach,
1. Du musst bei neueren Python 3 Versionen bei Klassen nicht mehr von Object erben.
Code:
15: class AccountCreator:
+ readability
__________________________________________________
2. Prinzipiell würde ich dir empfehlen mit Python's
typing package strengere Typisierung einzubauen.
+ readability
+ maintainability
+ stability
__________________________________________________
3. Das data struct in Zeilen 38 - 52 ist ein no-go meiner Meinung nach. Seit Python 3.8 sind Dataclasses buildin vorhanden, nutze diese! Guckst du
+ readability
+ maintainability
__________________________________________________
4. Stick to Pep8! PyCharm bietet dafür auch eine wunderbare Integration an. Wir leben in einem OpenSource zeitalter, Konventionen sind wichtig, außerdem wird dich jeder erfahrene Entwickler direkt als Vollidiot abstempeln wenn du CamelCase Funktionsnamen in Python wählst. Das ist der schlimmste Pep8 Bruch welchen man sich leisten kann.
Prinzipiell brichst du in dem Snippet viel Pep8, glaube ein Linter wäre wirklich sinnvoll für dich.
+ readability
+ maintainability
__________________________________________________
5. If condition overhead (Zeile 31)
Code:
if accountCheck == True:
das True kannst dir sparen,
reicht
+ readability
__________________________________________________
6. Format strings
Code:
self.sendRequest('https://forsaken-kingdom.com/api/check/account/'+username)
no no no ...
Würde zwar eher zu einer url-factory greifen, aber wenn schon string concatenation dann bitte mit format string
Code:
url = f'https://forsaken-kingdom.com/api/check/account/{username}'
+ readability
if factory: stability
__________________________________________________
7. Zeile 96...
Was sagt Zen of Python bzgl. Fehlerbehandlung?
Quote:
|
Errors should never pass silently.
|
Was ist Zen of Python? -> Mach mal eine repl Shell auf und
__________________________________________________
__________________________________________________
Habe jetzt nicht auf Komplexität oder Patterns geachtet, aber rein stilistisch würdest du kein Code-Review in einem professionellen Umfeld passen.
Nimms mir nicht übel, fail early and hard!