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

Enable linting on test directory #1491

Merged
merged 2 commits into from
Sep 7, 2022
Merged

Conversation

helsaawy
Copy link
Contributor

@helsaawy helsaawy commented Aug 24, 2022

Currently linting is not run on files with the admin, functional, or integration build constraints, which precludes test files within hcn and ./internal/safefiles.
Additionally, golanglint-ci only processes a module, so it does not lint the ./test directory.

This PR updates the CI to run both from the root and from within the test module.
Additionally, it updates the build tags used by the linters, excludes the files within cri-containerd/test-images (since they are just used for building docker images to test with), and ignores linting errors that the package name cri-containerd is invalid because of the -.

Finally, the second commit updates files to conform to the linter.

@helsaawy helsaawy requested a review from a team as a code owner August 24, 2022 23:31
@helsaawy helsaawy changed the title He/ci tests Enable linting on test directory Aug 24, 2022
@helsaawy helsaawy force-pushed the he/ci-tests branch 7 times, most recently from cd5489f to 6c01695 Compare August 31, 2022 22:02
hcn/hcnutils_test.go Show resolved Hide resolved
internal/guest/bridge/bridge_v2.go Show resolved Hide resolved
pkg/amdsevsnp/report.go Outdated Show resolved Hide resolved
Updated CI to lint from within test directory. Currently, it does not
since it is a different module.
Additionally, golangci-lint uses `GOOS` to decide what files to
evaluate, so matrix was upddated with GOOS.

Updated lint config to analyze test files, both within `./test` with
`functional` tag, and unit tests with `integration` tag.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Removed unnecessary code, added exceptions for most issues.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Copy link
Contributor

@anmaxvl anmaxvl left a comment

Choose a reason for hiding this comment

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

lgtm

@helsaawy helsaawy merged commit 44a2b27 into microsoft:main Sep 7, 2022
@helsaawy helsaawy deleted the he/ci-tests branch September 7, 2022 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants