Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on strings.js 3.3.3 due to vulnerability report #7834

Merged
merged 4 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 106 additions & 112 deletions Tasks/ANTV1/package-lock.json

Large diffs are not rendered by default.

277 changes: 136 additions & 141 deletions Tasks/Common/codeanalysis-common/package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Tasks/Common/codeanalysis-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"request": "^2.74.0",
"glob": "7.1.0",
"os": "^0.1.1",
"string": "^3.3.1",
"vsts-task-lib": "1.1.0",
"xml2js": "^0.4.17",
"cheerio": "^0.22.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as util from "../utilities";
import * as tl from "vsts-task-lib/task";
import * as ccc from "../codecoverageconstants";
import * as cc from "../codecoverageenabler";
import * as str from "string";
import * as path from "path";

export class CoberturaAntCodeCoverageEnabler extends cc.CoberturaCodeCoverageEnabler {
Expand All @@ -18,7 +17,7 @@ export class CoberturaAntCodeCoverageEnabler extends cc.CoberturaCodeCoverageEna
// -----------------------------------------------------
// Enable code coverage for Cobertura Ant Builds
// - enableCodeCoverage: CodeCoverageProperties - ccProps
// -----------------------------------------------------
// -----------------------------------------------------
public enableCodeCoverage(ccProps: { [name: string]: string }): Q.Promise<boolean> {
let _this = this;

Expand All @@ -29,7 +28,7 @@ export class CoberturaAntCodeCoverageEnabler extends cc.CoberturaCodeCoverageEna
_this.buildFile = ccProps["buildfile"];
let classFilter = ccProps["classfilter"];
let srcDirs = ccProps["sourcedirectories"];
if (str(srcDirs).isEmpty()) {
if (util.isNullOrWhitespace(srcDirs)) {
srcDirs = ".";
}
_this.sourceDirs = srcDirs;
Expand All @@ -50,9 +49,9 @@ export class CoberturaAntCodeCoverageEnabler extends cc.CoberturaCodeCoverageEna
let ccfilter = [];

if (!util.isNullOrWhitespace(filter)) {
str(util.trimToEmptyString(filter)).replaceAll(".", "/").s.split(":").forEach(exFilter => {
util.trimToEmptyString(filter).replace(/\./g, "/").s.split(":").forEach(exFilter => {
if (exFilter) {
ccfilter.push(str(exFilter).endsWith("*") ? ("**/" + exFilter + "/**") : ("**/" + exFilter + ".class"));
ccfilter.push(exFilter.endsWith("*") ? ("**/" + exFilter + "/**") : ("**/" + exFilter + ".class"));
}
});
}
Expand All @@ -66,7 +65,7 @@ export class CoberturaAntCodeCoverageEnabler extends cc.CoberturaCodeCoverageEna
let classData = "";
let classDirs = _this.classDirs;

if (str(classDirs).isEmpty()) {
if (util.isNullOrWhitespace(classDirs)) {
classDirs = ".";
}
classDirs.split(",").forEach(cdir => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import * as util from "../utilities";
import * as tl from "vsts-task-lib/task";
import * as ccc from "../codecoverageconstants";
import * as cc from "../codecoverageenabler";
import * as str from "string";
import * as Q from "q";

export class CoberturaGradleCodeCoverageEnabler extends cc.CoberturaCodeCoverageEnabler {
// -----------------------------------------------------
// Enable code coverage for Cobertura Gradle Builds
// - enableCodeCoverage: CodeCoverageProperties - ccProps
// -----------------------------------------------------
// -----------------------------------------------------
public enableCodeCoverage(ccProps: { [name: string]: string }): Q.Promise<boolean> {
let _this = this;

Expand Down Expand Up @@ -49,7 +48,7 @@ export class CoberturaGradleCodeCoverageEnabler extends cc.CoberturaCodeCoverage
if (!util.isNullOrWhitespace(filter)) {
util.trimToEmptyString(filter).split(":").forEach(exFilter => {
if (exFilter) {
ccfilter.push(str(exFilter).endsWith("*") ? ("'.*" + util.trimEnd(exFilter, "*") + ".*'") : ("'.*" + exFilter + "'"));
ccfilter.push(exFilter.endsWith("*") ? ("'.*" + util.trimEnd(exFilter, "*") + ".*'") : ("'.*" + exFilter + "'"));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as util from "../utilities";
import * as tl from "vsts-task-lib/task";
import * as ccc from "../codecoverageconstants";
import * as cc from "../codecoverageenabler";
import * as str from "string";
import * as Q from "q";

export class CoberturaMavenCodeCoverageEnabler extends cc.CoberturaCodeCoverageEnabler {
Expand All @@ -13,7 +12,7 @@ export class CoberturaMavenCodeCoverageEnabler extends cc.CoberturaCodeCoverageE
// -----------------------------------------------------
// Enable code coverage for Cobertura Maven Builds
// - enableCodeCoverage: CodeCoverageProperties - ccProps
// -----------------------------------------------------
// -----------------------------------------------------
public enableCodeCoverage(ccProps: { [name: string]: string }): Q.Promise<boolean> {
let _this = this;

Expand All @@ -38,9 +37,9 @@ export class CoberturaMavenCodeCoverageEnabler extends cc.CoberturaCodeCoverageE
let ccfilter = [];

if (!util.isNullOrWhitespace(filter)) {
str(util.trimToEmptyString(filter)).replaceAll(".", "/").s.split(":").forEach(exFilter => {
util.trimToEmptyString(filter).replace(/\./g, "/").s.split(":").forEach(exFilter => {
if (exFilter) {
ccfilter.push(str(exFilter).endsWith("*") ? (exFilter + "/**") : (exFilter + ".class"));
ccfilter.push(exFilter.endsWith("*") ? (exFilter + "/**") : (exFilter + ".class"));
}
});
}
Expand Down
35 changes: 17 additions & 18 deletions Tasks/Common/codecoverage-tools/codecoverageconstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import * as path from "path";
import * as util from "./utilities";
import * as os from "os";
import * as str from "string";


// Enable Jacoco Code Coverage for Gradle builds using this props
Expand All @@ -19,16 +18,16 @@ allprojects {
def jacocoExcludes = [${excludeFilter}]
def jacocoIncludes = [${includeFilter}]

subprojects {
subprojects {
jacocoTestReport {
doFirst {
classDirectories = fileTree(dir: "${classFileDirectory}").exclude(jacocoExcludes).include(jacocoIncludes)
}

reports {
html.enabled = true
html.destination "\${buildDir}/jacocoHtml"
xml.enabled = true
xml.enabled = true
xml.destination "\${buildDir}/summary.xml"
}
}
Expand All @@ -45,7 +44,7 @@ task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
executionData = files(subprojects.jacocoTestReport.executionData)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files()

doFirst {
subprojects.each {
if (new File("\${it.sourceSets.main.output.classesDir}").exists()) {
Expand All @@ -57,10 +56,10 @@ task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
}
}
}

reports {
html.enabled = true
xml.enabled = true
xml.enabled = true
xml.destination "${reportDir}/summary.xml"
html.destination "${reportDir}/"
}
Expand All @@ -79,20 +78,20 @@ allprojects {

def jacocoExcludes = [${excludeFilter}]
def jacocoIncludes = [${includeFilter}]

jacocoTestReport {
doFirst {
classDirectories = fileTree(dir: "${classFileDirectory}").exclude(jacocoExcludes).include(jacocoIncludes)
}

reports {
html.enabled = true
xml.enabled = true
xml.enabled = true
xml.destination "${reportDir}/summary.xml"
html.destination "${reportDir}"
}
}

test {
finalizedBy jacocoTestReport
jacoco {
Expand All @@ -118,7 +117,7 @@ allprojects {
mavenCentral()
}
apply plugin: 'net.saliman.cobertura'

dependencies {
testCompile 'org.slf4j:slf4j-api:1.7.12'
}
Expand All @@ -141,20 +140,20 @@ allprojects {
mavenCentral()
}
apply plugin: 'net.saliman.cobertura'

dependencies {
testCompile 'org.slf4j:slf4j-api:1.7.12'
}

cobertura.coverageIncludes = [${includeFilter}]
cobertura.coverageExcludes = [${excludeFilter}]
}

test {
dependsOn = subprojects.test
}

cobertura {
cobertura {
coverageSourceDirs = []`;

if (classDir) {
Expand Down Expand Up @@ -239,7 +238,7 @@ export function jacocoMavenMultiModuleReport(reportDir: string, srcData: string,
classNode += ` />` + os.EOL;
});
let srcNode = "";
if (str(srcData).isEmpty()) {
if (util.isNullOrWhitespace(srcData)) {
srcNode = `<fileset dir="." />`;
} else {
srcData.split(",").forEach(c => {
Expand Down Expand Up @@ -312,12 +311,12 @@ export function jacocoMavenMultiModuleReport(reportDir: string, srcData: string,
export function coberturaMavenEnable(includeFilter: string, excludeFilter: string, aggregate: string): Q.Promise<any> {
let includeTag = "";
let excludeTag = "";
if (!str(excludeFilter).isEmpty()) {
if (!util.isNullOrWhitespace(excludeFilter)) {
excludeFilter.split(",").forEach(ex => {
excludeTag += `<exclude>${ex}</exclude>` + os.EOL;
});
}
if (!str(includeFilter).isEmpty()) {
if (!util.isNullOrWhitespace(includeFilter)) {
includeFilter.split(",").forEach(ex => {
includeTag += `<include>${ex}</include>` + os.EOL;
});
Expand Down
17 changes: 8 additions & 9 deletions Tasks/Common/codecoverage-tools/jacoco/jacoco.ant.ccenabler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as util from "../utilities";
import * as tl from "vsts-task-lib/task";
import * as ccc from "../codecoverageconstants";
import * as cc from "../codecoverageenabler";
import * as str from "string";
import * as os from "os";
import * as Q from "q";
import * as path from "path";
Expand All @@ -22,7 +21,7 @@ export class JacocoAntCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler {
// -----------------------------------------------------
// Enable code coverage for Jacoco Ant Builds
// - enableCodeCoverage: CodeCoverageProperties - ccProps
// -----------------------------------------------------
// -----------------------------------------------------
public enableCodeCoverage(ccProps: { [name: string]: string }): Q.Promise<boolean> {
let _this = this;

Expand Down Expand Up @@ -52,9 +51,9 @@ export class JacocoAntCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler {
let ccfilter = [];

if (!util.isNullOrWhitespace(filter)) {
str(util.trimToEmptyString(filter)).replaceAll(".", "/").s.split(":").forEach(exFilter => {
util.trimToEmptyString(filter).replace(/\./g, "/").s.split(":").forEach(exFilter => {
if (exFilter) {
ccfilter.push(str(exFilter).endsWith("*") ? ("**/" + exFilter + "/**") : ("**/" + exFilter + ".class"));
ccfilter.push(exFilter.endsWith("*") ? ("**/" + exFilter + "/**") : ("**/" + exFilter + ".class"));
}
});
}
Expand All @@ -67,12 +66,12 @@ export class JacocoAntCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler {
let srcData = "";
let srcDirs = this.sourceDirs === null ? "" : this.sourceDirs;
srcDirs.split(",").forEach(dir => {
if (!str(dir).isEmpty()) {
if (!util.isNullOrWhitespace(dir)) {
srcData += `<fileset dir="${dir}"/>`;
srcData += os.EOL;
}
});
if (str(srcData).isEmpty()) {
if (util.isNullOrWhitespace(srcData)) {
srcData = `<fileset dir="."/>`;
srcData += os.EOL;
}
Expand All @@ -92,7 +91,7 @@ export class JacocoAntCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler {
classData += `/>`;
classData += os.EOL;
});
if (str(classData).isEmpty()) {
if (util.isNullOrWhitespace(classData)) {
classData += `<fileset dir="."${this.includeFilter} ${this.excludeFilter} />`;
classData += os.EOL;
}
Expand Down Expand Up @@ -145,10 +144,10 @@ export class JacocoAntCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler {
let testNodes = ["junit", "java", "testng", "batchtest"];
let coverageNode = ccc.jacocoAntCoverageEnable(_this.reportDir);

if (!str(_this.includeFilter).isEmpty()) {
if (!util.isNullOrWhitespace(_this.includeFilter)) {
coverageNode.$.includes = _this.includeFilterExec;
}
if (!str(_this.excludeFilter).isEmpty()) {
if (!util.isNullOrWhitespace(_this.excludeFilter)) {
coverageNode.$.excludes = _this.excludeFilterExec;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import * as util from "../utilities";
import * as tl from "vsts-task-lib/task";
import * as ccc from "../codecoverageconstants";
import * as cc from "../codecoverageenabler";
import * as str from "string";
import * as Q from "q";

export class JacocoGradleCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler {
// -----------------------------------------------------
// Enable code coverage for Jacoco Gradle Builds
// - enableCodeCoverage: CodeCoverageProperties - ccProps
// -----------------------------------------------------
// -----------------------------------------------------
public enableCodeCoverage(ccProps: { [name: string]: string }): Q.Promise<boolean> {
let _this = this;

Expand Down Expand Up @@ -48,9 +47,9 @@ export class JacocoGradleCodeCoverageEnabler extends cc.JacocoCodeCoverageEnable
let ccfilter = [];

if (!util.isNullOrWhitespace(filter)) {
str(util.trimToEmptyString(filter)).replaceAll(".", "/").s.split(":").forEach(exFilter => {
util.trimToEmptyString(filter).replace(/\./g, "/").s.split(":").forEach(exFilter => {
if (exFilter) {
ccfilter.push(str(exFilter).endsWith("*") ? ("'" + exFilter + "/**'") : ("'" + exFilter + ".class'"));
ccfilter.push(exFilter.endsWith("*") ? ("'" + exFilter + "/**'") : ("'" + exFilter + ".class'"));
}
});
}
Expand Down
11 changes: 5 additions & 6 deletions Tasks/Common/codecoverage-tools/jacoco/jacoco.maven.ccenabler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as util from "../utilities";
import * as tl from "vsts-task-lib/task";
import * as ccc from "../codecoverageconstants";
import * as cc from "../codecoverageenabler";
import * as str from "string";
import * as Q from "q";

export class JacocoMavenCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler {
Expand All @@ -18,7 +17,7 @@ export class JacocoMavenCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler
// -----------------------------------------------------
// Enable code coverage for Jacoco Maven Builds
// - enableCodeCoverage: CodeCoverageProperties - ccProps
// -----------------------------------------------------
// -----------------------------------------------------
public enableCodeCoverage(ccProps: { [name: string]: string }): Q.Promise<boolean> {
let _this = this;

Expand Down Expand Up @@ -46,9 +45,9 @@ export class JacocoMavenCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler
let ccfilter = [];

if (!util.isNullOrWhitespace(filter)) {
str(util.trimToEmptyString(filter)).replaceAll(".", "/").s.split(":").forEach(exFilter => {
util.trimToEmptyString(filter).replace(/\./g, "/").s.split(":").forEach(exFilter => {
if (exFilter) {
ccfilter.push(str(exFilter).endsWith("*") ? ("**/" + exFilter + "/**") : ("**/" + exFilter + ".class"));
ccfilter.push(exFilter.endsWith("*") ? ("**/" + exFilter + "/**") : ("**/" + exFilter + ".class"));
}
});
}
Expand Down Expand Up @@ -136,10 +135,10 @@ export class JacocoMavenCodeCoverageEnabler extends cc.JacocoCodeCoverageEnabler
let includeFilter = _this.includeFilter.join(",");
let excludeFilter = _this.excludeFilter.join(",");

if (str(srcDirs).isEmpty()) {
if (util.isNullOrWhitespace(srcDirs)) {
srcDirs = ".";
}
if (str(classDirs).isEmpty()) {
if (util.isNullOrWhitespace(classDirs)) {
classDirs = ".";
}

Expand Down
Loading