2023-03-15 16:00:52 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2022-03-18 18:14:03 +00:00
|
|
|
rules:
|
|
|
|
- id: wrong-lock-unlock
|
|
|
|
patterns:
|
|
|
|
- pattern-either:
|
|
|
|
- pattern: |
|
|
|
|
$M.Lock()
|
|
|
|
defer $M.RUnlock()
|
|
|
|
- pattern: |
|
|
|
|
$M.RLock()
|
|
|
|
defer $M.Unlock()
|
|
|
|
- pattern: |
|
|
|
|
$M.Lock()
|
|
|
|
defer $M.Lock()
|
|
|
|
- pattern: |
|
|
|
|
$M.RLock()
|
|
|
|
defer $M.RLock()
|
|
|
|
message: "Wrong lock/unlock pair?"
|
|
|
|
languages: [go]
|
|
|
|
severity: ERROR
|