Merge changes Ie5b99c2a,I0746546c,I40349324,Idf584990,If008a747, ...
* changes:
config-faqs: Explain how to define default code owners
Add metric to count submit rule errors
config.md: Fix bad link
CodeOwnerSubmitRule: Report metric for invalid OWNERS files
Improve error message if CodeOwnerSubmitRule fails due invalid OWNERS file
Move getParsingErrorMessage method up to test base class
Test that CodeOwnerSubmitRule returns rule error if OWNERS file is invalid
Fix names of code owner metrics
Fix counting submit rule runs as metric
Move method to get code owner config file name up to base test class
Add metric that counts how often invalid OWNERS files cause failures
Allow to configure an info URL that is shown if an OWNERS file is invalid
GeneralConfig: Factor out a method to read a string value
GeneralConfig: Fix variable name
Add specific exception to signal invalid code owner config files
CheckCodeOwner: Handle files owned by all users
Config doc: Clarify that this is not the config that defines code owners
Document that keeping the global config in All-Projects may be dangerous
User guide: Make clear that label functions are orthogonal to code owners
User guide: Explain when code owner submit records in the index get stale
User guide: Add section about code owners submit rule
Disallow projects to override inherited list configuration parameters
diff --git a/ui/code-owners-api.js b/ui/code-owners-api.js
index a1a1aed..e9a0227 100644
--- a/ui/code-owners-api.js
+++ b/ui/code-owners-api.js
@@ -129,8 +129,8 @@
`branches/${encodeURIComponent(branch)}/` +
`code_owners.branch_config`
);
- if (config.override_approval && !(config.override_approval
- instanceof Array)) {
+ if (config.override_approval &&
+ !(config.override_approval instanceof Array)) {
// In the upcoming backend changes, the override_approval will be changed
// to array with (possible) multiple items.
// While this transition is in progress, the frontend supports both API -
diff --git a/ui/code-owners-service.js b/ui/code-owners-service.js
index 0db6226..bf9fa4e 100644
--- a/ui/code-owners-service.js
+++ b/ui/code-owners-service.js
@@ -174,8 +174,8 @@
const oldPathStatus = status.old_path_status;
const newPathStatus = status.new_path_status;
// For deleted files, no new_path_status exists
- return (newPathStatus && newPathStatus.status !== OwnerStatus.APPROVED)
- || (oldPathStatus && oldPathStatus.status !== OwnerStatus.APPROVED);
+ return (newPathStatus && newPathStatus.status !== OwnerStatus.APPROVED) ||
+ (oldPathStatus && oldPathStatus.status !== OwnerStatus.APPROVED);
});
}
@@ -231,7 +231,6 @@
this.ownersProviders[suggestionsType].resume();
}
-
_formatStatuses(statuses) {
// convert the array of statuses to map between file path -> status
return statuses.reduce((prev, cur) => {
@@ -285,7 +284,8 @@
provider.reset();
}
const codeOwnersApi = new CodeOwnersApi(this.restApi);
- this.codeOwnersCacheApi = new CodeOwnersCacheApi(codeOwnersApi, change);
+ this.codeOwnersCacheApi =
+ new CodeOwnersCacheApi(codeOwnersApi, this.change);
}
async getBranchConfig() {
diff --git a/ui/owner-requirement.js b/ui/owner-requirement.js
index e6ced63..5fcbeec 100644
--- a/ui/owner-requirement.js
+++ b/ui/owner-requirement.js
@@ -65,7 +65,7 @@
</p>
<template is="dom-if" if="[[!_isLoading]]">
<template is="dom-if" if="[[!_pluginFailed(model.pluginStatus)]]">
- <template is="dom-if" if="[[!model.branchConfig.no_code_owners_defined]]">
+ <template is="dom-if" if="[[!model.branchConfig.no_code_owners_defined]]">
<span>[[_computeStatusText(_statusCount, _isOverriden)]]</span>
<template is="dom-if" if="[[_overrideInfoUrl]]">
<a on-click="_reportDocClick" href="[[_overrideInfoUrl]]"
@@ -78,7 +78,7 @@
[[_getSuggestOwnersText(_statusCount)]]
</gr-button>
</template>
- <template is="dom-if" if="[[model.branchConfig.no_code_owners_defined]]">
+ <template is="dom-if" if="[[model.branchConfig.no_code_owners_defined]]">
<span>No code-owners file</span>
<a href="https://gerrit.googlesource.com/plugins/code-owners/+/master/resources/Documentation/user-guide.md#how-to-submit-changes-with-files-that-have-no-code-owners" target="_blank">
<iron-icon icon="gr-icons:help-outline"
@@ -101,8 +101,8 @@
_statusCount: Object,
_isLoading: {
type: Boolean,
- computed: '_computeIsLoading(model.branchConfig, model.status, '
- + 'model.userRole, model.pluginStatus)',
+ computed: '_computeIsLoading(model.branchConfig, model.status, ' +
+ 'model.userRole, model.pluginStatus)',
},
_isOverriden: {
type: Boolean,
@@ -155,8 +155,8 @@
if (!branchConfig) {
return '';
}
- return branchConfig.general && branchConfig.general.override_info_url
- ? branchConfig.general.override_info_url : '';
+ return branchConfig.general && branchConfig.general.override_info_url ?
+ branchConfig.general.override_info_url : '';
}
_computeIsOverriden(change, branchConfig) {
diff --git a/ui/owner-status-column.js b/ui/owner-status-column.js
index 4e6e055..8f57a2b 100644
--- a/ui/owner-status-column.js
+++ b/ui/owner-status-column.js
@@ -51,8 +51,8 @@
computeHidden(change, patchRange) {
if ([change, patchRange].includes(undefined)) return true;
// if code-owners is not a submit requirement, don't show status column
- if (change.requirements
- && !change.requirements.find(r => r.type === 'code-owners')) {
+ if (change.requirements &&
+ !change.requirements.find(r => r.type === 'code-owners')) {
return true;
}
@@ -205,9 +205,9 @@
if (!oldPathStatus) {
this.status = newPathStatus;
} else {
- this.status = newPathStatus === STATUS_CODE.APPROVED
- ? this._computeStatus(oldPathStatus, /* oldPath= */ true)
- : newPathStatus;
+ this.status = newPathStatus === STATUS_CODE.APPROVED ?
+ this._computeStatus(oldPathStatus, /* oldPath= */ true) :
+ newPathStatus;
}
}
diff --git a/ui/suggest-owners-util.js b/ui/suggest-owners-util.js
index 898a6e5..fb18a0f 100644
--- a/ui/suggest-owners-util.js
+++ b/ui/suggest-owners-util.js
@@ -30,7 +30,6 @@
export function getDisplayOwnersGroups(files, allOwnersByPathMap,
reviewersIdSet, allowAllOwnersSubstition) {
-
const getDisplayOwnersFunc =
!allowAllOwnersSubstition || allOwnersByPathMap.size === 0 ||
reviewersIdSet.size === 0 ?
diff --git a/ui/suggest-owners.js b/ui/suggest-owners.js
index bf4fff3..c3ea6cf 100644
--- a/ui/suggest-owners.js
+++ b/ui/suggest-owners.js
@@ -16,7 +16,6 @@
*/
import {CodeOwnersModelMixin} from './code-owners-model-mixin.js';
import {
- BestSuggestionsLimit,
SuggestionsState,
SuggestionsType,
} from './code-owners-model.js';
@@ -103,7 +102,7 @@
border: 1px solid var(--view-background-color);
border-radius: var(--border-radius);
box-shadow: var(--elevation-level-1);
- padding: var(--spacing-s);
+ padding: 0 var(--spacing-m);
margin: var(--spacing-m) 0;
}
p.loading {
@@ -136,10 +135,10 @@
}
.show-all-owners-row {
padding: var(--spacing-m) var(--spacing-xl) var(--spacing-s);
- justify-content: flex-end;
+ justify-content: flex-end;
}
.suggestion-row-indicator {
- margin-right: var(--spacing-m);
+ margin-right: var(--spacing-s);
visibility: hidden;
line-height: 26px;
}
@@ -150,14 +149,16 @@
color: var(--link-color);
vertical-align: top;
position: relative;
- top: 3px; /* (26-20)/2 - 26px line-height and 20px icon */
+ --iron-icon-height: 18px;
+ --iron-icon-width: 18px;
+ top: 4px; /* (26-18)/2 - 26px line-height and 18px icon */
}
.suggestion-group-name {
- width: 200px;
+ width: 260px;
line-height: 26px;
text-overflow: ellipsis;
overflow: hidden;
- padding-right: var(--spacing-l);
+ padding-right: var(--spacing-s);
white-space: nowrap;
}
.group-name-content {
@@ -175,7 +176,7 @@
color: var(--deemphasized-text-color);
}
.suggested-owners {
- --account-gap: var(--spacing-s);
+ --account-gap: var(--spacing-xs);
--negative-account-gap: calc(-1*var(--account-gap));
margin: var(--negative-account-gap) 0 0 var(--negative-account-gap);
flex: 1;
@@ -308,7 +309,7 @@
</div>
</template>
<template is="dom-if" if="[[!suggestion.owners.owned_by_all_users]]">
- <template is="dom-if" if="[[_breakBeforeOwners(suggestion.owners.code_owners, _showAllOwners)]]">
+ <template is="dom-if" if="[[_showAllOwners]]">
<div class="flex-break"></div>
</template>
<ul class="suggested-owners">
@@ -617,7 +618,8 @@
this.suggestedOwners.forEach((suggestion, sId) => {
let hasSelected = false;
suggestion.owners.code_owners.forEach((owner, oId) => {
- if (accounts.some(account => account._account_id === owner.account._account_id)) {
+ if (accounts.some(
+ account => account._account_id === owner.account._account_id)) {
this.set(
['suggestedOwners', sId, 'owners', 'code_owners', oId],
{...owner,
@@ -672,11 +674,6 @@
this.model.setSelectedSuggestionType(showAll ?
SuggestionsType.ALL_SUGGESTIONS : SuggestionsType.BEST_SUGGESTIONS);
}
-
- _breakBeforeOwners(codeOwners, showAllOwners) {
- if (!codeOwners || !showAllOwners) return false;
- return codeOwners.length > BestSuggestionsLimit;
- }
}
customElements.define(SuggestOwners.is, SuggestOwners);