Code Quailty Improvements
Hey @cloudfoundry, I recently ran the DeepSource static analyzer on this repo, and it generated this report that I think you should check out, I am opening this PR to fix a few of them.
Description
- Replace x.Sub(time.Now()) with time.Until(x): This will aid readability as both compile down to the same object code.
- Improve empty string test: use empty string as the condition instead of checking if it's length is 0.
- Merge variable declarations and assignments: Helps with readability and decreases a few lines of code.
- Add DeepSource configurations: Configures the DeepSource static analysis tool.
Motivation and Context
This PR has been opened to demonstrate how the DeepSource static analyser can be of great help in maintaining and increasing the code quality of software written in Go and multiple other programming languages. I also found it to be a better alternative to CodeClimate and feel it would be worth trying out.
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Docs update
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have followed the guidelines in CONTRIBUTING.md, including the required formatting of the commit message
The committers are authorized under a signed CLA.
- :white_check_mark: Devdutt Shenoi (971fe50453a6933849c6a54aa3c03787617ac5d3, 63dc83d7c4f90c1c04613aa7654c318268ffaaeb, 59dc5cf55dcf88101ec086027e5d2f0fd6d3f4b0, 72b7c0c84335fa835e6ca843d0cefebc00beaeaa, 73cc0697fac14165c9f4b0134936f8bd92328eab)
Hi @de-sh , thanks for submitting this PR. It looks like these changes are causing the backend unit tests to fail (TestRegisterCFCluster - https://travis-ci.com/github/cloudfoundry/stratos/jobs/463869775). The other travis failures look to be env related, so we can try those again once the unit tests are fixed.