Uploaded image for project: 'Product Roadmaps'
  1. Product Roadmaps
  2. MMF-914

Built-in project badge feature

    XMLWordPrintable

    Details

    • Type: MMF
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Labels:

      Description

      Why

      Badges are widely used on open-source projects to show information about one's project. SonarCloud currently relies on the SVG Badge plugin to provide this feature. We want this feature to be a core feature for SonarCloud for the following reasons:

      • Currently, badges cannot be found easily by users because there's nothing in the UI which tells me that this feature exists
      • As we operate the service, we must master every part of it and prefer to not rely on third party plugins (to be able to react quickly in case of trouble)

      What

      As an open-source project, I want to be able to add badges on various public places:

      1. On the README page of my GitHub repository - i.e. a dev-oriented (so "technical") documentation
        • I would expect to add (at least) a badge that gives me the status of the quality gate
          • But I would also like to be able to display the main metrics - like the % of coverage for instance
        • I would expect this badge to looks exactly like what every other cloud service offers
      2. On the official website of my project - i.e. an end-user (so more "marketing") website
        • I would expect to add a badge that gives me the overall status of my project - i.e. the QG status
        • I would expect this badge to be nicer, probably looking more like a card

      As a closed source project, I would expect at least the first kind of badge to be available on the README page of my repository:

      • For example, like what we currently use on the README files of Governance
      • In this case, it should be possible to use a token to provide "read" credentials for third-party systems to retrieve this badge from a project that is private

      For all those use cases, I expect to:

      1. Easily discover the feature when I am on the project home page on SonarCloud
        • On the main page of a long-lived branch, there must be a link and/or an icon on which I can click
        • For short-lived branches, this should not be available (it's useless)
      2. Be guided to select what kind of badge I want to get:
        • The standard one (à la shield.io), for which I can select the following metrics:
          • Lines of Code
          • Quality Gate status
          • Coverage (coverage)
          • Duplications (duplicated_line_density)
          • Debt (sqale_index)
          • Bugs / Vulnerabilities / Code Smells
          • Reliability / Security / Maintainability Ratings
        • The "Quality Gate passed/failed" one
        • The "Scanned on SonarCloud" one, for which I can select the color
      3. Get the URL that I can easily copy-paste to use on my website
        • This URL automatically uses the correct project key and branch key (depending on which long-lived branch I'm currently browsing)

      How

      The WS that will serve the badges must be extremely efficient because they will be heavily requested. They should require as little memory as possible and answer as fast as possible.

      Ideally, it would be great to keep the same URL for the new WS as the ones defined by the SVG Badge plugin. If we can't or don't want, keeping at least the same parameters should help to handle the translation in the http front-end.

      This is a SonarCloud feature so the WS should not be visible in the WS API page on a SonarQube instance. We might extend this feature to SonarQube later on - but this is out of scope for the moment.

      If the URL parameters are invalid, an "error" badge must be used with a short and clear message. Cases of invalid URL parameters:

      • non existing project
      • non existing branch
      • branch is not a long-lived one
      • invalid metric

      Current Design Proposition for users to discover the badges

      https://invis.io/PZF8SV55M#/272454628_Badges_01

      Out of scope

      In the end, the badges for private projects (which require a token for authentication) has not been done in this MMF. This will be implemented at a later stage.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              fabrice.bellingard Fabrice Bellingard
              Reporter:
              fabrice.bellingard Fabrice Bellingard
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: