|
44 | 44 | )) |
45 | 45 | )) |
46 | 46 |
|
| 47 | +(@no_lint |
| 48 | + (_\@lint_add_control_rule ( _\@lint_add_rule _\@lint_add_control_rule SK_RULE ) t |
| 49 | + (SK_PUSH_VAR 'formlist) |
| 50 | + (let ( ( args (SK_ARGS) ) |
| 51 | + ) |
| 52 | + (when (eq 'SK_CONTROL (car args)) (pop args)) |
| 53 | + (foreach map sexp (cdr args) (SK_CHECK_FORM sexp)) |
| 54 | + ) |
| 55 | + (SK_POP_VAR 'formlist))) |
| 56 | + |
| 57 | +(@no_lint |
| 58 | + (_\@lint_add_control_rule ( SK_HINT SK_WARNING SK_ERROR ) t |
| 59 | + ;; TODO - This rule should work like `lsprintf' one |
| 60 | + nil)) |
| 61 | + |
47 | 62 |
|
48 | 63 | ;; =============================================================================================================== |
49 | 64 | ;; Rules |
|
64 | 79 | ;; ------------------------------------------------------- |
65 | 80 |
|
66 | 81 | ;; This is required at least when running Lint from the SKILL Interpreter |
67 | | -(_\@lint_add_rule ( status sstatus ) (not (errset (funcall 'status (car (SK_ARGS))))) |
68 | | - (SK_ERROR UNKNOWN_STATUS_FLAG "Unknown (s)status flag: %N\n" (SK_FORM))) |
| 82 | +(@no_lint |
| 83 | + (_\@lint_add_rule ( status sstatus ) (not (errset (funcall 'status (car (SK_ARGS))))) |
| 84 | + (SK_ERROR UNKNOWN_STATUS_FLAG "Unknown (s)status flag: %N\n" (SK_FORM)) |
| 85 | + )) |
69 | 86 |
|
70 | 87 |
|
71 | 88 | ;; ------------------------------------------------------- |
|
283 | 300 | (unless (and (listp defs) (forall def defs (and (listp def) (cdr def) (not (cddr def))))) |
284 | 301 | (SK_ERROR SP_WITH_DEFS "`@letf' first argument should be a list of expression-value pairs: %N" defs) |
285 | 302 | ) |
286 | | - (let ( ( vars (mapcar 'car defs) ) |
287 | | - ) |
288 | | - ;; Check definitions, then check body |
289 | | - (foreach map def defs |
290 | | - (SK_CHECK_FORM (list (caar def))) |
291 | | - (SK_CHECK_FORM (cdar def)) |
292 | | - ) |
293 | | - (foreach map sexp body (SK_CHECK_FORM sexp )) |
294 | | - ))) |
| 303 | + ;; Check definitions, then check body |
| 304 | + (foreach map def defs |
| 305 | + (SK_CHECK_FORM (list (caar def))) |
| 306 | + (SK_CHECK_FORM (cdar def)) |
| 307 | + ) |
| 308 | + (foreach map sexp body (SK_CHECK_FORM sexp )) |
| 309 | + )) |
295 | 310 |
|
296 | 311 | (_\@lint_add_control_rule ( @with ) t |
297 | 312 | ;; Expand macro to raise WARN MACROEXP1 in case of errors |
|
322 | 337 |
|
323 | 338 | (_\@lint_add_control_rule ( @assertion ) t |
324 | 339 | (destructuringBind ( @key doc skip info warn error out @rest body ) (SK_ARGS) |
| 340 | + doc ; Lint waiver |
325 | 341 | (foreach map sexp (list skip info warn error out) (SK_CHECK_FORM (list (car sexp)))) |
326 | 342 | (foreach map sexp body (SK_CHECK_FORM sexp )) |
327 | 343 | ));dbind |
328 | 344 |
|
329 | 345 |
|
330 | | - |
331 | 346 | ;; =============================================================================================================== |
332 | 347 | ;; Sharp Lint Functions |
333 | 348 | ;; =============================================================================================================== |
334 | 349 |
|
335 | 350 | (let ( ignores ) |
| 351 | + ignores |
336 | 352 |
|
337 | 353 | (@fun add_ignore |
338 | 354 | ( ( name ?type symbol ) |
|
373 | 389 | ;; *WARNING* (sklint): calling NLambda from Scheme code |
374 | 390 |
|
375 | 391 | (inSkill |
376 | | - |
377 | | - (@fun @lint |
378 | | - ( @key |
379 | | - ( files ?type ( string ... ) ) |
380 | | - ( ignores ?type list ?def () ) |
381 | | - ( file_by_file ?type t|nil ?def (equal "TRUE" (getShellEnvVar "SKILL_SHARP_LINT_FILE_BY_FILE")) ) |
382 | | - ) |
383 | | - ?doc "`sklint' wrapper with custom ignores." |
384 | | - ?out nil |
385 | | - ?global t |
386 | | - (@letf ( ( (status printinfix) nil ) |
| 392 | + (defun _\@lint ( @key file ignores ) |
| 393 | + "`sklint' wrapper" |
| 394 | + ;; TODO - No idea why but lint only works fine the second time on some file... |
| 395 | + ;; Workaround is to run it once first but redirect its output |
| 396 | + (@with ( ( port (outfile "/dev/null" )) |
387 | 397 | ) |
388 | | - (if file_by_file |
389 | | - (forall file files |
390 | | - (sklint ?file file ?ignores (nconc ignores (_\@lint_get_ignores)))) |
391 | | - (sklint ?file files ?ignores (nconc ignores (_\@lint_get_ignores))) |
392 | | - );if |
393 | | - ));letf ;fun |
| 398 | + (@letf ( ( (@poport) port ) |
| 399 | + ) |
| 400 | + (sklint ?file file ?ignores ignores) |
| 401 | + )) |
| 402 | + (sklint ?file file ?ignores ignores) |
| 403 | + )) |
394 | 404 |
|
395 | | - );inSkill |
| 405 | +(@fun @lint |
| 406 | + ( @key |
| 407 | + ( files ?type ( string ... ) ) |
| 408 | + ( ignores ?type list ?def () ) |
| 409 | + ( file_by_file ?type t|nil ?def (equal "TRUE" (getShellEnvVar "SKILL_SHARP_LINT_FILE_BY_FILE")) ) |
| 410 | + ) |
| 411 | + ?doc "`sklint' wrapper with custom ignores." |
| 412 | + ?out nil |
| 413 | + ?global t |
| 414 | + (@letf ( ( (status printinfix) nil ) |
| 415 | + ) |
| 416 | + (if file_by_file |
| 417 | + (forall file files |
| 418 | + (_\@lint ?file file ?ignores (nconc ignores (_\@lint_get_ignores)))) |
| 419 | + (_\@lint ?file files ?ignores (nconc ignores (_\@lint_get_ignores))) |
| 420 | + );if |
| 421 | + ));letf ;fun |
396 | 422 |
|
397 | | -;; TODO - Use (car (exists ...)) instead of (car (setof ...)) rule. |
398 | 423 | ;; TOOD - Always use `printf, `fprintf', `lsprintf', ... with more than one argument, at least (fprintf "%s" str) |
399 | 424 |
|
400 | | -; )) |
401 | 425 | ;*/ |
0 commit comments