ValvePython / steamctl

🤸 Take control of Steam from your terminal
https://pypi.org/project/steamctl/
MIT License
311 stars 16 forks source link

Minor refurbishment #69

Closed woctezuma closed 1 year ago

woctezuma commented 1 year ago
steamctl/clients.py:141:13: B001 Do not use bare `except:`, it also catches unexpected events like
memory errors, interrupts, system exit, and so on. Prefer `except Exception:`. 
If you're sure what you're doing, be explicit and write `except BaseException:`.
steamctl/clients.py:174:37: B006 Do not use mutable data structures for argument defaults. 
They are created during function definition time.
All calls to the function reuse this one instance of that data structure, persisting changes between them.
steamctl/commands/apps/gcmds.py:247:17: B001 Do not use bare `except:`, it also catches unexpected events like
memory errors, interrupts, system exit, and so on. Prefer `except Exception:`. 
If you're sure what you're doing, be explicit and write `except BaseException:`.
steamctl/commands/apps/gcmds.py:276:29: F541 f-string is missing placeholders
steamctl/commands/depot/gcmds.py:77:48: E711 comparison to None should be 'if cond is not None:'
steamctl/utils/prompt.py:9:34: E712 comparison to True should be 'if cond is True:' or 'if cond:'
steamctl/utils/prompt.py:10:33: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
steamctl/utils/storage.py:57:20: B902 Invalid first argument 'seconds' used for instance method.
Use the canonical first argument name in methods, i.e. self.

steamctl\commands\depot\gcmds.py:281:38 [FURB110]: Replace `x if x else y` with `x or y`

Sometimes ternary (aka, inline if statements) can be simplified to a single or expression.

Bad:

z = x if x else y

Good:

z = x or y

Note: if x depends on side-effects, then this check should be ignored.

steamctl\commands\webapi\cmds.py:51:13 [FURB105]: Replace `print("")` with `print()`
steamctl\commands\webapi\cmds.py:85:17 [FURB105]: Replace `print("")` with `print()`
steamctl\commands\webapi\cmds.py:144:9 [FURB105]: Replace `print("")` with `print()`

print("") can be simplified to just print().

rossengeorgiev commented 1 year ago

These all valid, but I rather run black on all the code instead

woctezuma commented 1 year ago

The black code formatter would not raise these issues. These were raised by:

That being said, no problem. 😉