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:
parent
98b0cb55b7
commit
a5c77eed9f
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user