Enforce go struct field comments in go lint job of secure analyzer.yml template
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
As discussed here and here, it seems that the golint tool does not enforce comments on struct member names, and this is not even an option. We need to find another linter that enforces this, and use it in the go lint job. See CI config.
See golint usage
Usage of /Users/facatteau/go/bin/golint:
golint [flags] # runs on package in current directory
golint [flags] [packages]
golint [flags] [directories] # where a '/...' suffix includes all sub-directories
golint [flags] [files] # all must belong to a single package
Flags:
-min_confidence float
minimum confidence of a problem to print it (default 0.8)
-set_exit_status
set exit status to 1 if any issues are found
Intended users
Proposal
find and install a Go linter that checks that exported struct fields are documented
Implementation plan
-
investigate all the linters provided by golangci-lint to determine if a linter exists that will ensure that struct fields have Doc Comments Run
golangci-lint lintersto see a list of available linters -
update the CI config
Further details
This change will lead to fewer unnecessary comments in MRs such as this
What does success look like, and how can we measure that?
The go lint job should fail if Go struct fields are not commented
What is the type of buyer?
GitLab Ultimate Enterprise Edition
Is this a cross-stage feature?
Yes, this affects all secure analyzers