Skip to content

Commit 57c2fec

Browse files
committed
Tidy up comments and remove extraneous parentheses
1 parent 7093e49 commit 57c2fec

5 files changed

Lines changed: 305 additions & 314 deletions

File tree

.clang-tidy

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
Checks: 'clang-diagnostic-*,clang-analyzer-*'
3+
WarningsAsErrors: ''
4+
HeaderFilterRegex: ''
5+
AnalyzeTemporaryDtors: false
6+
FormatStyle: none
7+
User: dparrish
8+
CheckOptions:
9+
- key: cert-dcl16-c.NewSuffixes
10+
value: 'L;LL;LU;LLU'
11+
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
12+
value: '1'
13+
- key: google-readability-braces-around-statements.ShortStatementLines
14+
value: '1'
15+
- key: google-readability-function-size.StatementThreshold
16+
value: '800'
17+
- key: google-readability-namespace-comments.ShortNamespaceLines
18+
value: '10'
19+
- key: google-readability-namespace-comments.SpacesBeforeComments
20+
value: '2'
21+
- key: modernize-loop-convert.MaxCopySize
22+
value: '16'
23+
- key: modernize-loop-convert.MinConfidence
24+
value: reasonable
25+
- key: modernize-loop-convert.NamingStyle
26+
value: CamelCase
27+
- key: modernize-pass-by-value.IncludeStyle
28+
value: llvm
29+
- key: modernize-replace-auto-ptr.IncludeStyle
30+
value: llvm
31+
- key: modernize-use-nullptr.NullMacros
32+
value: 'NULL'
33+
...
34+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
*.so
44
*.so.*
55
clitest
6+
compile_commands.json

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,7 @@ rpmprep:
8585

8686
rpm: rpmprep
8787
rpmbuild -ta libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz --define "debug_package %{nil}" --clean
88+
89+
lint:
90+
clang-tidy -quiet -warnings-as-errors *.c *.h
91+

clitest.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,15 @@ int side_length_validator(struct cli_def *cli, const char *name, const char *val
307307
int check1_validator(struct cli_def *cli, UNUSED(const char *name), UNUSED(const char *value)) {
308308
char *color;
309309
char *transparent;
310-
310+
311311
printf("check1_validator called \n");
312312
color = cli_get_optarg_value(cli, "color", NULL);
313313
transparent = cli_get_optarg_value(cli, "transparent", NULL);
314-
314+
315315
if (!color && !transparent) {
316-
cli_error(cli,"\nMust supply either a color or transparent!");
316+
cli_error(cli, "\nMust supply either a color or transparent!");
317317
return CLI_ERROR;
318-
} else if (color && !strcmp(color,"black") && transparent) {
318+
} else if (color && !strcmp(color, "black") && transparent) {
319319
cli_error(cli, "\nCan not have a transparent black object!");
320320
return CLI_ERROR;
321321
}
@@ -372,9 +372,8 @@ void run_child(int x) {
372372
"Set transparent flag", NULL, NULL, NULL);
373373
cli_register_optarg(c, "color", CLI_CMD_OPTIONAL_ARGUMENT, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, "Set color",
374374
color_completor, color_validator, NULL);
375-
cli_register_optarg(c, "__check1__", CLI_CMD_SPOT_CHECK,PRIVILEGE_UNPRIVILEGED, MODE_EXEC,
376-
NULL, NULL, check1_validator,
377-
NULL);
375+
cli_register_optarg(c, "__check1__", CLI_CMD_SPOT_CHECK, PRIVILEGE_UNPRIVILEGED, MODE_EXEC, NULL, NULL,
376+
check1_validator, NULL);
378377
cli_register_optarg(c, "shape", CLI_CMD_ARGUMENT | CLI_CMD_ALLOW_BUILDMODE, PRIVILEGE_UNPRIVILEGED, MODE_EXEC,
379378
"Specify shape to calclate perimeter for", shape_completor, shape_validator,
380379
shape_transient_eval);

0 commit comments

Comments
 (0)