Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
12941b07
Commit
12941b07
authored
Jan 17, 2011
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ccanlint: neaten info_summary_single_line with new doc_section info.
parent
b2826f4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
35 deletions
+19
-35
tools/ccanlint/tests/info_summary_single_line.c
tools/ccanlint/tests/info_summary_single_line.c
+19
-35
No files found.
tools/ccanlint/tests/info_summary_single_line.c
View file @
12941b07
...
...
@@ -4,50 +4,34 @@
#include <ccan/talloc/talloc.h>
#include <ccan/str/str.h>
/* Summary line is form '<identifier> - ' (spaces for 'struct foo -') */
/* slightly modified from doc_extract-core.c */
static
unsigned
int
is_summary_line
(
const
char
*
line
)
{
unsigned
int
id_len
;
id_len
=
strspn
(
line
,
IDENT_CHARS
" *"
);
if
(
id_len
==
0
)
return
0
;
if
(
strspn
(
line
,
" "
)
==
id_len
)
return
0
;
if
(
!
strstarts
(
line
+
id_len
-
1
,
" - "
))
return
0
;
return
id_len
-
1
;
}
static
void
check_info_summary_single_line
(
struct
manifest
*
m
,
bool
keep
,
unsigned
int
*
timeleft
,
struct
score
*
score
)
{
int
i
=
0
;
get_ccan_line_info
(
m
->
info_file
);
score
->
total
=
1
;
for
(
i
=
0
;
i
<
m
->
info_file
->
num_lines
;
++
i
)
{
if
(
is_summary_line
(
m
->
info_file
->
lines
[
i
]))
{
if
(
strspn
(
m
->
info_file
->
lines
[
i
+
1
],
" *"
)
==
strlen
(
m
->
info_file
->
lines
[
i
+
1
]))
{
/* valid summary line */
score
->
error
=
NULL
;
score
->
pass
=
true
;
score
->
score
=
1
;
}
else
{
/* invalid summary line - line following summary line should be empty */
score
->
pass
=
false
;
score
->
score
=
0
;
score
->
error
=
"invalid summary line - not on a single line:"
;
score_file_error
(
score
,
m
->
info_file
,
i
+
1
,
"summary is not on a single line"
);
}
break
;
struct
list_head
*
infodocs
=
get_ccan_file_docs
(
m
->
info_file
);
struct
doc_section
*
d
;
score
->
pass
=
true
;
list_for_each
(
infodocs
,
d
,
list
)
{
const
char
*
after
;
if
(
!
streq
(
d
->
type
,
"summary"
))
continue
;
/* line following summary line should be empty */
after
=
m
->
info_file
->
lines
[
d
->
srcline
+
1
];
if
(
after
&&
strspn
(
after
,
" *"
)
!=
strlen
(
after
))
{
score
->
pass
=
false
;
score
->
score
=
0
;
score_file_error
(
score
,
m
->
info_file
,
d
->
srcline
+
1
,
m
->
info_file
->
lines
[
d
->
srcline
]);
score_file_error
(
score
,
m
->
info_file
,
d
->
srcline
+
2
,
m
->
info_file
->
lines
[
d
->
srcline
+
1
]);
}
}
}
struct
ccanlint
info_summary_single_line
=
{
.
key
=
"info_summary_single_line"
,
.
name
=
"Module has a single line summary in _info"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment