From ec7de1aa1ad2bc14b3b1572ea4cc5024a6c662ae Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sat, 18 Oct 2025 03:06:09 +0300 Subject: Add ocicl lint --- src/tg/method-macros.lisp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/tg/method-macros.lisp') 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 @@ ;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs (defpackage :ukkoclot/tg/method-macros (:use :c2cl :iterate) + (:import-from :serapeum :take) (:import-from :ukkoclot/state :bot) (:import-from :ukkoclot/strings :ends-with :lisp->camel-case) (:import-from :ukkoclot/transport :do-call) @@ -13,7 +14,10 @@ (defparameter +unique+ (gensym)) - (defun make-param (name type &optional (default +unique+) &key (skip-if-default (not (eq default +unique+)))) + ;; TODO: Fix optional-and-key ! + (defun make-param (name type ; lint:suppress avoid-optional-and-key + &optional (default +unique+) + &key (skip-if-default (not (eq default +unique+)))) (let ((default (if (eq default +unique+) `(error ,(format nil "No value given for ~A" name)) default))) @@ -29,7 +33,7 @@ (defun path-from-name (name) (let ((str (lisp->camel-case (symbol-name name)))) (if (ends-with str "%") - (subseq str 0 (- (length str) 1)) + (take (- (length str) 1) str) str))) (defun emit-append-to-args (param args) @@ -46,7 +50,7 @@ (let ((revparams (reverse params)) (args (gensym "ARGS")) (bot (gensym "BOT"))) - `(defun ,name (,bot &key ,@(iter (for param in params) + `(defun ,name (,bot &key ,@(iter (for param in params) ; lint:suppress lambda-list-invalid (collect (emit-defun-arg param)))) (let (,args) ,@(iter (for param in revparams) -- cgit v1.2.3