Fix minor JavaScript issues
Change-Id: Ied3e8d30d79c64ba9280725274bc6d91a3048496
diff --git a/zuul-results-summary/zuul-results-summary.js b/zuul-results-summary/zuul-results-summary.js
index f8160db..2259362 100644
--- a/zuul-results-summary/zuul-results-summary.js
+++ b/zuul-results-summary/zuul-results-summary.js
@@ -12,7 +12,6 @@
// License for the specific language governing permissions and limitations
// under the License.
-
// TODO(ianw) : find some way to make this configurable
const ZUUL_PRIORITY = [22348];
@@ -22,21 +21,23 @@
class ZuulSummaryStatusTab extends Polymer.Element {
/** Get properties
+ *
* @returns {dict} change and revision
- */
+ */
static get properties() {
return {
change: {
type: Object,
- observer: '_changeChanged'
+ observer: '_changeChanged',
},
revision: Object,
};
}
/** Get template
+ *
* @returns {Polymer.html} the template
- */
+ */
static get template() {
return Polymer.html`
<style>
@@ -152,15 +153,17 @@
}
/** Look for Zuul tag in message
+ *
* @param{ChangeMessageInfo} message
* @returns {bool} if this is a Zuul message or not
*/
_match_message_via_tag(message) {
- return (message.tag &&
- message.tag.startsWith('autogenerated:zuul')) ? true : false;
+ return !!(message.tag &&
+ message.tag.startsWith('autogenerated:zuul'));
}
/** Look for 3rd-party CI messages via regex
+ *
* @param{ChangeMessageInfo} message
* @returns {bool} if this is a Zuul-ish message or not
*/
@@ -168,10 +171,11 @@
// TODO: allow this to be passed in via config
const authorRe = /^(?<author>.* CI|Zuul)/;
const author = authorRe.exec(message.author.name);
- return author ? true : false;
+ return !!author;
}
/** Extract the status and pipeline from the message
+ *
* @param{ChangeMessageInfo} message
* @returns {list} status and pipeline
*/
@@ -201,7 +205,7 @@
/*
* change-view-tab-content gets passed ChangeInfo object [1],
* registered in the property "change". We walk the list of
- * messages with some regexps to extract into a datastructure
+ * messages with some regexps to extract into a data structure
* stored in __table
*
* __table is an [] of objects
@@ -252,7 +256,7 @@
// the same revision, it's considered a "recheck" ... i.e. likely
// manually triggered to run again. Take a note of this.
let rechecks = 0;
- if (existing != -1) {
+ if (existing !== -1) {
if (this.__table[existing].revision === revision) {
rechecks = this.__table[existing].rechecks + 1;
}
@@ -265,14 +269,14 @@
const resultRe = /^- (?<job>[^ ]+) (?:(?<link>https?:\/\/[^ ]+)|[^ ]+) : (?<result>[^ ]+)( in (?<time>.*))?/;
lines.forEach(line => {
const result = resultRe.exec(line);
- if (result) {
- // Note SKIPPED jobs have no time and an invalid placeholder
- // URL. Since there's no point linking this URL, null
- // that match out and it will just use the job name but not
- // make it a <a>.
- if (result.groups.result === "SKIPPED") {
- result.groups.link = null;
- }
+ if (result) {
+ // Note SKIPPED jobs have no time and an invalid placeholder
+ // URL. Since there's no point linking this URL, null
+ // that match out and it will just use the job name but not
+ // make it a <a>.
+ if (result.groups.result === 'SKIPPED') {
+ result.groups.link = null;
+ }
results.push(result.groups);
}
});
@@ -285,12 +289,12 @@
date,
date_string: date.toLocaleString(),
status,
- succeeded: status === 'succeeded' ? true : false,
+ succeeded: status === 'succeeded',
pipeline,
results,
};
- if (existing == -1) {
+ if (existing === -1) {
this.__table.push(table);
} else {
this.__table[existing] = table;
@@ -317,13 +321,13 @@
* Tab Header Element
*/
class ZuulSummaryStatusTabHeader extends Polymer.Element {
-
- /** Get template
- * @returns {Polymer.html} the template
- */
- static get template() {
- return Polymer.html`Zuul Summary`;
- }
+ /** Get template
+ *
+ * @returns {Polymer.html} the template
+ */
+ static get template() {
+ return Polymer.html`Zuul Summary`;
+ }
}
customElements.define('zuul-summary-status-tab-header',