diff options
| author | Dean Anderson <dean@locomation.ai> | 2018-09-27 18:10:02 -0400 |
|---|---|---|
| committer | Christoph Schlosser <christophschlosser@users.noreply.github.com> | 2018-09-29 19:08:20 +0200 |
| commit | 4df2f7179c12d3a674866bf05e4bd185ac3e2d87 (patch) | |
| tree | 710748ce74860e659cb926388b7bfae9732a096f | |
| parent | 4939806ae705953cfc1ca8cf54f20d98e9be9d03 (diff) | |
| download | doxdocgen-4df2f7179c12d3a674866bf05e4bd185ac3e2d87.tar.gz | |
Fixes for whitespace errors to pass tslint tests
| -rw-r--r-- | src/Lang/Cpp/CppDocGen.ts | 19 | ||||
| -rw-r--r-- | src/test/CppTests/FileDescription.test.ts | 2 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts index 705b72c..c88dd7d 100644 --- a/src/Lang/Cpp/CppDocGen.ts +++ b/src/Lang/Cpp/CppDocGen.ts @@ -108,9 +108,9 @@ export class CppDocGen implements IDocGen { protected getMultiTemplatedString(replace: string[], template: string, param: string[]): string { // FIXME I find this argument order a bit strange. I would probably have template first // For each replace entry, attempt to replace it with the corresponding param in the template - for(var i=0;i<replace.length;i++) { - if (i<param.length) { - template = template.replace(replace[i],param[i]); + for (let i = 0; i < replace.length; i++) { + if (i < param.length) { + template = template.replace(replace[i], param[i]); } // TODO: warn if mismatch string lengths? Probably should use tuple of tuples } @@ -223,16 +223,15 @@ export class CppDocGen implements IDocGen { return params; } - protected generateAuthorTag(lines: string[]) { if (this.cfg.Generic.authorTag.trim().length !== 0) { // Allow substitution of {author} and {email} only - lines.push(this.cfg.C.commentPrefix + + lines.push(this.cfg.C.commentPrefix + this.getMultiTemplatedString( [this.cfg.authorTemplateReplace, this.cfg.emailTemplateReplace], this.cfg.Generic.authorTag, - [this.cfg.Generic.authorName,this.cfg.Generic.authorEmail] - ) + [this.cfg.Generic.authorName, this.cfg.Generic.authorEmail], + ), ); } } @@ -268,7 +267,7 @@ export class CppDocGen implements IDocGen { protected generateCustomTag(lines: string[]) { let dateFormat: string = "YYYY-MM-DD"; // Default to ISO standard if not defined - if ( this.cfg.Generic.dateFormat.trim().length != 0) { + if ( this.cfg.Generic.dateFormat.trim().length !== 0) { dateFormat = this.cfg.Generic.dateFormat; // Overwrite with user format } // For each line of the customTag @@ -280,8 +279,8 @@ export class CppDocGen implements IDocGen { this.cfg.dateTemplateReplace, this.cfg.yearTemplateReplace], element, [this.cfg.Generic.authorName, this.cfg.Generic.authorEmail, - moment().format(dateFormat), moment().format("YYYY")] - ) + moment().format(dateFormat), moment().format("YYYY")], + ), ); }); } diff --git a/src/test/CppTests/FileDescription.test.ts b/src/test/CppTests/FileDescription.test.ts index 362c17a..eecf858 100644 --- a/src/test/CppTests/FileDescription.test.ts +++ b/src/test/CppTests/FileDescription.test.ts @@ -58,7 +58,7 @@ suite("File Description Tests", () => { test("custom block", () => { testSetup.cfg.File.fileOrder = ["custom"]; - testSetup.cfg.File.customTag = ["First Line", "{year} Year Line", "{date} Date Line", + testSetup.cfg.File.customTag = ["First Line", "{year} Year Line", "{date} Date Line", "{author} Author Line", "{email} Email Line"]; const result = testSetup.SetLine("").GetResult(); assert.equal("/**\n * First Line\n * " + year + " Year Line\n * " + date + " Date Line\n" + |