Skip to content

Commit af22fd9

Browse files
Remove false positives when scanning canonical header information
1 parent b1fdb2e commit af22fd9

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

src/inspector/codestyle-0005.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ license under which the file is released."
4646
(:sequence
4747
#\Space
4848
(:greedy-repetition 0 nil :everything)
49-
(:alternation ,(project-name) "https" "Copyright" "This file is part of" "All rights reserved")
49+
(:alternation "https" "Copyright" "This file is part of" "All rights reserved")
5050
(:greedy-repetition 0 nil :everything)))
5151
#\Newline)))
5252
`(:sequence

testsuite/inspector/codestyle-0005.lisp

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
";; Copyright 2021"
2424
";; All rights reserved"
2525
""
26-
";; End of file `testsuite.lsip'")))
26+
";; End of file `testsuite.lisp'")))
2727
(file-2
2828
(atelier::join-lines
2929
'("; testsuite.lisp -- The testsuite for Example"
@@ -34,9 +34,52 @@
3434
";;;; Copyright © 2017–2022 A. U. Thor"
3535
";;;; All rights reserved."
3636
""
37-
";; End of file `testsuite.lsip'")))
37+
";; End of file `testsuite.lisp'")))
3838
(atelier::*linter*
3939
(atelier::find-plain-linter :application/lisp)))
40+
(assert-string= file-2
41+
(with-fixed-linter-environment
42+
(atelier::hint-at-file-when-it-lacks-canonical-project-identification file-1)))))
43+
44+
(define-testcase validate-codestyle-0005-hint-at-script-when-it-lacks-canonical-project-identification ()
45+
(let ((file-1
46+
(atelier::join-lines
47+
'("#!/bin/sh"
48+
""
49+
"# testsuite.sh — The testsuite for Example"
50+
""
51+
"# Another Project (https://github.com/acme/another-project)"
52+
"# This file is part of Another Project."
53+
"#"
54+
"# Copyright © 2001 Author"
55+
"# All rights reserved."
56+
""
57+
"# This file must be used under the terms of the MIT License."
58+
"# This source file is licensed as described in the file LICENSE, which"
59+
"# you should have received as part of this distribution. The terms"
60+
"# are also available at https://opensource.org/licenses/MIT"
61+
""
62+
": ${TOPLEVELDIR:=$(git rev-parse --show-toplevel)}")))
63+
(file-2
64+
(atelier::join-lines
65+
'("#!/bin/sh"
66+
""
67+
"# testsuite.sh — The testsuite for Example"
68+
""
69+
"# Example (https://github.com/acme/example)"
70+
"# This file is part of Example."
71+
"#"
72+
"# Copyright © 2017–2022 A. U. Thor"
73+
"# All rights reserved."
74+
""
75+
"# This file must be used under the terms of the MIT License."
76+
"# This source file is licensed as described in the file LICENSE, which"
77+
"# you should have received as part of this distribution. The terms"
78+
"# are also available at https://opensource.org/licenses/MIT"
79+
""
80+
": ${TOPLEVELDIR:=$(git rev-parse --show-toplevel)}")))
81+
(atelier::*linter*
82+
(atelier::find-plain-linter :application/shellscript)))
4083
(assert-string= file-2
4184
(with-fixed-linter-environment
4285
(atelier::hint-at-file-when-it-lacks-canonical-project-identification file-1)))))

testsuite/lint.lisp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
(validate-codestyle-0003-hint-at-file-when-it-lacks-canonical-header-line)
6565
(validate-codestyle-0004-hint-at-file-when-it-lacks-canonical-footer-line)
6666
(validate-codestyle-0005-hint-at-file-when-it-lacks-canonical-project-identification)
67+
(validate-codestyle-0005-hint-at-script-when-it-lacks-canonical-project-identification)
6768
(validate-codestyle-0006-hint-at-file-when-it-lacks-project-license-information))
6869

6970
;;;; End of file `lint.lisp'

0 commit comments

Comments
 (0)