-
Notifications
You must be signed in to change notification settings - Fork 1
Rewrite for v1.2 #44
Description
Its a given that the codebase needs a rewrite for damn sure. Everything is completely fucked and honestly its hard to implement new features into the Bot without serious changes to it. I'm looking to completely rewrite the bot for v1.2 and get rid of this shit.
Some of the issues with the current codebase is just lack of readability and knowledge of the codebase or from day 1 is needed to even understand some of the concepts. A couple files are completely just comments without any use or anything.
1. Major issues with the current code-base
1.1 Garbage Code
Issue
- Most files completely have no use or is redundant to the actual Bot.
Examples
- Ava testing is useless, it has no tests written for it.
Consequences
- Working with the code is nearly impossible and debugging is even harder due to literal callback hell.
1.2 Lack of Tests
Issue
- Components cannot be unit tested.
Consequences
- Development times are lengthened due to not being able to have components of the Bot tested before it's shipped, therefore I have to spend time looking for edge cases and hoping that I fixed them and nothing breaks in production.
- Putting a lot of trust into if a component is actually okay.
- Onboarding of contributors is hard because they cannot rely on tests to detect errors, but is dependent on more senior developers who knows the entire codebase.
1.3 Varying coding styles and quality (minor)
Issue
-
The code mixes callbacks, promises, and async/await
-
The general quality of the code is low/dirty/hacky
-
Tests appear to have been written to test current code behavior rather than specified behavior.
Consequences
-
Older files are hard to maintain
-
Newer code ends up as a mix of different styles, making it hard to maintain
-
Incorrect behavior is not detected, and changes are made to comply with incorrect tests.
Note
While this issue can be fixed through refactoring, the lack of unit tests makes it difficult to assess the correctness of the refactoring.
1.3 Github Branching
Issue
- I feel like the branches are completely fucked and the pipeline is just yikes.
Consquences
- Workflow is massively effected and errors are more common. Bots such as @dependabot is completely shit to handle with our branching system.
Solution
I can use git flow to order it.
2. Conclusion: Rewrite is a likely route to take
From the issues I've listed we can conclude that:
-
The codebase is absolute shit and needs a quality boost especially with the lack of tests.
-
Rewriting the codebase will be easier and will boost the quality by a shit ton rather than refactoring it.
-
A limited number of components of the old codebase can be pulled into the new codebase, but this is limited to the unit-testable pieces of code.
3. Proposed Timeline:
- Work on the change will start either on 1.1 or right now and push to 1.2 after 1.1 is released.
- Will take a bit
- After the rewrite is complete, I'll look at options on how to host it? idk
4. Approach to the Bot:
In order to resolve and avoid the problems I had when I first started we should:
- Have a clear architecture / plan on all features before we actually start working on them.
- Enforce codestyles to have every aspect of the code clear for future contributors.
- Have sufficent test coverages for the flow of the app.
- If something is not testable, there is an issue with our codebase.
- Recreate the workflow and document the steps and process.
- Have plenty of documentation for key features.
- Plan ahead and have features ready for EMCA2021. (Mainly Decorators)