]> git.giacomolli.uk - onechat/blobdiff - .golangci.yml
Separate returns from longer statement blocks
[onechat] / .golangci.yml
index 1a7a596e15cbc0bc972760258c61626ad2d4f0ab..d5f20b34c84d8c768e034c4a208863b5f741e3a5 100644 (file)
@@ -6,3 +6,35 @@ linters:
     - errorlint
     - gocritic
     - testifylint
+    - revive
+    - wrapcheck
+    - nlreturn
+  settings:
+    nlreturn:
+      # go-code: Keep a short declaration with its immediate use.
+      block-size: 2
+    wrapcheck:
+      # go-code: Return ctx.Err() directly.
+      extra-ignore-sigs:
+        - "(context.Context).Err() error"
+  exclusions:
+    rules:
+      # go-code: A function with one error path can return it directly.
+      - linters: [wrapcheck]
+        path: ^records\.go$
+        source: 'return r\.file\.Close\(\)'
+      - linters: [wrapcheck]
+        path: ^log_test\.go$
+        source: 'return os\.Truncate\('
+      - linters: [wrapcheck]
+        path: ^sync_buffer_helper_test\.go$
+        source: 'return b\.buffer\.Write\('
+      - linters: [wrapcheck]
+        path: ^probe\.go$
+        source: 'return s\.inner\.Summarize\('
+      - linters: [wrapcheck]
+        path: ^view\.go$
+        source: 'return false, err'
+      - linters: [wrapcheck]
+        path: ^whatsapp\.go$
+        text: 'sqlstore\.Container\)\.Close\('