projects
/
wolf
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check for duplicated empty lines, empty at end of file
[wolf]
/
src
/
main
/
checker.lisp
diff --git
a/src/main/checker.lisp
b/src/main/checker.lisp
index 8bae64f83cb46aeb9117aa5c9ed14c6308678e4e..f20b6a8944fbc96f9d2cf5d8c90aab92ddb15aad 100644
(file)
--- a/
src/main/checker.lisp
+++ b/
src/main/checker.lisp
@@
-6,12
+6,13
@@
; - Top level multiline forms must be separated by exactly one space
; * No line longer than 120 characters
; - No use of unexported symbols in other packages
; - Top level multiline forms must be separated by exactly one space
; * No line longer than 120 characters
; - No use of unexported symbols in other packages
-;
-
No tabs
+;
*
No tabs
; - Only one space between elements in a form on a single line
; * in-package must be first line in file unless file is package.lisp
; * No whitespace at end of line
; * No lines that are only whitespace
; - Only one space between elements in a form on a single line
; * in-package must be first line in file unless file is package.lisp
; * No whitespace at end of line
; * No lines that are only whitespace
-; - No empty lines at end of file
+; * No empty lines at end of file
+; * Never have two empty lines in a row
; * Only one in-package per file
;
; Some thoughts
; * Only one in-package per file
;
; Some thoughts
@@
-34,7
+35,9
@@
'(:begin ; start of file
:normal ; normal processing
:beginning-of-line
'(:begin ; start of file
:normal ; normal processing
:beginning-of-line
+ :beginning-of-separators-with-space ; empty space in there
:beginning-of-symbols
:beginning-of-symbols
+ :all ; matches everything
)))
)))
@@
-54,7
+57,7
@@
(list
(lambda (state text)
(and
(list
(lambda (state text)
(and
- (
eql ,state state
)
+ (
or (eql :all ,state) (eql ,state state)
)
(or
(and (symbolp text) (eql text ,match))
(and ,scanner
(or
(and (symbolp text) (eql text ,match))
(and ,scanner
@@
-104,9
+107,15
@@
; These are in reverse order
(progn
(setf *evaluators* nil)
; These are in reverse order
(progn
(setf *evaluators* nil)
+ (defevaluator :all "\\t"
+ (constantly "Must not use tabs"))
(defevaluator :begin "\\(in-package[^\\)]*\\)"
(lambda ()
(set-state :normal) nil))
(defevaluator :begin "\\(in-package[^\\)]*\\)"
(lambda ()
(set-state :normal) nil))
+ (defevaluator :beginning-of-separators-with-space :eof
+ (constantly "Must not end with empty line"))
+ (defevaluator :beginning-of-separators-with-space "\\n"
+ (constantly "Must not have two empty lines in a row"))
(defevaluator :begin ".*"
(constantly "Must begin with in-package form"))
(defevaluator :normal "\\( *in-package "
(defevaluator :begin ".*"
(constantly "Must begin with in-package form"))
(defevaluator :normal "\\( *in-package "
@@
-124,8
+133,16
@@
(lambda ()
(set-state :beginning-of-symbols)
nil))
(lambda ()
(set-state :beginning-of-symbols)
nil))
+ (defevaluator :beginning-of-separators-with-space " *"
+ (lambda ()
+ (set-state :beginning-of-symbols)
+ nil))
(defevaluator :beginning-of-symbols "\\n"
(defevaluator :beginning-of-symbols "\\n"
- (lambda () (when (< 0 *col-no*) "No whitespace only lines")))
+ (lambda ()
+ (if
+ (< 0 *col-no*)
+ "No whitespace only lines"
+ (set-state :beginning-of-separators-with-space))))
(defevaluator :beginning-of-symbols ""
(lambda ()
(set-state :normal)
(defevaluator :beginning-of-symbols ""
(lambda ()
(set-state :normal)