Skip to content

Commit d5e8fcf

Browse files
committed
pass tests through more hygiene checks
related to microsoft#15259
1 parent 7f34885 commit d5e8fcf

18 files changed

Lines changed: 91 additions & 113 deletions

File tree

build/gulpfile.hygiene.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ const tslint = require('tslint');
1414

1515
/**
1616
* Hygiene works by creating cascading subsets of all our files and
17-
* passing them through a bunch of checks. Here are the current subsets,
18-
* each containing the following one, in mathematical notation:
17+
* passing them through a sequence of checks. Here are the current subsets,
18+
* named according to the checks performed on them. Each subset contains
19+
* the following one, as described in mathematical notation:
1920
*
2021
* all ⊃ eol ⊇ indentation ⊃ copyright ⊃ typescript
2122
*/
@@ -51,7 +52,6 @@ const indentationFilter = [
5152
'!**/lib/**',
5253
'!**/*.d.ts',
5354
'!**/*.d.ts.recipe',
54-
'!extensions/typescript/server/**',
5555
'!test/assert.js',
5656
'!**/package.json',
5757
'!**/npm-shrinkwrap.json',
@@ -75,22 +75,24 @@ const copyrightFilter = [
7575
'!**/*.json',
7676
'!**/*.html',
7777
'!**/*.template',
78-
'!**/test/**',
7978
'!**/*.md',
8079
'!**/*.bat',
8180
'!**/*.cmd',
82-
'!resources/win32/bin/code.js',
8381
'!**/*.xml',
8482
'!**/*.sh',
8583
'!**/*.txt',
8684
'!**/*.xpm',
85+
'!**/*.opts',
86+
'!**/*.disabled',
87+
'!resources/win32/bin/code.js',
8788
'!extensions/markdown/media/tomorrow.css'
8889
];
8990

9091
const tslintFilter = [
9192
'src/**/*.ts',
9293
'extensions/**/*.ts',
9394
'!**/*.d.ts',
95+
'!**/fixtures/**',
9496
'!**/typings/**',
9597
'!**/node_modules/**',
9698
'!extensions/typescript/test/colorize-fixtures/**',
@@ -112,7 +114,7 @@ function reportFailures(failures) {
112114
const line = position.lineAndCharacter ? position.lineAndCharacter.line : position.line;
113115
const character = position.lineAndCharacter ? position.lineAndCharacter.character : position.character;
114116

115-
console.error(`${ name }:${ line + 1}:${ character + 1 }:${ failure.failure }`);
117+
console.error(`${name}:${line + 1}:${character + 1}:${failure.failure}`);
116118
});
117119
}
118120

@@ -185,7 +187,7 @@ const hygiene = exports.hygiene = (some, options) => {
185187
});
186188
});
187189

