CodexLink/discord-activity-badge

Refactorization Notice

CodexLink opened this issue · 0 comments

Notice

I will start updating this on June 5 as the content of this notice is incomplete. This project has been overdue since the thesis hit me.
Currently passive-updating this issue.

Another Notice

Some checkmarks copy the task lists from the following issues: #5, #6, and #9.

Why

Sooner or later (By June or July [if I graduated on time]), I will be refactoring the whole thing with the same workflow parameters and with more options. With that being said, I wanted to refactor this because just from looking at it, it is over complicated OOP approach, which intrigues me over a simple integration to README.

What

This section contains subsections of components that will be refactored.

General

  • Logger with Styling
  • Argparse Polishing (For Local-Serve)
  • HTTP Module (being async)
  • Proper Typing (Python 3.10)
  • Programming Approach (Modular-OOP)
  • Redundancy Consolidation of File Declaration (see, elements)
  • Github Action Notification Context (Further Improve)
  • Unit Testing
  • HTTP or Markdown Detection

Issue-Related

#5

  • Identification of other states other than Spotify in API Reference of Discord.py
  • Test Case of Streaming State.

#6

  • Target Branch (latest version and future v1 only targets default branch)
  • Author and Committer Interchangeable Information.
  • HTML Tagline Coverage (Right now, the script only supports Markdown Elements)
  • Rate-Limit Awareness.
  • Commit over changes or retain (Check for potential refactorization in regards to scanning it first before building the badge)
  • Commit Message with Date Formatting Support. IDEA: Use datatime.strftime feature and formatting.
  • Alert and Verbosity in action.yml (Those functionalities only exist when running the script in local)
  • Spotify Support and Extension
  • Time Display Customization (Implementation of Hours Only, Minutes Only, and Seconds Only)
  • Implementation of Commit Message with Time Distance (UTC Offset) with Recent Commit
  • Docker README Synchronization with Github Repository (See recent up with the docker repository)

Badge (badges.py)

  • Interchangeable Badge Provider BADGEN | SHIELDS | CUSTOM (If custom provided, provide the elements that can be bound to the structure).
    -[ ]

HTTPs (http.py)

We may create a repository for this one due to its reusability.

CI/CD (Dockerfile and Github Actions related)

  • Further Optimize the Script (???)
  • Optimize Dockerfile layers. (Such as installing and other such)

Constants (constants.py)

  • Redefine types. (I'm quite uncomfortable using NewType)

Core (entrypoint.py)

  • Reduce complexity such as expensive setup due to instantiation of classes. (With this, we may need to do Async Class Instantiation, depending on the situation, and also depending on how I overview it.)
  • (At Startup) Do not explicitly convert provided data to certain data types, use Pydantic.
  • Exception from Async Loop is sometimes being raised and otherwise.

Logging (logging.py)

  • Adapt (folioblock's logging style)[https://github.com/CodexLink/folioblocks/blob/latest/node/utils/logger.py]. This depends on the uvicorn's custom logging, so we need to learn something on that.)

README

  • Reduce the sample badges of the header.
  • Create headers based on the unit testing.
  • Remove screenshots (due to privacy).
  • Optimize and ensure that the procedures are flawless.