diff options
| author | 2025-10-18 03:06:09 +0300 | |
|---|---|---|
| committer | 2025-10-18 03:53:48 +0300 | |
| commit | ec7de1aa1ad2bc14b3b1572ea4cc5024a6c662ae (patch) | |
| tree | 5dcc03e76b14f1bb522f16ea98e975a7ef5bbb88 /src/tg/method-macros.lisp | |
| parent | Add "tiny ..." trigger (diff) | |
| download | ukkoclot-ec7de1aa1ad2bc14b3b1572ea4cc5024a6c662ae.tar.gz ukkoclot-ec7de1aa1ad2bc14b3b1572ea4cc5024a6c662ae.tar.xz ukkoclot-ec7de1aa1ad2bc14b3b1572ea4cc5024a6c662ae.zip | |
Add ocicl lint
Diffstat (limited to '')
| -rw-r--r-- | src/tg/method-macros.lisp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/tg/method-macros.lisp b/src/tg/method-macros.lisp index 3599328..e614db9 100644 --- a/src/tg/method-macros.lisp +++ b/src/tg/method-macros.lisp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com> | 2 | ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs <perkontevs@gmail.com> |
| 3 | (defpackage :ukkoclot/tg/method-macros | 3 | (defpackage :ukkoclot/tg/method-macros |
| 4 | (:use :c2cl :iterate) | 4 | (:use :c2cl :iterate) |
| 5 | (:import-from :serapeum :take) | ||
| 5 | (:import-from :ukkoclot/state :bot) | 6 | (:import-from :ukkoclot/state :bot) |
| 6 | (:import-from :ukkoclot/strings :ends-with :lisp->camel-case) | 7 | (:import-from :ukkoclot/strings :ends-with :lisp->camel-case) |
| 7 | (:import-from :ukkoclot/transport :do-call) | 8 | (:import-from :ukkoclot/transport :do-call) |
| @@ -13,7 +14,10 @@ | |||
| 13 | 14 | ||
| 14 | (defparameter +unique+ (gensym)) | 15 | (defparameter +unique+ (gensym)) |
| 15 | 16 | ||
| 16 | (defun make-param (name type &optional (default +unique+) &key (skip-if-default (not (eq default +unique+)))) | 17 | ;; TODO: Fix optional-and-key ! |
| 18 | (defun make-param (name type ; lint:suppress avoid-optional-and-key | ||
| 19 | &optional (default +unique+) | ||
| 20 | &key (skip-if-default (not (eq default +unique+)))) | ||
| 17 | (let ((default (if (eq default +unique+) | 21 | (let ((default (if (eq default +unique+) |
| 18 | `(error ,(format nil "No value given for ~A" name)) | 22 | `(error ,(format nil "No value given for ~A" name)) |
| 19 | default))) | 23 | default))) |
| @@ -29,7 +33,7 @@ | |||
| 29 | (defun path-from-name (name) | 33 | (defun path-from-name (name) |
| 30 | (let ((str (lisp->camel-case (symbol-name name)))) | 34 | (let ((str (lisp->camel-case (symbol-name name)))) |
| 31 | (if (ends-with str "%") | 35 | (if (ends-with str "%") |
| 32 | (subseq str 0 (- (length str) 1)) | 36 | (take (- (length str) 1) str) |
| 33 | str))) | 37 | str))) |
| 34 | 38 | ||
| 35 | (defun emit-append-to-args (param args) | 39 | (defun emit-append-to-args (param args) |
| @@ -46,7 +50,7 @@ | |||
| 46 | (let ((revparams (reverse params)) | 50 | (let ((revparams (reverse params)) |
| 47 | (args (gensym "ARGS")) | 51 | (args (gensym "ARGS")) |
| 48 | (bot (gensym "BOT"))) | 52 | (bot (gensym "BOT"))) |
| 49 | `(defun ,name (,bot &key ,@(iter (for param in params) | 53 | `(defun ,name (,bot &key ,@(iter (for param in params) ; lint:suppress lambda-list-invalid |
| 50 | (collect (emit-defun-arg param)))) | 54 | (collect (emit-defun-arg param)))) |
| 51 | (let (,args) | 55 | (let (,args) |
| 52 | ,@(iter (for param in revparams) | 56 | ,@(iter (for param in revparams) |