1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-24 08:32:22 +02:00

Add check for argument length to "file-header" rule

This commit is contained in:
dshemin 2019-12-02 02:04:49 +07:00
parent 98b0cb55b7
commit a5c77eed9f

View File

@ -16,9 +16,13 @@ var (
// Apply applies the rule to given file.
func (r *FileHeaderRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
if len(arguments) != 1 {
panic(`invalid configuration for "file-header" rule`)
}
header, ok := arguments[0].(string)
if !ok {
panic("Invalid argument to the FileHeaderRule")
panic(`invalid argument for "file-header" rule: first argument should be a string`)
}
failure := []lint.Failure{