netlify / git-gateway

A Gateway to Git APIs
MIT License
404 stars 89 forks source link

Fix quality issues, add DeepSource config #43

Open sourya opened 4 years ago

sourya commented 4 years ago

- Summary

While the repository runs go vet and go lint as part of CI, which detects and shows some issues, it doesn't really block the PR for major issues, and the issues are raised for the entire code in the repository. Ideally, the issues should be raised for the changes in a given PR only.

To solve the above problems, this PR introduces DeepSource for code quality analysis.

DeepSource is a free for open-source tool that helps developers and teams write good code. It continuously analyzes code changes on every PR and gives a central dashboard to see code health in terms of issues and important metrics. DeepSource is used by teams at Uber, NASA and DGraph among others.

I've added a customized .deepsource.toml file for this repo, and made some fixes for issues existing in the code highlighted by DeepSource. To keep analyzing code on every change, integration is easy:

  1. Merge this PR.
  2. Sign up on DeepSource and grant access to this repository here.
  3. Activate analysis for this repo here.

You can also take a look at the docs. I'll be happy to answer any questions! :)

- Test plan

The changes to the code are such that they do not change the functionality in any way. The error handling, the removal of the unused constant and the removal of the redundant parameter (as noted in the changelog) would be caught by the go build tool if there were any new issues.

- Description for the changelog

  1. Add error handling for json.Marshal, which was previously unhandled.
  2. Remove a redundant parameter to make for slice, where the capacity parameter is not really required.
  3. Remove the const baseConfigKey = "", which is not used anywhere.

- A picture of a cute animal (not mandatory but encouraged)

Beebo