Add SDL tslint (#690)
This commit is contained in:
Родитель
fcebc75b91
Коммит
c39879802d
|
@ -17,6 +17,7 @@ module Microsoft.ApplicationInsights {
|
|||
} else if (envelope.tags[tagKeys.operationId]) {
|
||||
score = this.hashCodeGeneragor.getHashCodeScore(envelope.tags[tagKeys.operationId]);
|
||||
} else {
|
||||
// tslint:disable-next-line:insecure-random
|
||||
score = Math.random()
|
||||
}
|
||||
|
||||
|
|
|
@ -307,6 +307,7 @@ module Microsoft.ApplicationInsights {
|
|||
delayInSeconds = SlotDelayInSeconds;
|
||||
} else {
|
||||
var backOffSlot = (Math.pow(2, this._consecutiveErrors) - 1) / 2;
|
||||
// tslint:disable-next-line:insecure-random
|
||||
var backOffDelay = Math.floor(Math.random() * backOffSlot * SlotDelayInSeconds) + 1;
|
||||
delayInSeconds = Math.max(Math.min(backOffDelay, 3600), SlotDelayInSeconds);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ module Microsoft.ApplicationInsights {
|
|||
var base64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
|
||||
var result = "";
|
||||
// tslint:disable-next-line:insecure-random
|
||||
var random = Math.random() * 1073741824; //5 symbols in base64, almost maxint
|
||||
|
||||
while (random > 0) {
|
||||
|
|
12
gruntfile.js
12
gruntfile.js
|
@ -1,5 +1,16 @@
|
|||
module.exports = function (grunt) {
|
||||
grunt.initConfig({
|
||||
tslint: {
|
||||
options: {
|
||||
rulesDirectory: 'node_modules/tslint-microsoft-contrib',
|
||||
},
|
||||
files: {
|
||||
src: [
|
||||
'./JavaScript/**/*.ts',
|
||||
'!./JavaScript/JavaScriptSDK.Tests/**'
|
||||
],
|
||||
}
|
||||
},
|
||||
ts: {
|
||||
options: {
|
||||
comments: true
|
||||
|
@ -249,6 +260,7 @@ module.exports = function (grunt) {
|
|||
});
|
||||
|
||||
grunt.loadNpmTasks("grunt-ts");
|
||||
grunt.loadNpmTasks("grunt-tslint");
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-qunit');
|
||||
grunt.registerTask("default", ["ts:default", "uglify:ai", "uglify:snippet"]);
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
"grunt-contrib-qunit": "2.0.0",
|
||||
"grunt-contrib-uglify": "3.1.0",
|
||||
"grunt-ts": "^6.0.0-beta.15",
|
||||
"grunt-tslint": "^5.0.2",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-microsoft-contrib": "^5.2.1",
|
||||
"typescript": "2.5.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"defaultSeverity": "warning",
|
||||
"rules": {
|
||||
"insecure-random": true,
|
||||
"no-banned-terms": true,
|
||||
"no-cookies": true,
|
||||
"no-delete-expression": true,
|
||||
"no-disable-auto-sanitization": true,
|
||||
"no-document-domain": true,
|
||||
"no-document-write": true,
|
||||
"no-eval": true,
|
||||
"no-exec-script": true,
|
||||
"no-function-constructor-with-string-args": true,
|
||||
"no-http-string": [true, "http://www.example.com/?.*", "http://localhost:?.*"],
|
||||
"no-inner-html": true,
|
||||
"no-octal-literal": true,
|
||||
"no-string-based-set-immediate": true,
|
||||
"no-string-based-set-interval": true,
|
||||
"no-string-based-set-timeout": true,
|
||||
"non-literal-require": true,
|
||||
"possible-timing-attack": true,
|
||||
"react-anchor-blank-noopener": true,
|
||||
"react-iframe-missing-sandbox": true,
|
||||
"react-no-dangerous-html": true
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче