]> git.giacomolli.uk - onechat/blobdiff - .golangci.yml
Receive images in WhatsApp batches
[onechat] / .golangci.yml
index 1a7a596e15cbc0bc972760258c61626ad2d4f0ab..2a4cdaffbe7ef68a2b0308907941bf54c086258e 100644 (file)
@@ -6,3 +6,65 @@ linters:
     - errorlint
     - gocritic
     - testifylint
+    - revive
+    - wrapcheck
+    - nlreturn
+    - wsl_v5
+  settings:
+    wsl_v5:
+      # go-code: Keep an operation with its immediate error check.
+      enable:
+        - err
+        - after-block
+        - after-decl
+        - after-defer
+        - after-expr
+        - after-go
+      # go-code: Keep a short declaration with its immediate use.
+      allow-first-in-block: true
+      allow-whole-block: true
+      cuddle-max-statements: 2
+      disable:
+        # go-code: Keep a short declaration with its immediate assignment use.
+        - assign
+        # go-code: Keep a short declaration, its operation, and its error check
+        # together.
+        - if
+        # go-code: A short declaration can feed the next loop setup.
+        - for
+        # go-code: A short declaration can feed the next switch setup.
+        - switch
+        # go-code: Keep a declared cleanup with its immediate defer.
+        - defer
+        # go-code: Keep a short declaration with its immediate append use.
+        - append
+        # go-code: Keep a short declaration with its immediate worker setup.
+        - go
+    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\('