Skip to content

Refactor builds badge, encapsulate inside a class

Grzegorz Bizon requested to merge refactor/project-badges-interface into master

This merge requests attempts to introduce interface for all badges. Currently we only have a build badge, but other badges are in plans, like coverage badge. Encapsulating this inside class and creating an abstraction has some benefits:

  1. It will be easier to implement new badges
  2. It will be easier to create badges that will use SVG template, and Nokogiri::XML to modify content (like coverage badge)
  3. It will be easier to test badges, and write unit tests for badges
  4. It will be easier to refactor badges (like to remove Ci::ImageForBuildService and replace with svg templates)
  5. It will be easier to remove badges from assets, leaving just one template for SVG (we currently have svg images for each build badge, like build-success.svg and build-unknown.svg etc)
  6. It will be easier to remove unused helpers (CiBadgeHelper)
  7. It will be easier to reuse badges

/cc @ayufan @DouweM @rspeicher

Merge request reports