--- /dev/null
+[submodule "wiki"]
+ path = wiki
+ url = https://github.com/frankduncan/style-checker.wiki.git
before_install:
- - wget http://frank.kank.net/travissbcl/style-checker/ef9a5c7/$(git rev-parse HEAD)/travissbcl
+ - wget http://frank.kank.net/travissbcl/style-checker/79f4f3d/$(git rev-parse HEAD)/travissbcl
- chmod +x travissbcl
script:
## Usage
-```
-(check-file file)
+See the [wiki](https://github.com/frankduncan/style-checker/wiki).
-(check-directory dir)
-
-(check-directory pretty-print-check-directory)
-```
+Also, see bin/travis.lisp to see how it's used in this package.
( cd tmp/deps &&
tar zxf ../../deps/tarpit/cl-ppcre.tar.gz &&
- ln -s cl-ppcre-2.0.10/cl-ppcre.asd .
+ tar zxf ../../deps/tarpit/docgen_0.1.tar.gz &&
+ ln -s cl-ppcre-2.0.10/cl-ppcre.asd . &&
+ ln -s docgen_0.1/docgen.asd .
)
--eval "(require 'asdf)" \
--eval '(setf asdf:*central-registry* (list #p"tmp/deps/"))' \
--eval "(asdf:load-system :cl-ppcre)" \
+ --eval "(asdf:load-system :docgen)" \
--eval "(asdf:clear-output-translations)" \
--eval '(sb-ext:save-lisp-and-die "travissbcl" :executable t)' \
--- /dev/null
+#!/bin/bash
+
+sbcl \
+ --eval "(asdf:load-system :docgen)" \
+ --eval "(asdf:load-system :style-checker)" \
+ --eval "(format t \"----~%\")" \
+ --eval "(format t \"~A\" (docgen:export-package :syntax-checker))" \
+ --eval "(quit)" 2> /dev/null | sed -n '/^----$/,$p' | tail -n +2 > wiki/Home.md
(when (not (syntax-checker:pretty-print-check-directory "src"))
(format t "~c[1;31mFailed style check!~c[0m~%" #\Esc #\Esc)
(sb-ext:exit :code 1))
+(format t "~c[1;32m- Style Passed!~c[0m~%" #\Esc #\Esc)
+
+(format t "~%~c[1;33mChecking Docs~c[0m~%" #\Esc #\Esc)
+(when (not (docgen:pretty-print-validate-packages :docgen))
+ (format t "~c[1;31mFailed doc check!~c[0m~%" #\Esc #\Esc)
+ (sb-ext:exit :code 1))
+(format t "~c[1;32m- Doc Check Passed!~c[0m~%" #\Esc #\Esc)
(format t "~c[1;32mSuccess!~c[0m~%" #\Esc #\Esc)
(sb-ext:exit :code 0)
(defpackage #:syntax-checker (:use :cl)
- (:export #:check-file #:check-directory #:pretty-print-check-directory))
+ (:export #:check-file #:check-directory #:pretty-print-check-directory)
+ (:documentation
+ "Enforces arbitrary set of style guidelines.
+
+This package walks over common lisp code to make sure it adheres to a set
+of syntactic guidelines designed to ensure a semblance of uniformity. No
+current one was found that could be configured to work the way this one does,
+so instead of writing a configurable tool, another unconfigurable one was born."))
SUCCESS-RESULT: (:success FILENAME)
FAILURE-RESULT: (:success FILENAME MSG LINE-NO COL-NO)
-ARGUMENTS AND VALUES
+ARGUMENTS AND VALUES:
FILE: a pathname
FILENAME: the file this check was run on
(list :failure file (check-failure-msg cf) (check-failure-line-no cf) (check-failure-col-no cf)))))
(defun check-directory (dir)
+ "CHECK-DIRECTORY DIR => RESULTS
+
+ RESULTS: RESULT*
+
+ARGUMENTS AND VALUES:
+
+ DIR: A directory to recurse into and check files
+ RESULT: A result as returned by check-file
+
+DESCRIPTION:
+
+ CHECK-DIRECTORY grabs all .lisp files in the tree under DIR, and loads
+ checks them all.
+
+ The results are then put together into a list which can be programatically
+ evaluated. As opposed to pretty-print-check-directory, this function doesn't
+ clutter up your standard out."
(mapcar #'check-file (directory (format nil "~A/**/*.lisp" dir))))
(defun any-failures (checks)
(+ (fifth failure) 2)))
(defun pretty-print-check-directory (dir)
+ "PRETTY-PRINT-CHECK-DIRECTORY DIR => SUCCESS
+
+ARGUMENTS AND VALUES:
+
+ DIR: A directory to recurse into and check files
+ SUCCESS: T if there were no failures
+
+DESCRIPTION:
+
+ PRETTY-PRINT-CHECK-DIRECTORY checks DIR for any errors, dumping them to output
+ and returning a single flag.
+
+ Unlike check-directory, PRETTY-PRINT-CHECK-DIRECTORY is built for continuous
+ integration, dumping errors to standard out and returning a singular result.
+
+EXAMPLES:
+
+ (pretty-print-check-directory \"src\") => nil"
(let
((checks (check-directory dir)))
(format t "In ~A: Checked ~A files with ~A failures~%~%"
--- /dev/null
+Subproject commit 3e6a2caa124f2537f8ff9ad2c53f4bbaa285cb63