188-
const tsl = es.through(function(file) {
190+
const tsl = es.through(function (file) {
189191
const configuration = tslint.findConfiguration(null, '.');
190192
const options = { configuration, formatter: 'json', rulesDirectory: 'build/lib/tslint' };
191193
const contents = file.contents.toString('utf8');

src/vs/base/test/common/collections.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
5+
56
'use strict';
67

78
import * as assert from 'assert';
@@ -68,11 +69,11 @@ suite('Collections', () => {
6869

6970
const group1 = 'a', group2 = 'b';
7071
const value1 = 1, value2 = 2, value3 = 3;
71-
let source = [
72-
{ key: group1, value: value1 },
73-
{ key: group1, value: value2 },
74-
{ key: group2, value: value3 },
75-
];
72+
let source = [
73+
{ key: group1, value: value1 },
74+
{ key: group1, value: value2 },
75+
{ key: group2, value: value3 },
76+
];
7677

7778
let grouped = collections.groupBy(source, x => x.key);
7879

src/vs/base/test/common/decorators.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'use strict';
77

88
import * as assert from 'assert';
9-
import { memoize  } from 'vs/base/common/decorators';
9+
import { memoize } from 'vs/base/common/decorators';
1010

1111
suite('Decorators', () => {
1212
test('memoize should memoize methods', () => {

src/vs/base/test/node/config.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ suite('Config', () => {
175175
if (error) {
176176
return onError(error, done);
177177
}
178-
178+
179179
fs.writeFileSync(testFile, '// my comment\n{ "foo": "bar" }');
180180

181181
let watcher = new ConfigWatcher<{ foo: string; }>(testFile, { changeBufferDelay: 100 });

src/vs/editor/test/common/core/editorState.test.ts

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
5+
56
'use strict';
67

78
import * as assert from 'assert';
@@ -21,56 +22,56 @@ interface IStubEditorState {
2122
suite('Editor Core - Editor State', () => {
2223

2324
const allFlags = Object.keys(CodeEditorStateFlag)
24-
.map(k => CodeEditorStateFlag[k])
25-
.filter(v => typeof v === 'number') as number[];
25+
.map(k => CodeEditorStateFlag[k])
26+
.filter(v => typeof v === 'number') as number[];
2627

2728

2829
test('empty editor state should be valid', () => {
29-
let result = validate( {}, {} );
30+
let result = validate({}, {});
3031
assert.equal(result, true);
3132
});
3233

3334
test('different model URIs should be invalid', () => {
3435
let result = validate(
35-
{ model: { uri: URI.parse('http://test1') } },
36-
{ model: { uri: URI.parse('http://test2') } }
37-
);
36+
{ model: { uri: URI.parse('http://test1') } },
37+
{ model: { uri: URI.parse('http://test2') } }
38+
);
3839

3940
assert.equal(result, false);
4041
});
4142

4243
test('different model versions should be invalid', () => {
4344
let result = validate(
44-
{ model: { version: 1 } },
45-
{ model: { version: 2 } }
46-
);
45+
{ model: { version: 1 } },
46+
{ model: { version: 2 } }
47+
);
4748

4849
assert.equal(result, false);
4950
});
5051

5152
test('different positions should be invalid', () => {
5253
let result = validate(
53-
{ position: new Position(1, 2) },
54-
{ position: new Position(2, 3) }
55-
);
54+
{ position: new Position(1, 2) },
55+
{ position: new Position(2, 3) }
56+
);
5657

5758
assert.equal(result, false);
5859
});
5960

6061
test('different selections should be invalid', () => {
6162
let result = validate(
62-
{ selection: new Selection(1, 2, 3, 4) },
63-
{ selection: new Selection(5, 2, 3, 4) }
64-
);
63+
{ selection: new Selection(1, 2, 3, 4) },
64+
{ selection: new Selection(5, 2, 3, 4) }
65+
);
6566

6667
assert.equal(result, false);
6768
});
6869

6970
test('different scroll positions should be invalid', () => {
7071
let result = validate(
71-
{ scroll: { left: 1, top: 2 } },
72-
{ scroll: { left: 3, top: 2 } }
73-
);
72+
{ scroll: { left: 1, top: 2 } },
73+
{ scroll: { left: 3, top: 2 } }
74+
);
7475

7576
assert.equal(result, false);
7677
});
@@ -80,20 +81,13 @@ suite('Editor Core - Editor State', () => {
8081
let sourceEditor = createEditor(source),
8182
targetEditor = createEditor(target);
8283

83-
let result = new EditorState(sourceEditor, allFlags)
84-
.validate(targetEditor);
84+
let result = new EditorState(sourceEditor, allFlags).validate(targetEditor);
8585

8686
return result;
8787
}
8888

8989
function createEditor({ model, position, selection, scroll }: IStubEditorState = {}): ICommonCodeEditor {
90-
91-
let mappedModel = model
92-
? {
93-
uri: model.uri ? model.uri : URI.parse('http://dummy.org'),
94-
getVersionId: () => model.version
95-
}
96-
: null;
90+
let mappedModel = model ? { uri: model.uri ? model.uri : URI.parse('http://dummy.org'), getVersionId: () => model.version } : null;
9791

9892
return <any>{
9993
getModel: (): IModel => <any>mappedModel,

src/vs/editor/test/common/diff/diffComputer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function extractCharChangeRepresentation(change, expectedChange): ICharChange {
2424
};
2525
}
2626

27-
function extractLineChangeRepresentation(change, expectedChange): IChange|ILineChange {
27+
function extractLineChangeRepresentation(change, expectedChange): IChange | ILineChange {
2828
if (change.charChanges) {
2929
let charChanges: ICharChange[] = [];
3030
for (let i = 0; i < change.charChanges.length; i++) {

src/vs/editor/test/common/editorTestUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function viewModelHelper(model): IViewModelHelper {
3636
validateViewPosition: (viewPosition: Position, modelPosition: Position): Position => {
3737
return modelPosition;
3838
},
39-
validateViewRange: (viewRange:Range, modelRange: Range): Range => {
39+
validateViewRange: (viewRange: Range, modelRange: Range): Range => {
4040
return modelRange;
4141
}
4242
};

src/vs/editor/test/common/model/editableTextModel.test.ts

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
5+
56
'use strict';
67

78
import * as assert from 'assert';
@@ -518,7 +519,7 @@ suite('EditorModel - EditableTextModel._toSingleEditOperation', () => {
518519

519520
suite('EditorModel - EditableTextModel.applyEdits updates mightContainRTL', () => {
520521

521-
function testApplyEdits(original: string[], edits: IIdentifiedSingleEditOperation[], before:boolean, after:boolean): void {
522+
function testApplyEdits(original: string[], edits: IIdentifiedSingleEditOperation[], before: boolean, after: boolean): void {
522523
let model = new EditableTextModel([], TextModel.toRawText(original.join('\n'), TextModel.DEFAULT_CREATION_OPTIONS), null);
523524
model.setEOL(EndOfLineSequence.LF);
524525

@@ -537,56 +538,32 @@ suite('EditorModel - EditableTextModel.applyEdits updates mightContainRTL', () =
537538
forceMoveMarkers: false
538539
};
539540
}
540-
// model.setValue('Hello,\nזוהי עובדה מבוססת שדעתו');
541+
// model.setValue('Hello,\nזוהי עובדה מבוססת שדעתו');
541542

542-
// let model = new TextModel([], TextModel.toRawText('Hello,\nهناك حقيقة مثبتة منذ زمن طويل', TextModel.DEFAULT_CREATION_OPTIONS));
543+
// let model = new TextModel([], TextModel.toRawText('Hello,\nهناك حقيقة مثبتة منذ زمن طويل', TextModel.DEFAULT_CREATION_OPTIONS));
543544

544545
test('start with RTL, insert LTR', () => {
545-
testApplyEdits([
546-
'Hello,\nזוהי עובדה מבוססת שדעתו'
547-
], [
548-
editOp(1,1,1,1, ['hello'])
549-
], true, true);
546+
testApplyEdits(['Hello,\nזוהי עובדה מבוססת שדעתו'], [editOp(1, 1, 1, 1, ['hello'])], true, true);
550547
});
551548

552549
test('start with RTL, delete RTL', () => {
553-
testApplyEdits([
554-
'Hello,\nזוהי עובדה מבוססת שדעתו'
555-
], [
556-
editOp(1,1,10,10, [''])
557-
], true, true);
550+
testApplyEdits(['Hello,\nזוהי עובדה מבוססת שדעתו'], [editOp(1, 1, 10, 10, [''])], true, true);
558551
});
559552

560553
test('start with RTL, insert RTL', () => {
561-
testApplyEdits([
562-
'Hello,\nזוהי עובדה מבוססת שדעתו'
563-
], [
564-
editOp(1,1,1,1, ['هناك حقيقة مثبتة منذ زمن طويل'])
565-
], true, true);
554+
testApplyEdits(['Hello,\nזוהי עובדה מבוססת שדעתו'], [editOp(1, 1, 1, 1, ['هناك حقيقة مثبتة منذ زمن طويل'])], true, true);
566555
});
567556

568557
test('start with LTR, insert LTR', () => {
569-
testApplyEdits([
570-
'Hello,\nworld!'
571-
], [
572-
editOp(1,1,1,1, ['hello'])
573-
], false, false);
558+
testApplyEdits(['Hello,\nworld!'], [editOp(1, 1, 1, 1, ['hello'])], false, false);
574559
});
575560

576561
test('start with LTR, insert RTL 1', () => {
577-
testApplyEdits([
578-
'Hello,\nworld!'
579-
], [
580-
editOp(1,1,1,1, ['هناك حقيقة مثبتة منذ زمن طويل'])
581-
], false, true);
562+
testApplyEdits(['Hello,\nworld!'], [editOp(1, 1, 1, 1, ['هناك حقيقة مثبتة منذ زمن طويل'])], false, true);
582563
});
583564

584565
test('start with LTR, insert RTL 2', () => {
585-
testApplyEdits([
586-
'Hello,\nworld!'
587-
], [
588-
editOp(1,1,1,1, ['זוהי עובדה מבוססת שדעתו'])
589-
], false, true);
566+
testApplyEdits(['Hello,\nworld!'], [editOp(1, 1, 1, 1, ['זוהי עובדה מבוססת שדעתו'])], false, true);
590567
});
591568
});
592569

@@ -616,7 +593,7 @@ suite('EditorModel - EditableTextModel.applyEdits', () => {
616593
'very nice',
617594
'text'
618595
],
619-
/*inputEditsAreInvalid*/true
596+
/*inputEditsAreInvalid*/true
620597
);
621598
});
622599
test('high-low surrogates 2', () => {
@@ -634,7 +611,7 @@ suite('EditorModel - EditableTextModel.applyEdits', () => {
634611
'very nice',
635612
'text'
636613
],
637-
/*inputEditsAreInvalid*/true
614+
/*inputEditsAreInvalid*/true
638615
);
639616
});
640617
test('high-low surrogates 3', () => {
@@ -652,7 +629,7 @@ suite('EditorModel - EditableTextModel.applyEdits', () => {
652629
'very nice',
653630
'text'
654631
],
655-
/*inputEditsAreInvalid*/true
632+
/*inputEditsAreInvalid*/true
656633
);
657634
});
658635
test('high-low surrogates 4', () => {
@@ -670,7 +647,7 @@ suite('EditorModel - EditableTextModel.applyEdits', () => {
670647
'very nice',
671648
'text'
672649
],
673-
/*inputEditsAreInvalid*/true
650+
/*inputEditsAreInvalid*/true
674651
);
675652
});
676653

src/vs/editor/test/common/model/textModel.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function assertGuess(expectedInsertSpaces: boolean, expectedTabSize: number, tex
5353

5454
suite('TextModel.toRawText', () => {
5555

56-
function testToRawText(text:string, expected:IRawText): void {
56+
function testToRawText(text: string, expected: IRawText): void {
5757
let actual = TextModel.toRawText(text, TextModel.DEFAULT_CREATION_OPTIONS);
5858
assert.deepEqual(actual, expected);
5959
}

0 commit comments

Comments
 (0)