Skip to content

Commit

Permalink
Merge pull request #87 from sschuberth/master
Browse files Browse the repository at this point in the history
Make use of "Groovy truth" for Strings
  • Loading branch information
hierynomus committed Oct 22, 2015
2 parents a70ec8a + c933bd2 commit 067175d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LicenseReporter {
def attributes = [name: l.licenseName]

// Miss attribute if it's empty
if (!isNullOrEmpty(l.licenseTextUrl)) {
if (l.licenseTextUrl) {
attributes << [url: l.licenseTextUrl]
}

Expand All @@ -46,10 +46,6 @@ class LicenseReporter {
}
}

private static boolean isNullOrEmpty(String s) {
return s == null || s.isEmpty()
}

/**
* Generate xml report grouping by licenses.
*
Expand All @@ -66,7 +62,7 @@ class LicenseReporter {
def attributes = [name: entry.key.licenseName]

// Miss attribute if it's empty
if(!isNullOrEmpty(entry.key.licenseTextUrl)) {
if(entry.key.licenseTextUrl) {
attributes << [url: entry.key.licenseTextUrl]
}
license(attributes) {
Expand Down Expand Up @@ -140,7 +136,7 @@ class LicenseReporter {
td(entry.dependencyFileName, class: 'licenseName')
td(license.licenseName, class: 'licenseName')
td(class: 'license') {
if (!isNullOrEmpty(license.licenseTextUrl)) {
if (license.licenseTextUrl) {
a(href: license.licenseTextUrl, "Show license agreement")
}
}
Expand Down Expand Up @@ -218,7 +214,7 @@ class LicenseReporter {
tr {
td(entry.key.licenseName, class: 'licenseName')
td(class: 'license') {
if (!isNullOrEmpty(entry.key.licenseTextUrl)) {
if (entry.key.licenseTextUrl) {
a(href: entry.key.licenseTextUrl, "License agreement")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class LicenseResolver {

if (pomData.hasLicense()) {
pomData
} else if (xml.parent.text() != null && !xml.parent().text().isEmpty()) {
} else if (xml.parent.text()) {
String parentGroup = xml.parent.groupId.text().trim()
String parentName = xml.parent.artifactId.text().trim()
String parentVersion = xml.parent.version.text().trim()
Expand Down

0 comments on commit 067175d

Please sign in to comment.