RedditVideoMakerBot icon indicating copy to clipboard operation
RedditVideoMakerBot copied to clipboard

Refactored config

Open efa2d19 opened this issue 3 years ago • 5 comments

Description

I'm not fond of the way config was written, so I changed it a bit. Now it way more readable and accessible.

  • Added typing
  • Added explanations
  • Changed the way checks was provided in handle_input
  • Replaced crawl_and_check w/ nested_get & nested_set

Issue Fixes

None I guess, I just didn't like the way it was written:

  • w/o typing & explanation
  • the way checks was provided in handle_input
  • the way config template was looking, it's hard to read at least
Checklist
  • [x] I am pushing changes to the develop branch
  • [x] I am using the recommended development environment
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have formatted and linted my code using python-black and pylint
  • [x] I have cleaned up unnecessary files
  • [x] My changes generate no new warnings
  • [x] My changes follow the existing code-style
  • [x] My changes are relevant to the project

How to test the changes

  1. Rename config.toml to config.toml.bak
  2. Run the script
  3. Do your tests
  4. Delete new config.toml
  5. Rename config.toml.bak to config.toml

Try to play w/ different scenarios, for instance, what if one field is incorrect

efa2d19 avatar Jul 24 '22 19:07 efa2d19

Actually don't even need that

JasonLovesDoggo avatar Jul 25 '22 03:07 JasonLovesDoggo

Dude go through the enhancement list and do that Why fix things that aren't broken...

JasonLovesDoggo avatar Jul 25 '22 03:07 JasonLovesDoggo

Besides nobody is ever supposed to actually edit that file except for a dev who can read it fine

JasonLovesDoggo avatar Jul 25 '22 03:07 JasonLovesDoggo

@JasonLovesDoggo You sure you want to close it? I know it works fine, but it's not great.

  • config template looks bad and is in fact unreadable, + not following toml rulebook
  • 2 recursive functions is hell to debug if something will ever happen
  • typings will never hurt nobody
  • it's kinda bad code if the code is only for dev who can read it fine, everyone should understand it

Just give it a look. It's not that big, I renamed lots of thing there unintentionally but it's still almost the same code. And if I'm not mistaken you were looking for a guy to refactor the code so it won't be unnecessary.

efa2d19 avatar Jul 25 '22 08:07 efa2d19

Dude go through the enhancement list and do that Why fix things that aren't broken...

Yup, I will. While I'm waiting on new-webdriver to be merged I wanted to address thing no-one would

efa2d19 avatar Jul 25 '22 08:07 efa2d19