Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce faillint in the CI workflow #2272

Merged
merged 1 commit into from
Mar 13, 2020

Conversation

pracucci
Copy link
Contributor

What this PR does:
A common mistake (I did it too) is to import github.com/bmizerany/assert instead of github.com/stretchr/testify/assert. In this PR I've introduced faillint as further lint step to ensure no blacklisted package is imported. Of you try to use github.com/bmizerany/assert the linter will fail, suggesting which package should be used instead:

/go/src/github.com/cortexproject/cortex/pkg/storage/tsdb/config_test.go:8:2: package "github.com/bmizerany/assert" shouldn't be imported, suggested: "github.com/stretchr/testify/assert"

faillint will also be useful in the future to enforce some design patterns (ie. once completed the Prometheus metrics refactoring, we'll be able to forbid the usage of prometheus.NewGauge() in favor of promauth.With(reg).NewGauge() and so on).

Which issue(s) this PR fixes:
N/A

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Marco Pracucci <marco@pracucci.com>
Copy link
Contributor

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This is useful, and we can extend it with more packages (eg. old context package), in the future.

@pracucci pracucci merged commit 8d3f3fb into cortexproject:master Mar 13, 2020
@pracucci pracucci deleted the introduce-faillint-to-ci branch March 13, 2020 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants