From 169d30d6839fc583f2febb8120c23cc219217441 Mon Sep 17 00:00:00 2001 From: Ole Rehmsen Date: Tue, 14 May 2019 17:57:41 +0200 Subject: [PATCH 01/15] Downport "Simplify running frontend tests via package.json" package.json is an NPM manifest file that allows a project to declare its depedencies. We already ask people to use npm in our readme [1], listing the packages they need to install. This easily gets out of date. The standard for NPM is to list deps in and their versions in package.json instead. This change only adds the deps needed to run the tests, and configures the `npm test` command to run all Gerrit frontend tests. In future iterations we should also add other devDependencies and simplify our docs. If the general approach is accepted, I can send follow up changes to do that. This change further makes run_test.sh and friends work for locally installed WCT. That is generally preferrable since it does not require root, does not clutter global system paths etc. The global version is still used when installed though (for backward compatibility - we might decide to change that in future). [1] https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/ Change-Id: I854f7b9c981721f3a00b496124110db04cc93ab6 --- package.json | 18 +++++++++++++++++ polygerrit-ui/README.md | 37 +++++++++++++++-------------------- polygerrit-ui/app/run_test.sh | 22 ++++++++++++++++++++- polygerrit-ui/app/wct_test.sh | 4 ++-- 4 files changed, 57 insertions(+), 24 deletions(-) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000000..0c99089570 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "gerrit", + "version": "3.1.0-SNAPSHOT", + "description": "Gerrit Code Review", + "dependencies": {}, + "devDependencies": { + "web-component-tester": "^6.5.0" + }, + "scripts": { + "test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh" + }, + "repository": { + "type": "git", + "url": "https://gerrit.googlesource.com/gerrit" + }, + "author": "", + "license": "Apache-2.0" +} diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md index 5d0d22f6e8..f785ac9652 100644 --- a/polygerrit-ui/README.md +++ b/polygerrit-ui/README.md @@ -27,14 +27,14 @@ Various steps below require installing additional npm packages. The full list of dependencies can be installed with: ```sh +npm install sudo npm install -g \ eslint \ eslint-config-google \ eslint-plugin-html \ typescript \ fried-twinkie \ - polylint \ - web-component-tester + polylint ``` It may complain about a missing `typescript@2.3.4` peer dependency, which is @@ -53,14 +53,16 @@ you to use the "test data" technique described below. To test the local UI against gerrit-review.googlesource.com: ```sh -./run-server.sh +./polygerrit-ui/run-server.sh ``` Then visit http://localhost:8081 ## Local UI, Test Data -One-time setup: +```sh +./polygerrit-ui/run-server.sh --plugins=plugins/my_plugin/static/my_plugin.js,plugins/my_plugin/static/my_plugin.html +``` 1. [Build Gerrit](https://gerrit-review.googlesource.com/Documentation/dev-bazel.html#_gerrit_development_war_file) 2. Set up a local test site. Docs @@ -100,10 +102,17 @@ This step requires the `web-component-tester` npm module. Note: it may be necessary to add the options `--unsafe-perm=true --allow-root` to the `npm install` command to avoid file permission errors. -Run all web tests: +For daily development you typically only want to run and debug individual tests. +Run the local [Go proxy server](#go-server) and navigate for example to +. +Check "Disable cache" in the "Network" tab of Chrome's dev tools, so code +changes are picked up on "reload". + +Our CI integration ensures that all tests are run when you upload a change to +Gerrit, but you can also run all tests locally in headless mode: ```sh -./polygerrit-ui/app/run_test.sh +npm test ``` To allow the tests to run in Safari: @@ -111,24 +120,10 @@ To allow the tests to run in Safari: * In the Advanced preferences tab, check "Show Develop menu in menu bar". * In the Develop menu, enable the "Allow Remote Automation" option. -If you need to pass additional arguments to `wct`: - -```sh -WCT_ARGS='-p --some-flag="foo bar"' ./polygerrit-ui/app/run_test.sh -``` - -For interactively working on a single test file, do the following: - -```sh -./polygerrit-ui/run-server.sh -``` - -Then visit http://localhost:8081/elements/foo/bar_test.html - To run Chrome tests in headless mode: ```sh -WCT_HEADLESS_MODE=1 ./polygerrit-ui/app/run_test.sh +WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh ``` Toolchain requirements for headless mode: diff --git a/polygerrit-ui/app/run_test.sh b/polygerrit-ui/app/run_test.sh index 7b48480ce5..e9be18d65d 100755 --- a/polygerrit-ui/app/run_test.sh +++ b/polygerrit-ui/app/run_test.sh @@ -6,9 +6,29 @@ if [[ -z "$npm_bin" ]]; then exit 1 fi +# From https://www.linuxquestions.org/questions/programming-9/bash-script-return-full-path-and-filename-680368/page3.html +function abs_path { + if [[ -d "$1" ]] + then + pushd "$1" >/dev/null + pwd + popd >/dev/null + elif [[ -e $1 ]] + then + pushd "$(dirname "$1")" >/dev/null + echo "$(pwd)/$(basename "$1")" + popd >/dev/null + else + echo "$1" does not exist! >&2 + return 127 + fi +} wct_bin=$(which wct) if [[ -z "$wct_bin" ]]; then - echo "WCT must be on the path. (https://github.com/Polymer/web-component-tester)" + wct_bin=$(abs_path ./node_modules/web-component-tester/bin/wct); +fi +if [[ -z "$wct_bin" ]]; then + echo "wct_bin must be set or WCT locally installed (npm install wct)." exit 1 fi diff --git a/polygerrit-ui/app/wct_test.sh b/polygerrit-ui/app/wct_test.sh index a8394cdb31..dd16ba7e1d 100755 --- a/polygerrit-ui/app/wct_test.sh +++ b/polygerrit-ui/app/wct_test.sh @@ -60,9 +60,9 @@ module.exports = { }; EOF -export PATH="$(dirname $WCT):$(dirname $NPM):$PATH" +export PATH="$(dirname $NPM):$PATH" cd $t test -n "${WCT}" -$(basename ${WCT}) ${WCT_ARGS} +${WCT} ${WCT_ARGS} From d43f779f6b67da0382e9251255a15882fc726496 Mon Sep 17 00:00:00 2001 From: Ole Rehmsen Date: Wed, 15 May 2019 15:24:47 +0200 Subject: [PATCH 02/15] Downport "Simplify installing and running eslint" Add it to package.json so that - we can control the version installed locally - documentation is less likely to get out of sync - the command is shorter and easier to memorize - just run `npm run eslint` instead of providing all the command line options Change-Id: Ic5a9e648daa15c9206e305b1befd22941651ae8a --- package.json | 6 +++++- polygerrit-ui/README.md | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 0c99089570..b76a0369dc 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,14 @@ "description": "Gerrit Code Review", "dependencies": {}, "devDependencies": { + "eslint": "^5.16.0", + "eslint-config-google": "^0.13.0", + "eslint-plugin-html": "^5.0.5", "web-component-tester": "^6.5.0" }, "scripts": { - "test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh" + "test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh", + "eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0" }, "repository": { "type": "git", diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md index f785ac9652..a5279496a2 100644 --- a/polygerrit-ui/README.md +++ b/polygerrit-ui/README.md @@ -29,9 +29,6 @@ dependencies can be installed with: ```sh npm install sudo npm install -g \ - eslint \ - eslint-config-google \ - eslint-plugin-html \ typescript \ fried-twinkie \ polylint @@ -154,11 +151,22 @@ to supply the `--ext .html` flag. Some useful commands: * To run ESLint on the whole app, less some dependency code: -`eslint --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app` + +```sh +npm run eslint +``` + * To run ESLint on just the subdirectory you modified: -`eslint --ext .html,.js polygerrit-ui/app/$YOUR_DIR_HERE` + +```sh +node_modules/eslint/bin/eslint.js --ext .html,.js polygerrit-ui/app/$YOUR_DIR_HERE +``` + * To run the linter on all of your local changes: -`git diff --name-only master | xargs eslint --ext .html,.js` + +```sh +git diff --name-only master | xargs node_modules/eslint/bin/eslint.js --ext .html,.js +``` We also use the `polylint` tool to lint use of Polymer. To install polylint, execute the following command. From 47403815d6cb8a3b085d454cd09aaae2be4b9cc7 Mon Sep 17 00:00:00 2001 From: Ole Rehmsen Date: Thu, 16 May 2019 10:06:03 +0200 Subject: [PATCH 03/15] Downport "Simplify installing / running template tests" Also fixed a bug in the script that would cause it to ignore half of the arguments. Change-Id: Iba65c8d2e10a35c06946d28cfcaa76c61314e2b0 --- package.json | 5 ++++- polygerrit-ui/README.md | 11 +++++++---- polygerrit-ui/app/run_template_test.sh | 2 +- polygerrit-ui/app/template_test.sh | 13 ------------- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index b76a0369dc..f096e2a84d 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,14 @@ "eslint": "^5.16.0", "eslint-config-google": "^0.13.0", "eslint-plugin-html": "^5.0.5", + "fried-twinkie": "^0.2.2", + "typescript": "^2.x.x", "web-component-tester": "^6.5.0" }, "scripts": { "test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh", - "eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0" + "eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0", + "test-template": "./polygerrit-ui/app/run_template_test.sh" }, "repository": { "type": "git", diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md index a5279496a2..7451576038 100644 --- a/polygerrit-ui/README.md +++ b/polygerrit-ui/README.md @@ -28,10 +28,7 @@ dependencies can be installed with: ```sh npm install -sudo npm install -g \ - typescript \ - fried-twinkie \ - polylint +sudo npm install -g polylint ``` It may complain about a missing `typescript@2.3.4` peer dependency, which is @@ -191,6 +188,12 @@ To run on all files, execute the following command: ./polygerrit-ui/app/run_template_test.sh ``` +or + +```sh +npm run test-template +``` + To run on a specific top level directory (ex: change-list) ```sh TEMPLATE_NO_DEFAULT=true ./polygerrit-ui/app/run_template_test.sh //polygerrit-ui/app:template_test_change-list diff --git a/polygerrit-ui/app/run_template_test.sh b/polygerrit-ui/app/run_template_test.sh index 4cd6e7f611..d2b6989746 100755 --- a/polygerrit-ui/app/run_template_test.sh +++ b/polygerrit-ui/app/run_template_test.sh @@ -3,7 +3,7 @@ if [[ -z "${TEMPLATE_NO_DEFAULT}" ]]; then bazel test \ --test_env="HOME=$HOME" \ - //polygerrit-ui/app:all + //polygerrit-ui/app:all \ --test_tag_filters=template \ "$@" \ --test_output errors \ diff --git a/polygerrit-ui/app/template_test.sh b/polygerrit-ui/app/template_test.sh index eb986c5923..2782b65f88 100755 --- a/polygerrit-ui/app/template_test.sh +++ b/polygerrit-ui/app/template_test.sh @@ -14,19 +14,6 @@ if [[ -z "$npm_bin" ]]; then exit 1 fi -fried_twinkie_config=$(npm list -g | grep -c fried-twinkie) && true -if [ -z "$npm_bin" ] || [ "$fried_twinkie_config" -eq "0" ]; then - echo "You must install fried twinkie and its dependencies from NPM." - echo "> npm install -g fried-twinkie" - exit 1 -fi - -twinkie_version=$(npm list -g fried-twinkie@\>0.1 | grep fried-twinkie || :) && true -if [ -z "$twinkie_version" ]; then - echo "Outdated version of fried-twinkie found. Bypassing template check." - exit 0 -fi - # Have to find where node_modules are installed and set the NODE_PATH get_node_path() { From 3665d2b190c4c927052334aef653e324afc28ee8 Mon Sep 17 00:00:00 2001 From: Ole Rehmsen Date: Mon, 3 Jun 2019 17:13:36 +0200 Subject: [PATCH 04/15] Downport "Make `npm start` run run-server.sh" Having an `npm start` defined is pretty standard in NPM land, and run-server.sh requires least custom setup (such as initializing a dev site). I decided not to update the readme because it get's more complicated then when you want to define plugins and so on. Change-Id: I5346599bf53646b503d4877a5cbe41ccd22786df --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index f096e2a84d..8a18318f92 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "web-component-tester": "^6.5.0" }, "scripts": { + "start": "polygerrit-ui/run-server.sh", "test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh", "eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0", "test-template": "./polygerrit-ui/app/run_template_test.sh" From ae106df68e4df47c4d455bc747199a3d857f26be Mon Sep 17 00:00:00 2001 From: Ole Rehmsen Date: Thu, 16 May 2019 15:27:14 +0200 Subject: [PATCH 05/15] Downport "Simplify installing / running polylint" Install it locally (to avoid version clashes) and then run it with npx (which finds the locally installed package even when it's not on the path). Change-Id: Ib0a6a57d373ada0b22d2030053ac696845059bc6 --- package.json | 4 +++- polygerrit-ui/README.md | 8 +++++++- polygerrit-ui/app/polylint_test.sh | 10 +++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8a18318f92..6b9a38d981 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "eslint-config-google": "^0.13.0", "eslint-plugin-html": "^5.0.5", "fried-twinkie": "^0.2.2", + "polylint": "^2.10.4", "typescript": "^2.x.x", "web-component-tester": "^6.5.0" }, @@ -15,7 +16,8 @@ "start": "polygerrit-ui/run-server.sh", "test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh", "eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0", - "test-template": "./polygerrit-ui/app/run_template_test.sh" + "test-template": "./polygerrit-ui/app/run_template_test.sh", + "polylint": "bazel test polygerrit-ui/app:polylint_test" }, "repository": { "type": "git", diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md index 7451576038..2d8096aae3 100644 --- a/polygerrit-ui/README.md +++ b/polygerrit-ui/README.md @@ -28,7 +28,6 @@ dependencies can be installed with: ```sh npm install -sudo npm install -g polylint ``` It may complain about a missing `typescript@2.3.4` peer dependency, which is @@ -173,6 +172,13 @@ To run polylint, execute the following command. ```sh bazel test //polygerrit-ui/app:polylint_test ``` + +or + +```sh +npm run polylint +``` + ## Template Type Safety Polymer elements are not type checked against the element definition, making it trivial to break the display when refactoring or moving code. We now run additional tests to help ensure that template types are checked. diff --git a/polygerrit-ui/app/polylint_test.sh b/polygerrit-ui/app/polylint_test.sh index ee69ce2aa8..f6880a125a 100755 --- a/polygerrit-ui/app/polylint_test.sh +++ b/polygerrit-ui/app/polylint_test.sh @@ -8,13 +8,13 @@ if [[ -z "$npm_bin" ]]; then exit 1 fi -polylint_bin=$(which polylint) -if [[ -z "$polylint_bin" ]]; then - echo "You must install polylint and its dependencies from NPM." - echo "> npm install -g polylint" +npx_bin=$(which npx) +if [[ -z "$npx_bin" ]]; then + echo "NPX must be on the path." + echo "> npm i -g npx" exit 1 fi unzip -o polygerrit-ui/polygerrit_components.bower_components.zip -d polygerrit-ui/app -${polylint_bin} --root polygerrit-ui/app --input elements/gr-app.html --b 'bower_components' \ No newline at end of file +npx polylint --root polygerrit-ui/app --input elements/gr-app.html --b 'bower_components' --verbose From 6ff72df1cec69f665ba5a81b477efbb65be82f7b Mon Sep 17 00:00:00 2001 From: Thomas Draebing Date: Fri, 27 Dec 2019 10:58:03 +0100 Subject: [PATCH 06/15] Downport "Update eslint version and eslint rules" Legacy indent rules doesn't handle all cases. As a result there are different indents in .js files. This commit update eslint rules and add autofix for incorrect indents. It is expected that fix should be run after converting to class-based elements. Change-Id: I844132280d3fcc6203777425316d8fb348e126c0 --- package.json | 5 +- polygerrit-ui/app/.eslintrc.json | 19 +++++-- .../docs-url-behavior/docs-url-behavior.html | 2 +- .../gr-list-view-behavior.html | 4 +- .../gr-patch-set-behavior.html | 4 +- .../keyboard-shortcut-behavior_test.html | 4 +- .../rest-client-behavior.html | 2 +- .../gr-access-section_test.html | 8 +-- .../gr-admin-group-list.js | 10 ++-- .../admin/gr-admin-view/gr-admin-view.js | 22 ++++---- .../gr-create-change-dialog.js | 28 +++++------ .../gr-group-members/gr-group-members.js | 50 +++++++++---------- .../gr-group-members_test.html | 4 +- .../app/elements/admin/gr-group/gr-group.js | 12 ++--- .../admin/gr-permission/gr-permission.js | 2 +- .../admin/gr-plugin-list/gr-plugin-list.js | 10 ++-- .../admin/gr-repo-access/gr-repo-access.js | 10 ++-- .../gr-repo-access/gr-repo-access_test.html | 4 +- .../gr-repo-commands/gr-repo-commands.js | 18 +++---- .../gr-repo-dashboards/gr-repo-dashboards.js | 2 +- .../gr-repo-detail-list.js | 20 ++++---- .../gr-repo-detail-list_test.html | 4 +- .../app/elements/admin/gr-repo/gr-repo.js | 6 +-- .../gr-rule-editor/gr-rule-editor_test.html | 4 +- .../gr-change-list-item_test.html | 24 ++++----- .../gr-change-list/gr-change-list.js | 2 +- .../gr-change-list/gr-change-list_test.html | 2 +- .../gr-dashboard-view/gr-dashboard-view.js | 42 ++++++++-------- .../gr-user-header/gr-user-header.js | 2 +- .../gr-account-entry/gr-account-entry.js | 4 +- .../gr-account-entry_test.html | 6 +-- .../change/gr-account-list/gr-account-list.js | 2 +- .../gr-change-actions/gr-change-actions.js | 6 +-- .../gr-change-actions_test.html | 2 +- .../gr-change-metadata-it_test.html | 4 +- .../gr-change-metadata/gr-change-metadata.js | 14 +++--- .../gr-change-metadata_test.html | 2 +- .../gr-change-requirements.js | 4 +- .../change/gr-change-view/gr-change-view.js | 32 ++++++------ .../gr-change-view/gr-change-view_test.html | 10 ++-- .../change/gr-comment-list/gr-comment-list.js | 2 +- .../gr-confirm-cherrypick-dialog.js | 28 +++++------ .../gr-confirm-move-dialog.js | 28 +++++------ .../gr-confirm-rebase-dialog.js | 2 +- .../gr-download-dialog/gr-download-dialog.js | 2 +- .../gr-download-dialog_test.html | 2 +- .../gr-file-list-header.js | 4 +- .../change/gr-file-list/gr-file-list.js | 16 +++--- .../gr-file-list/gr-file-list_test.html | 10 ++-- .../gr-label-score-row/gr-label-score-row.js | 6 +-- .../gr-label-scores/gr-label-scores_test.html | 8 +-- .../gr-messages-list/gr-messages-list.js | 4 +- .../gr-related-changes-list.js | 2 +- .../gr-related-changes-list_test.html | 2 +- .../change/gr-reply-dialog/gr-reply-dialog.js | 22 ++++---- .../gr-reply-dialog/gr-reply-dialog_test.html | 6 +-- .../gr-reviewer-list_test.html | 10 ++-- .../change/gr-thread-list/gr-thread-list.js | 4 +- .../gr-main-header/gr-main-header_test.html | 2 +- .../core/gr-navigation/gr-navigation.html | 10 ++-- .../core/gr-reporting/gr-reporting.js | 2 +- .../core/gr-reporting/gr-reporting_test.html | 4 +- .../app/elements/core/gr-router/gr-router.js | 4 +- .../gr-search-bar/gr-search-bar_test.html | 4 +- .../core/gr-smart-search/gr-smart-search.js | 4 +- .../diff/gr-comment-api/gr-comment-api.js | 8 +-- .../gr-comment-api/gr-comment-api_test.html | 2 +- .../gr-diff-builder-unified.js | 2 +- .../diff/gr-diff-builder/gr-diff-builder.html | 12 ++--- .../diff/gr-diff-builder/gr-diff-builder.js | 4 +- .../gr-diff-builder/gr-diff-builder_test.html | 10 ++-- .../gr-diff-comment-thread.js | 2 +- .../gr-diff-comment-thread_test.html | 2 +- .../diff/gr-diff-comment/gr-diff-comment.js | 16 +++--- .../diff/gr-diff-cursor/gr-diff-cursor.js | 10 ++-- .../gr-diff-highlight/gr-annotation_test.html | 2 +- .../gr-diff-highlight_test.html | 8 +-- .../diff/gr-diff-host/gr-diff-host.js | 2 +- .../diff/gr-diff-host/gr-diff-host_test.html | 2 +- .../gr-diff-selection/gr-diff-selection.js | 4 +- .../diff/gr-diff-view/gr-diff-view.js | 14 +++--- .../diff/gr-diff-view/gr-diff-view_test.html | 12 ++--- .../app/elements/diff/gr-diff/gr-diff.js | 10 ++-- .../elements/diff/gr-diff/gr-diff_test.html | 2 +- .../gr-patch-range-select.js | 4 +- .../gr-patch-range-select_test.html | 4 +- .../gr-ranged-comment-layer.js | 8 +-- .../diff/gr-syntax-layer/gr-syntax-layer.js | 4 +- .../edit/gr-edit-controls/gr-edit-controls.js | 12 ++--- .../edit/gr-editor-view/gr-editor-view.js | 20 ++++---- .../gr-editor-view/gr-editor-view_test.html | 2 +- .../gr-change-metadata-api.js | 2 +- .../gr-endpoint-decorator.js | 10 ++-- .../plugins/gr-plugin-host/gr-plugin-host.js | 4 +- .../gr-popup-interface/gr-popup-interface.js | 22 ++++---- .../gr-account-info/gr-account-info.js | 12 ++--- .../gr-account-info/gr-account-info_test.html | 4 +- .../settings/gr-cla-view/gr-cla-view.js | 2 +- .../settings/gr-gpg-editor/gr-gpg-editor.js | 10 ++-- .../gr-account-label_test.html | 6 +-- .../shared/gr-avatar/gr-avatar_test.html | 12 ++--- .../gr-cursor-manager/gr-cursor-manager.js | 6 +-- .../gr-date-formatter/gr-date-formatter.js | 4 +- .../gr-date-formatter_test.html | 8 +-- .../gr-diff-preferences_test.html | 2 +- .../gr-dropdown-list/gr-dropdown-list.js | 2 +- .../shared/gr-dropdown/gr-dropdown.js | 2 +- .../gr-editable-content.js | 4 +- .../gr-event-interface_test.html | 8 +-- .../shared/gr-hovercard/gr-hovercard.js | 6 +-- .../gr-annotation-actions-js-api.js | 2 +- .../gr-js-api-interface.js | 4 +- .../gr-plugin-endpoints.js | 2 +- .../gr-js-api-interface/gr-public-js-api.js | 10 ++-- .../shared/gr-label-info/gr-label-info.js | 16 +++--- .../shared/gr-page-nav/gr-page-nav.js | 4 +- .../shared/gr-rest-api-interface/gr-auth.js | 2 +- .../gr-rest-api-interface/gr-auth_test.html | 4 +- .../gr-rest-api-interface.js | 36 ++++++------- .../gr-reviewer-updates-parser.js | 4 +- .../elements/shared/gr-storage/gr-storage.js | 4 +- .../shared/gr-textarea/gr-textarea_test.html | 6 +-- .../shared/revision-info/revision-info.html | 2 +- .../app/samples/coverage-plugin.html | 10 ++-- 124 files changed, 513 insertions(+), 497 deletions(-) diff --git a/package.json b/package.json index 6b9a38d981..8fb3d3d8cc 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,9 @@ "description": "Gerrit Code Review", "dependencies": {}, "devDependencies": { - "eslint": "^5.16.0", + "eslint": "^6.6.0", "eslint-config-google": "^0.13.0", - "eslint-plugin-html": "^5.0.5", + "eslint-plugin-html": "^6.0.0", "fried-twinkie": "^0.2.2", "polylint": "^2.10.4", "typescript": "^2.x.x", @@ -16,6 +16,7 @@ "start": "polygerrit-ui/run-server.sh", "test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh", "eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0", + "eslintfix": "./node_modules/eslint/bin/eslint.js --fix --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0", "test-template": "./polygerrit-ui/app/run_template_test.sh", "polylint": "bazel test polygerrit-ui/app:polylint_test" }, diff --git a/polygerrit-ui/app/.eslintrc.json b/polygerrit-ui/app/.eslintrc.json index 0bd8bf7021..17b7c5fca2 100644 --- a/polygerrit-ui/app/.eslintrc.json +++ b/polygerrit-ui/app/.eslintrc.json @@ -33,8 +33,7 @@ "functions": "never" }], "eol-last": "off", - "indent": "off", - "indent-legacy": ["error", 2, { + "indent": ["error", 2, { "MemberExpression": 2, "FunctionDeclaration": {"body": 1, "parameters": 2}, "FunctionExpression": {"body": 1, "parameters": 2}, @@ -44,13 +43,14 @@ "SwitchCase": 1 }], "keyword-spacing": ["error", { "after": true, "before": true }], + "lines-between-class-members": ["error", "always"], "max-len": [ "error", 80, 2, {"ignoreComments": true} ], - "new-cap": ["error", { "capIsNewExceptions": ["Polymer"] }], + "new-cap": ["error", { "capIsNewExceptions": ["Polymer", "LegacyElementMixin", "GestureEventListeners", "LegacyDataMixin"] }], "no-console": "off", "no-restricted-syntax": [ "error", @@ -70,6 +70,19 @@ "no-redeclare": "off", "operator-linebreak": "off", "object-shorthand": ["error", "always"], + "padding-line-between-statements": [ + "error", + { + "blankLine": "always", + "prev": "class", + "next": "*" + }, + { + "blankLine": "always", + "prev": "*", + "next": "class" + } + ], "prefer-arrow-callback": "error", "prefer-const": "error", "prefer-promise-reject-errors": "off", diff --git a/polygerrit-ui/app/behaviors/docs-url-behavior/docs-url-behavior.html b/polygerrit-ui/app/behaviors/docs-url-behavior/docs-url-behavior.html index 64b725fdad..4e2553050f 100644 --- a/polygerrit-ui/app/behaviors/docs-url-behavior/docs-url-behavior.html +++ b/polygerrit-ui/app/behaviors/docs-url-behavior/docs-url-behavior.html @@ -56,7 +56,7 @@ limitations under the License. cachedPromise = undefined; }, }, - Gerrit.BaseUrlBehavior, + Gerrit.BaseUrlBehavior, ]; })(window); diff --git a/polygerrit-ui/app/behaviors/gr-list-view-behavior/gr-list-view-behavior.html b/polygerrit-ui/app/behaviors/gr-list-view-behavior/gr-list-view-behavior.html index f251db8c38..b6edb57b33 100644 --- a/polygerrit-ui/app/behaviors/gr-list-view-behavior/gr-list-view-behavior.html +++ b/polygerrit-ui/app/behaviors/gr-list-view-behavior/gr-list-view-behavior.html @@ -56,8 +56,8 @@ limitations under the License. return 0; }, }, - Gerrit.BaseUrlBehavior, - Gerrit.URLEncodingBehavior, + Gerrit.BaseUrlBehavior, + Gerrit.URLEncodingBehavior, ]; })(window); diff --git a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html index 48b575bc52..b819ad6106 100644 --- a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html +++ b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html @@ -124,8 +124,8 @@ limitations under the License. // 2 -> 3, 3 -> 5, etc. // Map an edit to the patchNum of parent*2... I.e. edit on 2 -> 4. const num = r => r._number === Gerrit.PatchSetBehavior.EDIT_NAME ? - 2 * editParent : - 2 * (r._number - 1) + 1; + 2 * editParent : + 2 * (r._number - 1) + 1; return revisions.sort((a, b) => num(b) - num(a)); }, diff --git a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior_test.html b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior_test.html index dac90f8606..15d31b7659 100644 --- a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior_test.html +++ b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior_test.html @@ -238,8 +238,8 @@ limitations under the License. test('directory view', () => { const { - NEXT_FILE, NEXT_LINE, GO_TO_OPENED_CHANGES, SEARCH, - SAVE_COMMENT, + NEXT_FILE, NEXT_LINE, GO_TO_OPENED_CHANGES, SEARCH, + SAVE_COMMENT, } = kb.Shortcut; const {DIFFS, EVERYWHERE, NAVIGATION} = kb.ShortcutSection; const {GO_KEY, ShortcutManager} = kb; diff --git a/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html b/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html index 2cb00f4a54..354bedc2a7 100644 --- a/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html +++ b/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html @@ -169,7 +169,7 @@ limitations under the License. return this.changeStatuses(change).join(', '); }, }, - Gerrit.BaseUrlBehavior, + Gerrit.BaseUrlBehavior, ]; })(window); diff --git a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html index 21a426f2bf..56f321b5c7 100644 --- a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html +++ b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html @@ -206,7 +206,7 @@ limitations under the License. }; assert.equal(element._computePermissionName(name, permission, element.permissionValues, element.capabilities), - element.capabilities[permission.id].name); + element.capabilities[permission.id].name); name = 'refs/for/*'; permission = { @@ -216,7 +216,7 @@ limitations under the License. assert.equal(element._computePermissionName( name, permission, element.permissionValues, element.capabilities), - element.permissionValues[permission.id].name); + element.permissionValues[permission.id].name); name = 'refs/for/*'; permission = { @@ -228,7 +228,7 @@ limitations under the License. assert.equal(element._computePermissionName(name, permission, element.permissionValues, element.capabilities), - 'Label Code-Review'); + 'Label Code-Review'); permission = { id: 'labelAs-Code-Review', @@ -239,7 +239,7 @@ limitations under the License. assert.equal(element._computePermissionName(name, permission, element.permissionValues, element.capabilities), - 'Label Code-Review(On Behalf Of)'); + 'Label Code-Review(On Behalf Of)'); }); test('_computeSectionName', () => { diff --git a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js index 1f5457af61..f1e1d54404 100644 --- a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js +++ b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js @@ -119,11 +119,11 @@ return; } this._groups = Object.keys(groups) - .map(key => { - const group = groups[key]; - group.name = key; - return group; - }); + .map(key => { + const group = groups[key]; + group.name = key; + return group; + }); this._loading = false; }); }, diff --git a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js index 3d430c2687..fc04c34536 100644 --- a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js +++ b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js @@ -105,23 +105,23 @@ .then(res => { this._filteredLinks = res.links; this._breadcrumbParentName = res.expandedSection ? - res.expandedSection.name : ''; + res.expandedSection.name : ''; if (!res.expandedSection) { this._subsectionLinks = []; return; } this._subsectionLinks = [res.expandedSection] - .concat(res.expandedSection.children).map(section => { - return { - text: !section.detailType ? 'Home' : section.name, - value: section.view + (section.detailType || ''), - view: section.view, - url: section.url, - detailType: section.detailType, - parent: this._groupId || this._repoName || '', - }; - }); + .concat(res.expandedSection.children).map(section => { + return { + text: !section.detailType ? 'Home' : section.name, + value: section.view + (section.detailType || ''), + view: section.view, + url: section.url, + detailType: section.detailType, + parent: this._groupId || this._repoName || '', + }; + }); }); }); }, diff --git a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js index 8e15755e6b..c6687ddbcd 100644 --- a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js +++ b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js @@ -102,21 +102,21 @@ } return this.$.restAPI.getRepoBranches( input, this.repoName, SUGGESTIONS_LIMIT).then(response => { - const branches = []; - let branch; - for (const key in response) { - if (!response.hasOwnProperty(key)) { continue; } - if (response[key].ref.startsWith('refs/heads/')) { - branch = response[key].ref.substring('refs/heads/'.length); - } else { - branch = response[key].ref; - } - branches.push({ - name: branch, - }); - } - return branches; + const branches = []; + let branch; + for (const key in response) { + if (!response.hasOwnProperty(key)) { continue; } + if (response[key].ref.startsWith('refs/heads/')) { + branch = response[key].ref.substring('refs/heads/'.length); + } else { + branch = response[key].ref; + } + branches.push({ + name: branch, }); + } + return branches; + }); }, _formatBooleanString(config) { diff --git a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members.js b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members.js index 2e36a385c5..b7917bebcb 100644 --- a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members.js +++ b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members.js @@ -140,15 +140,15 @@ _handleSavingGroupMember() { return this.$.restAPI.saveGroupMembers(this._groupName, this._groupMemberSearchId).then(config => { - if (!config) { - return; - } - this.$.restAPI.getGroupMembers(this._groupName).then(members => { - this._groupMembers = members; - }); - this._groupMemberSearchName = ''; - this._groupMemberSearchId = ''; - }); + if (!config) { + return; + } + this.$.restAPI.getGroupMembers(this._groupName).then(members => { + this._groupMembers = members; + }); + this._groupMemberSearchName = ''; + this._groupMemberSearchId = ''; + }); }, _handleDeleteConfirm() { @@ -237,24 +237,24 @@ if (input.length === 0) { return Promise.resolve([]); } return this.$.restAPI.getSuggestedAccounts( input, SUGGESTIONS_LIMIT).then(accounts => { - const accountSuggestions = []; - let nameAndEmail; - if (!accounts) { return []; } - for (const key in accounts) { - if (!accounts.hasOwnProperty(key)) { continue; } - if (accounts[key].email !== undefined) { - nameAndEmail = accounts[key].name + + const accountSuggestions = []; + let nameAndEmail; + if (!accounts) { return []; } + for (const key in accounts) { + if (!accounts.hasOwnProperty(key)) { continue; } + if (accounts[key].email !== undefined) { + nameAndEmail = accounts[key].name + ' <' + accounts[key].email + '>'; - } else { - nameAndEmail = accounts[key].name; - } - accountSuggestions.push({ - name: nameAndEmail, - value: accounts[key]._account_id, - }); - } - return accountSuggestions; + } else { + nameAndEmail = accounts[key].name; + } + accountSuggestions.push({ + name: nameAndEmail, + value: accounts[key]._account_id, }); + } + return accountSuggestions; + }); }, _getGroupSuggestions(input) { diff --git a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.html b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.html index 81123e7014..ef22daf8d1 100644 --- a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.html +++ b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.html @@ -167,10 +167,10 @@ limitations under the License. .querySelectorAll('.nameColumn a')[0].href, includedGroups[0].url); assert.equal(Polymer.dom(element.root) .querySelectorAll('.nameColumn a')[1].href, - 'https://test/site/group/url'); + 'https://test/site/group/url'); assert.equal(Polymer.dom(element.root) .querySelectorAll('.nameColumn a')[2].href, - 'https://test/site/group/url'); + 'https://test/site/group/url'); }); test('save members correctly', () => { diff --git a/polygerrit-ui/app/elements/admin/gr-group/gr-group.js b/polygerrit-ui/app/elements/admin/gr-group/gr-group.js index e2ecfbac35..de16a7c4cf 100644 --- a/polygerrit-ui/app/elements/admin/gr-group/gr-group.js +++ b/polygerrit-ui/app/elements/admin/gr-group/gr-group.js @@ -168,15 +168,15 @@ } return this.$.restAPI.saveGroupOwner(this.groupId, owner).then(config => { - this._owner = false; - }); + this._owner = false; + }); }, _handleSaveDescription() { return this.$.restAPI.saveGroupDescription(this.groupId, this._groupConfig.description).then(config => { - this._description = false; - }); + this._description = false; + }); }, _handleSaveOptions() { @@ -186,8 +186,8 @@ return this.$.restAPI.saveGroupOptions(this.groupId, options).then(config => { - this._options = false; - }); + this._options = false; + }); }, _handleConfigName() { diff --git a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js index 460a9d9cd9..fc65fd8f81 100644 --- a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js +++ b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js @@ -220,7 +220,7 @@ _computeGroupName(groups, groupId) { return groups && groups[groupId] && groups[groupId].name ? - groups[groupId].name : groupId; + groups[groupId].name : groupId; }, _getGroupSuggestions() { diff --git a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.js b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.js index 6cbc94a6ca..7fd3e05ea0 100644 --- a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.js +++ b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.js @@ -91,11 +91,11 @@ return; } this._plugins = Object.keys(plugins) - .map(key => { - const plugin = plugins[key]; - plugin.name = key; - return plugin; - }); + .map(key => { + const plugin = plugins[key]; + plugin.name = key; + return plugin; + }); this._loading = false; }); }, diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js index 5bc700b145..e9b13cdcb3 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js +++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js @@ -166,7 +166,7 @@ // current value appears. If there is no parent repo, it is // initialized as an empty string. this._inheritFromFilter = res.inherits_from ? - this._inheritsFrom.name : ''; + this._inheritsFrom.name : ''; this._local = res.local; this._groups = res.groups; this._weblinks = res.config_web_links || []; @@ -369,11 +369,11 @@ }; const originalInheritsFromId = this._originalInheritsFrom ? - this.singleDecodeURL(this._originalInheritsFrom.id) : - null; + this.singleDecodeURL(this._originalInheritsFrom.id) : + null; const inheritsFromId = this._inheritsFrom ? - this.singleDecodeURL(this._inheritsFrom.id) : - null; + this.singleDecodeURL(this._inheritsFrom.id) : + null; const inheritFromChanged = // Inherit from changed diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.html b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.html index 6fa36a54ca..a33b4bee2e 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.html +++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.html @@ -674,7 +674,7 @@ limitations under the License. Polymer.dom(element.$$('gr-access-section').root).querySelectorAll( 'gr-permission')[2]; newPermission._handleAddRuleItem( - {detail: {value: {id: 'Maintainers'}}}); + {detail: {value: {id: 'Maintainers'}}}); assert.deepEqual(element._computeAddAndRemove(), expectedInput); // Modify a section reference. @@ -907,7 +907,7 @@ limitations under the License. Polymer.dom(element.$$('gr-access-section').root).querySelectorAll( 'gr-permission')[1]; readPermission._handleAddRuleItem( - {detail: {value: {id: 'Maintainers'}}}); + {detail: {value: {id: 'Maintainers'}}}); expectedInput = { add: { diff --git a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js index a25055ed2a..17d89a840a 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js +++ b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js @@ -96,16 +96,16 @@ _handleEditRepoConfig() { return this.$.restAPI.createChange(this.repo, CONFIG_BRANCH, EDIT_CONFIG_SUBJECT, undefined, false, true).then(change => { - const message = change ? - CREATE_CHANGE_SUCCEEDED_MESSAGE : - CREATE_CHANGE_FAILED_MESSAGE; - this.dispatchEvent(new CustomEvent('show-alert', - {detail: {message}, bubbles: true})); - if (!change) { return; } + const message = change ? + CREATE_CHANGE_SUCCEEDED_MESSAGE : + CREATE_CHANGE_FAILED_MESSAGE; + this.dispatchEvent(new CustomEvent('show-alert', + {detail: {message}, bubbles: true})); + if (!change) { return; } - Gerrit.Nav.navigateToRelativeUrl(Gerrit.Nav.getEditUrlForDiff( - change, CONFIG_PATH, INITIAL_PATCHSET)); - }); + Gerrit.Nav.navigateToRelativeUrl(Gerrit.Nav.getEditUrlForDiff( + change, CONFIG_PATH, INITIAL_PATCHSET)); + }); }, }); })(); diff --git a/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.js b/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.js index 7dea7f4392..a620ba1df6 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.js +++ b/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.js @@ -45,7 +45,7 @@ // Group by ref and sort by id. const dashboards = res.concat.apply([], res).sort((a, b) => - a.id < b.id ? -1 : 1); + a.id < b.id ? -1 : 1); const dashboardsByRef = {}; dashboards.forEach(d => { if (!dashboardsByRef[d.ref]) { diff --git a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.js b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.js index 8c7973d5a5..c576d7e1d8 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.js +++ b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.js @@ -90,7 +90,7 @@ _determineIfOwner(repo) { return this.$.restAPI.getRepoAccess(repo) .then(access => - this._isOwner = access && !!access[repo].is_owner); + this._isOwner = access && !!access[repo].is_owner); }, _paramsChanged(params) { @@ -124,17 +124,17 @@ if (detailType === DETAIL_TYPES.BRANCHES) { return this.$.restAPI.getRepoBranches( filter, repo, itemsPerPage, offset, errFn).then(items => { - if (!items) { return; } - this._items = items; - this._loading = false; - }); + if (!items) { return; } + this._items = items; + this._loading = false; + }); } else if (detailType === DETAIL_TYPES.TAGS) { return this.$.restAPI.getRepoTags( filter, repo, itemsPerPage, offset, errFn).then(items => { - if (!items) { return; } - this._items = items; - this._loading = false; - }); + if (!items) { return; } + this._items = items; + this._loading = false; + }); } }, @@ -173,7 +173,7 @@ _computeCanEditClass(ref, detailType, isOwner) { return isOwner && this._stripRefs(ref, detailType) === 'HEAD' ? - 'canEdit' : ''; + 'canEdit' : ''; }, _handleEditRevision(e) { diff --git a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.html b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.html index 5d2a9ad0c4..427a78ab5a 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.html +++ b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.html @@ -153,9 +153,9 @@ limitations under the License. const cancelBtn = Polymer.dom(element.root).querySelector('.cancelBtn'); const editBtn = Polymer.dom(element.root).querySelector('.editBtn'); const revisionNoEditing = Polymer.dom(element.root) - .querySelector('.revisionNoEditing'); + .querySelector('.revisionNoEditing'); const revisionWithEditing = Polymer.dom(element.root) - .querySelector('.revisionWithEditing'); + .querySelector('.revisionWithEditing'); sandbox.stub(element, '_getLoggedIn').returns(Promise.resolve(true)); sandbox.stub(element.$.restAPI, 'getRepoAccess').returns( diff --git a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.js b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.js index d79bf0d124..91a0ffbbca 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.js +++ b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.js @@ -268,8 +268,8 @@ _handleSaveRepoConfig() { return this.$.restAPI.saveRepoConfig(this.repo, this._formatRepoConfigForSave(this._repoConfig)).then(() => { - this._configChanged = false; - }); + this._configChanged = false; + }); }, _handleConfigChanged() { @@ -309,7 +309,7 @@ command: commandObj[title] .replace(/\$\{project\}/gi, encodeURI(repo)) .replace(/\$\{project-base-name\}/gi, - encodeURI(repo.substring(repo.lastIndexOf('/') + 1))), + encodeURI(repo.substring(repo.lastIndexOf('/') + 1))), }); } return commands; diff --git a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.html b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.html index f85c2b228c..7f5bf6abab 100644 --- a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.html +++ b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.html @@ -123,7 +123,7 @@ limitations under the License. let permission = 'priority'; let label; assert.deepEqual(element._getDefaultRuleValues(permission, label), - {action: 'BATCH'}); + {action: 'BATCH'}); permission = 'label-Code-Review'; label = {values: [ {value: -2, text: 'This shall not be merged'}, @@ -137,7 +137,7 @@ limitations under the License. permission = 'push'; label = undefined; assert.deepEqual(element._getDefaultRuleValues(permission, label), - {action: 'ALLOW', force: false}); + {action: 'ALLOW', force: false}); permission = 'submit'; assert.deepEqual(element._getDefaultRuleValues(permission, label), {action: 'ALLOW'}); diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html index 3637653d53..35f81bcd47 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html @@ -57,31 +57,31 @@ limitations under the License. {labels: {}}, 'Verified'), 'cell label u-gray-background'); assert.equal(element._computeLabelClass( {labels: {Verified: {approved: true, value: 1}}}, 'Verified'), - 'cell label u-green u-monospace'); + 'cell label u-green u-monospace'); assert.equal(element._computeLabelClass( {labels: {Verified: {rejected: true, value: -1}}}, 'Verified'), - 'cell label u-monospace u-red'); + 'cell label u-monospace u-red'); assert.equal(element._computeLabelClass( {labels: {'Code-Review': {value: 1}}}, 'Code-Review'), - 'cell label u-green u-monospace'); + 'cell label u-green u-monospace'); assert.equal(element._computeLabelClass( {labels: {'Code-Review': {value: -1}}}, 'Code-Review'), - 'cell label u-monospace u-red'); + 'cell label u-monospace u-red'); assert.equal(element._computeLabelClass( {labels: {'Code-Review': {value: -1}}}, 'Verified'), - 'cell label u-gray-background'); + 'cell label u-gray-background'); assert.equal(element._computeLabelTitle({labels: {}}, 'Verified'), 'Label not applicable'); assert.equal(element._computeLabelTitle( {labels: {Verified: {approved: {name: 'Diffy'}}}}, 'Verified'), - 'Verified\nby Diffy'); + 'Verified\nby Diffy'); assert.equal(element._computeLabelTitle( {labels: {Verified: {approved: {name: 'Diffy'}}}}, 'Code-Review'), - 'Label not applicable'); + 'Label not applicable'); assert.equal(element._computeLabelTitle( {labels: {Verified: {rejected: {name: 'Diffy'}}}}, 'Verified'), - 'Verified\nby Diffy'); + 'Verified\nby Diffy'); assert.equal(element._computeLabelTitle( {labels: {'Code-Review': {disliked: {name: 'Diffy'}, value: -1}}}, 'Code-Review'), 'Code-Review\nby Diffy'); @@ -91,19 +91,19 @@ limitations under the License. assert.equal(element._computeLabelTitle( {labels: {'Code-Review': {recommended: {name: 'Diffy'}, rejected: {name: 'Admin'}}}}, 'Code-Review'), - 'Code-Review\nby Admin'); + 'Code-Review\nby Admin'); assert.equal(element._computeLabelTitle( {labels: {'Code-Review': {approved: {name: 'Diffy'}, rejected: {name: 'Admin'}}}}, 'Code-Review'), - 'Code-Review\nby Admin'); + 'Code-Review\nby Admin'); assert.equal(element._computeLabelTitle( {labels: {'Code-Review': {recommended: {name: 'Diffy'}, disliked: {name: 'Admin'}, value: -1}}}, 'Code-Review'), - 'Code-Review\nby Admin'); + 'Code-Review\nby Admin'); assert.equal(element._computeLabelTitle( {labels: {'Code-Review': {approved: {name: 'Diffy'}, disliked: {name: 'Admin'}, value: -1}}}, 'Code-Review'), - 'Code-Review\nby Diffy'); + 'Code-Review\nby Diffy'); assert.equal(element._computeLabelValue({labels: {}}), ''); assert.equal(element._computeLabelValue({labels: {}}, 'Verified'), ''); diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.js b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.js index 61c64ffe26..e57a389ba2 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.js +++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.js @@ -153,7 +153,7 @@ this.showNumber = !!(preferences && preferences.legacycid_in_change_table); this.visibleChangeTableColumns = preferences.change_table.length > 0 ? - this.getVisibleColumns(preferences.change_table) : this.columnNames; + this.getVisibleColumns(preferences.change_table) : this.columnNames; } else { // Not logged in. this.showNumber = false; diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.html b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.html index d5b9aa96b3..99741a88db 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.html +++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.html @@ -111,7 +111,7 @@ limitations under the License. test('computed fields', () => { assert.equal(element._computeLabelNames( - [{results: [{_number: 0, labels: {}}]}]).length, 0); + [{results: [{_number: 0, labels: {}}]}]).length, 0); assert.equal(element._computeLabelNames([ {results: [ {_number: 0, labels: {Verified: {approved: {}}}}, diff --git a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.js b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.js index 4ac6f5ec68..43fe0c2a94 100644 --- a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.js +++ b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.js @@ -108,21 +108,21 @@ }; return this.$.restAPI.getDashboard( project, dashboard, errFn).then(response => { - if (!response) { - return; - } + if (!response) { + return; + } + return { + title: response.title, + sections: response.sections.map(section => { + const suffix = response.foreach ? ' ' + response.foreach : ''; return { - title: response.title, - sections: response.sections.map(section => { - const suffix = response.foreach ? ' ' + response.foreach : ''; - return { - name: section.name, - query: (section.query + suffix).replace( - PROJECT_PLACEHOLDER_PATTERN, project), - }; - }), + name: section.name, + query: (section.query + suffix).replace( + PROJECT_PLACEHOLDER_PATTERN, project), }; - }); + }), + }; + }); }, _computeTitle(user) { @@ -161,11 +161,11 @@ this._loading = true; const {project, dashboard, title, user, sections} = this.params; const dashboardPromise = project ? - this._getProjectDashboard(project, dashboard) : - Promise.resolve(Gerrit.Nav.getUserDashboard( - user, - sections, - title || this._computeTitle(user))); + this._getProjectDashboard(project, dashboard) : + Promise.resolve(Gerrit.Nav.getUserDashboard( + user, + sections, + title || this._computeTitle(user))); const checkForNewUser = !project && user === 'self'; return dashboardPromise @@ -191,8 +191,8 @@ const queries = res.sections .map(section => section.suffixForDashboard ? - section.query + ' ' + section.suffixForDashboard : - section.query); + section.query + ' ' + section.suffixForDashboard : + section.query); if (checkForNewUser) { queries.push('owner:self'); @@ -211,7 +211,7 @@ results, isOutgoing: res.sections[i].isOutgoing, })).filter((section, i) => i < res.sections.length && ( - !res.sections[i].hideIfEmpty || + !res.sections[i].hideIfEmpty || section.results.length)); }); }, diff --git a/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header.js b/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header.js index cf5fefdcba..d3d54f56d8 100644 --- a/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header.js +++ b/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header.js @@ -85,7 +85,7 @@ _computeDashboardLinkClass(showDashboardLink, loggedIn) { return showDashboardLink && loggedIn ? - 'dashboardLink' : 'dashboardLink hide'; + 'dashboardLink' : 'dashboardLink hide'; }, }); })(); diff --git a/polygerrit-ui/app/elements/change/gr-account-entry/gr-account-entry.js b/polygerrit-ui/app/elements/change/gr-account-entry/gr-account-entry.js index 715ddc05ea..88b2858a3d 100644 --- a/polygerrit-ui/app/elements/change/gr-account-entry/gr-account-entry.js +++ b/polygerrit-ui/app/elements/change/gr-account-entry/gr-account-entry.js @@ -159,8 +159,8 @@ const api = this.$.restAPI; const xhr = this.allowAnyUser ? - api.getSuggestedAccounts(`cansee:${this.change._number} ${input}`) : - api.getChangeSuggestedReviewers(this.change._number, input); + api.getSuggestedAccounts(`cansee:${this.change._number} ${input}`) : + api.getChangeSuggestedReviewers(this.change._number, input); return xhr.then(reviewers => { if (!reviewers) { return []; } diff --git a/polygerrit-ui/app/elements/change/gr-account-entry/gr-account-entry_test.html b/polygerrit-ui/app/elements/change/gr-account-entry/gr-account-entry_test.html index 20d127d030..724f7dac0b 100644 --- a/polygerrit-ui/app/elements/change/gr-account-entry/gr-account-entry_test.html +++ b/polygerrit-ui/app/elements/change/gr-account-entry/gr-account-entry_test.html @@ -217,10 +217,10 @@ limitations under the License. test('allowAnyUser', done => { const suggestReviewerStub = sandbox.stub(element.$.restAPI, 'getChangeSuggestedReviewers') - .returns(Promise.resolve([])); + .returns(Promise.resolve([])); const suggestAccountStub = sandbox.stub(element.$.restAPI, 'getSuggestedAccounts') - .returns(Promise.resolve([])); + .returns(Promise.resolve([])); element._getReviewerSuggestions('').then(() => { assert.isTrue(suggestReviewerStub.calledOnce); @@ -252,7 +252,7 @@ limitations under the License. test('account-text-changed not fired when input text changed without ' + 'allowAnyUser', () => { - // Spy on query, as that is called when _updateSuggestions proceeds. + // Spy on query, as that is called when _updateSuggestions proceeds. const changeStub = sandbox.stub(); sandbox.stub(element.$.restAPI, 'getChangeSuggestedReviewers') .returns(Promise.resolve([])); diff --git a/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js b/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js index 950c1e8bb6..b568437505 100644 --- a/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js +++ b/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js @@ -121,7 +121,7 @@ // a toast tell them why they can't enter it. this.$.entry.setText(reviewer); this.dispatchEvent(new CustomEvent('show-alert', - {detail: {message: VALID_EMAIL_ALERT}, bubbles: true})); + {detail: {message: VALID_EMAIL_ALERT}, bubbles: true})); return false; } else { const account = {email: reviewer, _pendingAdd: true}; diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js index 3e5c4f760c..af811f5248 100644 --- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js +++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js @@ -568,7 +568,7 @@ } }, - /** + /** * @param {string=} actionName */ _deleteAndNotify(actionName) { @@ -1370,9 +1370,9 @@ _filterPrimaryActions(_topLevelActions) { this._topLevelPrimaryActions = _topLevelActions.filter(action => - action.__primary); + action.__primary); this._topLevelSecondaryActions = _topLevelActions.filter(action => - !action.__primary); + !action.__primary); }, _computeMenuActions(actionRecord, hiddenActionsRecord) { diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.html b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.html index 81fe54ef65..670de5da68 100644 --- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.html +++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.html @@ -373,7 +373,7 @@ limitations under the License. assert.isTrue(fetchChangesStub.called); element._handleRebaseConfirm({detail: {base: '1234'}}); assert.deepEqual(fireActionStub.lastCall.args, - ['/rebase', rebaseAction, true, {base: '1234'}]); + ['/rebase', rebaseAction, true, {base: '1234'}]); done(); }); }); diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata-it_test.html b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata-it_test.html index 5b36221b86..d62aaeeccb 100644 --- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata-it_test.html +++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata-it_test.html @@ -114,7 +114,7 @@ limitations under the License. js_resource_paths: [], html_resource_paths: [ new URL('test/plugin.html?' + Math.random(), - window.location.href).toString(), + window.location.href).toString(), ], }, }; @@ -140,7 +140,7 @@ limitations under the License. setup(() => { Gerrit.install(p => plugin = p, '0.1', new URL('test/plugin.html?' + Math.random(), - window.location.href).toString()); + window.location.href).toString()); sandbox.stub(Gerrit, '_arePluginsLoaded').returns(true); Gerrit._setPluginsPending([]); element = createElement(); diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js index f2d49d690b..dfc4ecf00d 100644 --- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js +++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js @@ -243,12 +243,12 @@ this._newHashtag = ''; this.$.restAPI.setChangeHashtag( this.change._number, {add: [newHashtag]}).then(newHashtag => { - this.set(['change', 'hashtags'], newHashtag); - if (newHashtag !== lastHashtag) { - this.dispatchEvent( - new CustomEvent('hashtag-changed', {bubbles: true})); - } - }); + this.set(['change', 'hashtags'], newHashtag); + if (newHashtag !== lastHashtag) { + this.dispatchEvent( + new CustomEvent('hashtag-changed', {bubbles: true})); + } + }); }, _computeTopicReadOnly(mutable, change) { @@ -359,7 +359,7 @@ _computeBranchURL(project, branch) { return Gerrit.Nav.getUrlForBranch(branch, project, this.change.status == this.ChangeStatus.NEW ? 'open' : - this.change.status.toLowerCase()); + this.change.status.toLowerCase()); }, _computeTopicURL(topic) { diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html index b23ac8d51e..fcbd3d5fb9 100644 --- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html +++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.html @@ -436,7 +436,7 @@ limitations under the License. {current_revision: '789', revisions: {456: {commit: {parents}}}})); assert.equal(element._computeParents( {current_revision: '456', revisions: {456: {commit: {parents}}}}), - parents); + parents); }); test('_computeParentsLabel', () => { diff --git a/polygerrit-ui/app/elements/change/gr-change-requirements/gr-change-requirements.js b/polygerrit-ui/app/elements/change/gr-change-requirements/gr-change-requirements.js index 8ec00dd710..dfdcd59ea5 100644 --- a/polygerrit-ui/app/elements/change/gr-change-requirements/gr-change-requirements.js +++ b/polygerrit-ui/app/elements/change/gr-change-requirements/gr-change-requirements.js @@ -135,8 +135,8 @@ _computeShowHideIcon(showOptionalLabels) { return showOptionalLabels ? - 'gr-icons:expand-less' : - 'gr-icons:expand-more'; + 'gr-icons:expand-less' : + 'gr-icons:expand-more'; }, _computeSectionClass(show) { diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js index bf3ac4ae45..aa2e135a4c 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js @@ -173,7 +173,7 @@ computed: '_computeChangeIdCommitMessageError(_latestCommitMessage, _change)', }, - /** @type {?} */ + /** @type {?} */ _patchRange: { type: Object, }, @@ -382,16 +382,16 @@ this.$.commitMessageEditor.disabled = true; this.$.restAPI.putChangeCommitMessage( this._changeNum, message).then(resp => { - this.$.commitMessageEditor.disabled = false; - if (!resp.ok) { return; } + this.$.commitMessageEditor.disabled = false; + if (!resp.ok) { return; } - this._latestCommitMessage = this._prepareCommitMsgForLinkify( - message); - this._editingCommitMessage = false; - this._reloadWindow(); - }).catch(err => { - this.$.commitMessageEditor.disabled = false; - }); + this._latestCommitMessage = this._prepareCommitMsgForLinkify( + message); + this._editingCommitMessage = false; + this._reloadWindow(); + }).catch(err => { + this.$.commitMessageEditor.disabled = false; + }); }, _reloadWindow() { @@ -720,7 +720,7 @@ _viewStateChanged(viewState) { this._numFilesShown = viewState.numFilesShown ? - viewState.numFilesShown : DEFAULT_NUM_FILES_SHOWN; + viewState.numFilesShown : DEFAULT_NUM_FILES_SHOWN; }, _numFilesShownChanged(numFilesShown) { @@ -827,7 +827,7 @@ // check that there is at least 2 parents otherwise fall back to 1, // which means there is only one parent. const parentCount = parentCounts.hasOwnProperty(1) ? - parentCounts[1] : 1; + parentCounts[1] : 1; const preferFirst = this._prefs && this._prefs.default_base_for_merges === 'FIRST_PARENT'; @@ -1216,9 +1216,9 @@ _getLatestCommitMessage() { return this.$.restAPI.getChangeCommitInfo(this._changeNum, this.computeLatestPatchNum(this._allPatchSets)).then(commitInfo => { - this._latestCommitMessage = + this._latestCommitMessage = this._prepareCommitMsgForLinkify(commitInfo.message); - }); + }); }, _getLatestRevisionSHA(change) { @@ -1264,7 +1264,7 @@ this._changeComments = comments; this._diffDrafts = Object.assign({}, this._changeComments.drafts); this._commentThreads = this._changeComments.getAllThreadsForChange() - .map(c => Object.assign({}, c)); + .map(c => Object.assign({}, c)); }); }, @@ -1673,7 +1673,7 @@ */ _handleEditTap() { const editInfo = Object.values(this._change.revisions).find(info => - info._number === this.EDIT_NAME); + info._number === this.EDIT_NAME); if (editInfo) { Gerrit.Nav.navigateToChange(this._change, this.EDIT_NAME); diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html index d364ee0c09..71ca338b95 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.html @@ -162,7 +162,7 @@ limitations under the License. assert.isFalse(element.$.replyOverlay.opened); assert(openSpy.lastCall.calledWithExactly( element.$.replyDialog.FocusTarget.ANY), - '_openReplyDialog should have been passed ANY'); + '_openReplyDialog should have been passed ANY'); assert.equal(openSpy.callCount, 1); done(); }); @@ -1074,7 +1074,7 @@ limitations under the License. MockInteractions.tap(element.$.replyBtn); assert(openStub.lastCall.calledWithExactly( element.$.replyDialog.FocusTarget.ANY), - '_openReplyDialog should have been passed ANY'); + '_openReplyDialog should have been passed ANY'); assert.equal(openStub.callCount, 1); }); @@ -1086,7 +1086,7 @@ limitations under the License. {message: {message: 'text'}}); assert(openStub.lastCall.calledWithExactly( element.$.replyDialog.FocusTarget.BODY), - '_openReplyDialog should have been passed BODY'); + '_openReplyDialog should have been passed BODY'); assert.equal(openStub.callCount, 1); done(); }); @@ -1511,7 +1511,7 @@ limitations under the License. test('_computeEditMode', () => { const callCompute = (range, params) => - element._computeEditMode({base: range}, {base: params}); + element._computeEditMode({base: range}, {base: params}); assert.isFalse(callCompute({}, {})); assert.isTrue(callCompute({}, {edit: true})); assert.isFalse(callCompute({basePatchNum: 'PARENT', patchNum: 1}, {})); @@ -1719,7 +1719,7 @@ limitations under the License. element._patchRange = {patchNum: 1}; element.$.actions.dispatchEvent(new CustomEvent('stop-edit-tap', - {bubbles: false})); + {bubbles: false})); }); suite('plugin endpoints', () => { diff --git a/polygerrit-ui/app/elements/change/gr-comment-list/gr-comment-list.js b/polygerrit-ui/app/elements/change/gr-comment-list/gr-comment-list.js index cbc7e429b6..42cb976ff3 100644 --- a/polygerrit-ui/app/elements/change/gr-comment-list/gr-comment-list.js +++ b/polygerrit-ui/app/elements/change/gr-comment-list/gr-comment-list.js @@ -45,7 +45,7 @@ _computeDiffLineURL(file, changeNum, patchNum, comment) { const basePatchNum = comment.hasOwnProperty('parent') ? - -comment.parent : null; + -comment.parent : null; return Gerrit.Nav.getUrlForDiffById(this.changeNum, this.projectName, file, patchNum, basePatchNum, comment.line, this._isOnParent(comment)); diff --git a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog.js b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog.js index 214b150965..a63ef3c0ee 100644 --- a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog.js +++ b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog.js @@ -83,21 +83,21 @@ } return this.$.restAPI.getRepoBranches( input, this.project, SUGGESTIONS_LIMIT).then(response => { - const branches = []; - let branch; - for (const key in response) { - if (!response.hasOwnProperty(key)) { continue; } - if (response[key].ref.startsWith('refs/heads/')) { - branch = response[key].ref.substring('refs/heads/'.length); - } else { - branch = response[key].ref; - } - branches.push({ - name: branch, - }); - } - return branches; + const branches = []; + let branch; + for (const key in response) { + if (!response.hasOwnProperty(key)) { continue; } + if (response[key].ref.startsWith('refs/heads/')) { + branch = response[key].ref.substring('refs/heads/'.length); + } else { + branch = response[key].ref; + } + branches.push({ + name: branch, }); + } + return branches; + }); }, }); })(); diff --git a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.js b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.js index f8d715197f..f198483a4b 100644 --- a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.js +++ b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog.js @@ -62,21 +62,21 @@ } return this.$.restAPI.getRepoBranches( input, this.project, SUGGESTIONS_LIMIT).then(response => { - const branches = []; - let branch; - for (const key in response) { - if (!response.hasOwnProperty(key)) { continue; } - if (response[key].ref.startsWith('refs/heads/')) { - branch = response[key].ref.substring('refs/heads/'.length); - } else { - branch = response[key].ref; - } - branches.push({ - name: branch, - }); - } - return branches; + const branches = []; + let branch; + for (const key in response) { + if (!response.hasOwnProperty(key)) { continue; } + if (response[key].ref.startsWith('refs/heads/')) { + branch = response[key].ref.substring('refs/heads/'.length); + } else { + branch = response[key].ref; + } + branches.push({ + name: branch, }); + } + return branches; + }); }, }); })(); diff --git a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.js b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.js index 29f8b95a90..461f0308fa 100644 --- a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.js +++ b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.js @@ -82,7 +82,7 @@ _getChangeSuggestions(input) { return this._getRecentChanges().then(changes => - this._filterChanges(input, changes)); + this._filterChanges(input, changes)); }, _filterChanges(input, changes) { diff --git a/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog.js b/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog.js index 4fe6d8fc3c..0e6315a67d 100644 --- a/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog.js +++ b/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog.js @@ -142,7 +142,7 @@ for (const rev of Object.values(change.revisions || {})) { if (this.patchNumEquals(rev._number, patchNum)) { const parentLength = rev.commit && rev.commit.parents ? - rev.commit.parents.length : 0; + rev.commit.parents.length : 0; return parentLength == 0; } } diff --git a/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.html b/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.html index ee284b9b24..214363b1cf 100644 --- a/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.html +++ b/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.html @@ -179,7 +179,7 @@ limitations under the License. test('computed fields', () => { assert.equal(element._computeArchiveDownloadLink( {project: 'test/project', _number: 123}, 2, 'tgz'), - '/changes/test%2Fproject~123/revisions/2/archive?format=tgz'); + '/changes/test%2Fproject~123/revisions/2/archive?format=tgz'); }); test('close event', done => { diff --git a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.js b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.js index c6e369c0cc..94484adb5b 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.js +++ b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.js @@ -132,7 +132,7 @@ _computePatchSetDescription(change, patchNum) { const rev = this.getRevisionByPatchNum(change.revisions, patchNum); this._patchsetDescription = (rev && rev.description) ? - rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : ''; + rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : ''; }, _handleDescriptionRemoved(e) { @@ -240,7 +240,7 @@ _computeUploadHelpContainerClass(change, account) { const changeIsMerged = change && change.status === MERGED_STATUS; const ownerId = change && change.owner && change.owner._account_id ? - change.owner._account_id : null; + change.owner._account_id : null; const userId = account && account._account_id; const userIsOwner = ownerId && userId && ownerId === userId; const hideContainer = !userIsOwner || changeIsMerged; diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js index fc9d0979ac..891033280e 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js @@ -809,7 +809,7 @@ _computeShowHideIcon(path, expandedFilesRecord) { return this._isFileExpanded(path, expandedFilesRecord) ? - 'gr-icons:expand-less' : 'gr-icons:expand-more'; + 'gr-icons:expand-less' : 'gr-icons:expand-more'; }, _computeFiles(filesByPath, changeComments, patchRange, reviewed, loading) { @@ -833,7 +833,7 @@ _computeFilesShown(numFilesShown, files) { const previousNumFilesShown = this._shownFiles ? - this._shownFiles.length : 0; + this._shownFiles.length : 0; const filesShown = files.base.slice(0, numFilesShown); this.fire('files-shown-changed', {length: filesShown.length}); @@ -900,7 +900,7 @@ _computePatchSetDescription(revisions, patchNum) { const rev = this.getRevisionByPatchNum(revisions, patchNum); return (rev && rev.description) ? - rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : ''; + rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : ''; }, /** @@ -912,7 +912,7 @@ _computeFileStatusLabel(status) { const statusCode = this._computeFileStatus(status); return FileStatus.hasOwnProperty(statusCode) ? - FileStatus[statusCode] : 'Status Unknown'; + FileStatus[statusCode] : 'Status Unknown'; }, _isFileExpanded(path, expandedFilesRecord) { @@ -944,7 +944,7 @@ // Clear content for any diffs that are not open so if they get re-opened // the stale content does not flash before it is cleared and reloaded. const collapsedDiffs = this.diffs.filter(diff => - this._expandedFilePaths.indexOf(diff.path) === -1); + this._expandedFilePaths.indexOf(diff.path) === -1); this._clearCollapsedDiffs(collapsedDiffs); if (!record) { return; } // Happens after "Collapse all" clicked. @@ -954,9 +954,9 @@ // Find the paths introduced by the new index splices: const newPaths = record.indexSplices - .map(splice => splice.object.slice( - splice.index, splice.index + splice.addedCount)) - .reduce((acc, paths) => acc.concat(paths), []); + .map(splice => splice.object.slice( + splice.index, splice.index + splice.addedCount)) + .reduce((acc, paths) => acc.concat(paths), []); // Required so that the newly created diff view is included in this.diffs. Polymer.dom.flush(); diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html index fbf2175ea0..3e4e763d6c 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html @@ -438,10 +438,10 @@ limitations under the License. '/COMMIT_MSG', 'comment'), '3 comments (1 unresolved)'); assert.equal( element._computeCommentsStringMobile(element.changeComments, parentTo1 - , '/COMMIT_MSG'), '2c'); + , '/COMMIT_MSG'), '2c'); assert.equal( element._computeCommentsStringMobile(element.changeComments, _1To2 - , '/COMMIT_MSG'), '3c'); + , '/COMMIT_MSG'), '3c'); assert.equal( element._computeDraftsString(element.changeComments, parentTo1, 'unresolved.file'), '1 draft'); @@ -637,7 +637,7 @@ limitations under the License. assert(navStub.lastCall.calledWith(element.change, 'file_added_in_rev2.txt', '2'), - 'Should navigate to /c/42/2/file_added_in_rev2.txt'); + 'Should navigate to /c/42/2/file_added_in_rev2.txt'); MockInteractions.pressAndReleaseKeyOn(element, 75, null, 'k'); MockInteractions.pressAndReleaseKeyOn(element, 75, null, 'k'); @@ -1652,7 +1652,7 @@ limitations under the License. element.set('_filesByPath', _filesByPath); flushAsynchronousOperations(); - // Navigates when a file is selected. + // Navigates when a file is selected. element._openSelectedFile(); assert.isTrue(navStub.called); }); @@ -1713,7 +1713,7 @@ limitations under the License. // Commit message should not have edit controls. const editControls = Polymer.dom(element.root).querySelectorAll('.row:not(.header)') - .map(row => row.querySelector('gr-edit-file-controls')); + .map(row => row.querySelector('gr-edit-file-controls')); assert.isTrue(editControls[0].classList.contains('invisible')); }); diff --git a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.js b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.js index f472331025..aa5b61a971 100644 --- a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.js +++ b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.js @@ -112,7 +112,7 @@ if (!labels[label.name]) { return null; } const labelValue = this._getLabelValue(labels, permittedLabels, label); const len = permittedLabels[label.name] != null ? - permittedLabels[label.name].length : 0; + permittedLabels[label.name].length : 0; for (let i = 0; i < len; i++) { const val = permittedLabels[label.name][i]; if (val === labelValue) { @@ -132,7 +132,7 @@ const name = e.target.selectedItem.name; const value = e.target.selectedItem.getAttribute('value'); this.dispatchEvent(new CustomEvent( - 'labels-changed', {detail: {name, value}, bubbles: true})); + 'labels-changed', {detail: {name, value}, bubbles: true})); }, _computeAnyPermittedLabelValues(permittedLabels, label) { @@ -142,7 +142,7 @@ _computeHiddenClass(permittedLabels, label) { return !this._computeAnyPermittedLabelValues(permittedLabels, label) ? - 'hidden' : ''; + 'hidden' : ''; }, _computePermittedLabelValues(permittedLabels, label) { diff --git a/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores_test.html b/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores_test.html index 24529ecb8d..187c0a6340 100644 --- a/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores_test.html +++ b/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores_test.html @@ -121,7 +121,7 @@ limitations under the License. const labelName = 'Code-Review'; assert.strictEqual(element._getVoteForAccount( element.change.labels, labelName, element.account), - '+1'); + '+1'); }); test('_computeColumns', () => { @@ -166,10 +166,10 @@ limitations under the License. {name: 'Verified', value: null} ]); element.set(['change', 'labels', 'Verified', 'all'], - [{_account_id: 123, value: 1}]); + [{_account_id: 123, value: 1}]); assert.deepEqual(element._labels, [ - {name: 'Code-Review', value: null}, - {name: 'Verified', value: '+1'}, + {name: 'Code-Review', value: null}, + {name: 'Verified', value: '+1'}, ]); }); }); diff --git a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js index d4071c6a01..1a6a243739 100644 --- a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js +++ b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js @@ -102,8 +102,8 @@ el.set('message.expanded', true); let top = el.offsetTop; for (let offsetParent = el.offsetParent; - offsetParent; - offsetParent = offsetParent.offsetParent) { + offsetParent; + offsetParent = offsetParent.offsetParent) { top += offsetParent.offsetTop; } window.scrollTo(0, top); diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js index 6c475892ae..6fe066f766 100644 --- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js +++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js @@ -344,7 +344,7 @@ _computeSubmittedTogetherClass(submittedTogether) { if (!submittedTogether || ( - submittedTogether.changes.length === 0 && + submittedTogether.changes.length === 0 && !submittedTogether.non_visible_changes)) { return 'hidden'; } diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.html b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.html index 48cc5651b6..c82bc31483 100644 --- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.html +++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.html @@ -319,7 +319,7 @@ limitations under the License. sandbox.stub(element, '_getCherryPicks') .returns(Promise.resolve()); conflictsStub = sandbox.stub(element, '_getConflicts') - .returns(Promise.resolve()); + .returns(Promise.resolve()); }); test('request conflicts if open and mergeable', () => { diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js index 9f9f026e46..3d2aa74f0a 100644 --- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js +++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js @@ -91,7 +91,7 @@ * @event comment-refresh */ - /** + /** * Fires when the state of the send button (enabled/disabled) changes. * * @event send-disabled-changed @@ -264,7 +264,7 @@ this.fetchChangeUpdates(this.change, this.$.restAPI) .then(result => { this.knownLatestState = result.isLatest ? - LatestPatchState.LATEST : LatestPatchState.NOT_LATEST; + LatestPatchState.LATEST : LatestPatchState.NOT_LATEST; }); this._focusOn(opt_focusTarget); @@ -406,16 +406,16 @@ return this.$.restAPI.removeChangeReviewer(this.change._number, account._account_id).then(response => { - if (!response.ok) { return response; } + if (!response.ok) { return response; } - const reviewers = this.change.reviewers[type] || []; - for (let i = 0; i < reviewers.length; i++) { - if (reviewers[i]._account_id == account._account_id) { - this.splice(['change', 'reviewers', type], i, 1); - break; - } - } - }); + const reviewers = this.change.reviewers[type] || []; + for (let i = 0; i < reviewers.length; i++) { + if (reviewers[i]._account_id == account._account_id) { + this.splice(['change', 'reviewers', type], i, 1); + break; + } + } + }); }, _mapReviewer(reviewer) { diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.html b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.html index f9108c75fd..733a49037c 100644 --- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.html +++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.html @@ -372,8 +372,8 @@ limitations under the License. }).then(() => { assert.isFalse(isVisible(element.$.reviewerConfirmationOverlay)); const additions = cc ? - element.$$('#ccs').additions() : - element.$.reviewers.additions(); + element.$$('#ccs').additions() : + element.$.reviewers.additions(); assert.deepEqual( additions, [ @@ -761,7 +761,7 @@ limitations under the License. // Send and purge and verify moves, delete cc3. element.send() .then(keepReviewers => - element._purgeReviewersPendingRemove(false, keepReviewers)) + element._purgeReviewersPendingRemove(false, keepReviewers)) .then(() => { assert.deepEqual( mutations, [ diff --git a/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.html b/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.html index 1a406c91c9..81827fdd4d 100644 --- a/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.html +++ b/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.html @@ -194,7 +194,7 @@ limitations under the License. element.maxReviewersDisplayed = 5; for (let i = 0; i < 6; i++) { reviewers.push( - {email: i+'reviewer@google.com', name: 'reviewer-' + i}); + {email: i+'reviewer@google.com', name: 'reviewer-' + i}); } element.ccsOnly = true; @@ -217,7 +217,7 @@ limitations under the License. element.maxReviewersDisplayed = 5; for (let i = 0; i < 7; i++) { reviewers.push( - {email: i+'reviewer@google.com', name: 'reviewer-' + i}); + {email: i+'reviewer@google.com', name: 'reviewer-' + i}); } element.ccsOnly = true; @@ -240,7 +240,7 @@ limitations under the License. const reviewers = []; for (let i = 0; i < 7; i++) { reviewers.push( - {email: i+'reviewer@google.com', name: 'reviewer-' + i}); + {email: i+'reviewer@google.com', name: 'reviewer-' + i}); } element.ccsOnly = true; @@ -263,7 +263,7 @@ limitations under the License. element.maxReviewersDisplayed = 5; for (let i = 0; i < 100; i++) { reviewers.push( - {email: i+'reviewer@google.com', name: 'reviewer-' + i}); + {email: i+'reviewer@google.com', name: 'reviewer-' + i}); } element.ccsOnly = true; @@ -296,7 +296,7 @@ limitations under the License. }, Bar: { all: [{_account_id: 1, permitted_voting_range: {max: 1}}, - {_account_id: 7, permitted_voting_range: {max: 1}}], + {_account_id: 7, permitted_voting_range: {max: 1}}], }, FooBar: { all: [{_account_id: 7, value: 0}], diff --git a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.js b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.js index 69d77f68e3..e171472b98 100644 --- a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.js +++ b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.js @@ -109,8 +109,8 @@ const lastNonDraftComment = (lastComment.__draft && thread.comments.length > 1) ? - thread.comments[thread.comments.length - 2] : - lastComment; + thread.comments[thread.comments.length - 2] : + lastComment; return { thread, diff --git a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html index 5df544440e..77328704e3 100644 --- a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html +++ b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html @@ -76,7 +76,7 @@ limitations under the License. 'none'); assert.notEqual(getComputedStyle(element.$$('gr-account-dropdown')) .display, - 'none'); + 'none'); assert.notEqual(getComputedStyle(element.$$('.settingsButton')).display, 'none'); }); diff --git a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html index c0ef3ac8d0..c51435b1e7 100644 --- a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html +++ b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html @@ -722,11 +722,11 @@ limitations under the License. getUserDashboard(user = 'self', sections = DEFAULT_SECTIONS, title = '') { sections = sections - .filter(section => (user === 'self' || !section.selfOnly)) - .map(section => Object.assign({}, section, { - name: section.name, - query: section.query.replace(USER_PLACEHOLDER_PATTERN, user), - })); + .filter(section => (user === 'self' || !section.selfOnly)) + .map(section => Object.assign({}, section, { + name: section.name, + query: section.query.replace(USER_PLACEHOLDER_PATTERN, user), + })); return {title, sections}; }, }; diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js index 36126e429e..c635999864 100644 --- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js +++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js @@ -195,7 +195,7 @@ console.error(eventValue.error || eventName); } else { console.log(eventName + (eventValue !== undefined ? - (': ' + eventValue) : '')); + (': ' + eventValue) : '')); } }, diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html index 8b8507433e..cd5e2e5134 100644 --- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html +++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting_test.html @@ -66,11 +66,11 @@ limitations under the License. element.reporter.calledWithExactly( 'timing-report', 'UI Latency', 'App Started', NOW_TIME - fakePerformance.navigationStart - )); + )); assert.isTrue( element.reporter.calledWithExactly( 'lifecycle', 'Page Visibility', 'hidden' - )); + )); }); test('WebComponentsReady', () => { diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.js b/polygerrit-ui/app/elements/core/gr-router/gr-router.js index 1e6efa151e..78d00aea45 100644 --- a/polygerrit-ui/app/elements/core/gr-router/gr-router.js +++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.js @@ -442,8 +442,8 @@ // If there is a repo name provided, make sure to substitute it into the // ${repo} (or legacy ${project}) query tokens. const query = opt_repoName ? - section.query.replace(REPO_TOKEN_PATTERN, opt_repoName) : - section.query; + section.query.replace(REPO_TOKEN_PATTERN, opt_repoName) : + section.query; return encodeURIComponent(section.name) + '=' + encodeURIComponent(query); }); diff --git a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.html b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.html index 1bc3c9d333..b162828ec9 100644 --- a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.html +++ b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.html @@ -59,8 +59,8 @@ limitations under the License. getActiveElement = () => { return document.activeElement.shadowRoot ? - document.activeElement.shadowRoot.activeElement : - document.activeElement; + document.activeElement.shadowRoot.activeElement : + document.activeElement; }; test('enter in search input fires event', done => { diff --git a/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js b/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js index a921308a2c..f2e8f24078 100644 --- a/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js +++ b/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js @@ -144,8 +144,8 @@ return accounts.map(account => ({ label: account.name || '', text: account.email ? - `${predicate}:${account.email}` : - `${predicate}:"${this._accountOrAnon(account)}"`, + `${predicate}:${account.email}` : + `${predicate}:"${this._accountOrAnon(account)}"`, })); }, }); diff --git a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.js b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.js index 4b64f7b4e4..ff9dee5eb7 100644 --- a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.js +++ b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.js @@ -268,9 +268,9 @@ const all = comments.concat(drafts).concat(robotComments); const baseComments = all.filter(c => - this._isInBaseOfPatchRange(c, patchRange)); + this._isInBaseOfPatchRange(c, patchRange)); const revisionComments = all.filter(c => - this._isInRevisionOfPatchRange(c, patchRange)); + this._isInRevisionOfPatchRange(c, patchRange)); return { meta: { @@ -368,7 +368,7 @@ const threads = this.getCommentThreads(this._sortComments(comments)); const unresolvedThreads = threads - .filter(thread => + .filter(thread => thread.comments.length && thread.comments[thread.comments.length - 1].unresolved); @@ -511,7 +511,7 @@ return Promise.all(promises).then(([comments, robotComments, drafts]) => { this._changeComments = new ChangeComments(comments, - robotComments, drafts, changeNum); + robotComments, drafts, changeNum); return this._changeComments; }); }, diff --git a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api_test.html b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api_test.html index 1e53a14b1f..1ca2a69349 100644 --- a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api_test.html +++ b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api_test.html @@ -107,7 +107,7 @@ limitations under the License. let draftStub; setup(() => { commentStub = sandbox.stub(element.$.restAPI, 'getDiffComments') - .returns(Promise.resolve({})); + .returns(Promise.resolve({})); robotCommentStub = sandbox.stub(element.$.restAPI, 'getDiffRobotComments').returns(Promise.resolve({})); draftStub = sandbox.stub(element.$.restAPI, 'getDiffDrafts') diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-unified.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-unified.js index 9a04b1ff82..247ccf7a45 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-unified.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-unified.js @@ -102,7 +102,7 @@ let tr = content.parentElement.parentElement; while (tr = tr.nextSibling) { if (tr.classList.contains('both') || ( - (side === 'left' && tr.classList.contains('remove')) || + (side === 'left' && tr.classList.contains('remove')) || (side === 'right' && tr.classList.contains('add')))) { return tr.querySelector('.contentText'); } diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html index cc66e3bdff..4bda1e194f 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html @@ -226,8 +226,8 @@ limitations under the License. getLineNumberByChild(node) { const lineEl = this.getLineElByChild(node); return lineEl ? - parseInt(lineEl.getAttribute('data-value'), 10) : - null; + parseInt(lineEl.getAttribute('data-value'), 10) : + null; }, getContentByLine(lineNumber, opt_side, opt_root) { @@ -256,7 +256,7 @@ limitations under the License. getSideByLineEl(lineEl) { return lineEl.classList.contains(GrDiffBuilder.Side.RIGHT) ? - GrDiffBuilder.Side.RIGHT : GrDiffBuilder.Side.LEFT; + GrDiffBuilder.Side.RIGHT : GrDiffBuilder.Side.LEFT; }, emitGroup(group, sectionEl) { @@ -309,7 +309,7 @@ limitations under the License. const createFn = this.createCommentFn; if (this.isImageDiff) { builder = new GrDiffBuilderImage(diff, comments, createFn, prefs, - this.diffElement, this.baseImage, this.revisionImage); + this.diffElement, this.baseImage, this.revisionImage); } else if (diff.binary) { // If the diff is binary, but not an image. return new GrDiffBuilderBinary(diff, comments, prefs, @@ -385,8 +385,8 @@ limitations under the License. // If endIndex isn't present, continue to the end of the line. const endIndex = highlight.endIndex === undefined ? - line.text.length : - highlight.endIndex; + line.text.length : + highlight.endIndex; GrAnnotation.annotateElement( el, diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js index 4b85c227a2..30b6fbf9f3 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js @@ -186,7 +186,7 @@ continue; } const lineNumber = opt_side === 'left' ? - line.beforeNumber : line.afterNumber; + line.beforeNumber : line.afterNumber; if (lineNumber < start || lineNumber > end) { continue; } if (out_lines) { out_lines.push(line); } @@ -369,7 +369,7 @@ // thread and append to it. if (comment.in_reply_to) { const thread = threads.find(thread => - thread.comments.some(c => c.id === comment.in_reply_to)); + thread.comments.some(c => c.id === comment.in_reply_to)); if (thread) { thread.comments.push(comment); continue; diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder_test.html b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder_test.html index 3238cbc16d..9a88ac9a02 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder_test.html @@ -441,13 +441,13 @@ limitations under the License. }; assert.deepEqual(builder._getCommentsForLine(comments, line), [{id: 'l3', line: 3, __commentSide: 'left'}, - {id: 'r5', line: 5, __commentSide: 'right'}]); + {id: 'r5', line: 5, __commentSide: 'right'}]); assert.deepEqual(builder._getCommentsForLine(comments, line, GrDiffBuilder.Side.LEFT), [{id: 'l3', line: 3, - __commentSide: 'left'}]); + __commentSide: 'left'}]); assert.deepEqual(builder._getCommentsForLine(comments, line, GrDiffBuilder.Side.RIGHT), [{id: 'r5', line: 5, - __commentSide: 'right'}]); + __commentSide: 'right'}]); }); test('comment thread group creation', () => { @@ -901,7 +901,7 @@ limitations under the License. test('no plugin layers', () => { const getDiffLayersStub = sinon.stub(element.$.jsAPI, 'getDiffLayers') - .returns([]); + .returns([]); element.attached(); assert.isTrue(getDiffLayersStub.called); assert.equal(element._layers.length, initialLayersCount); @@ -909,7 +909,7 @@ limitations under the License. test('with plugin layers', () => { const getDiffLayersStub = sinon.stub(element.$.jsAPI, 'getDiffLayers') - .returns([{}, {}]); + .returns([{}, {}]); element.attached(); assert.isTrue(getDiffLayersStub.called); assert.equal(element._layers.length, initialLayersCount+2); diff --git a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js index d5e6855f84..60966a79f9 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js @@ -128,7 +128,7 @@ commentEl.collapsed = false; } else { const range = opt_range ? opt_range : - lastComment ? lastComment.range : undefined; + lastComment ? lastComment.range : undefined; const unresolved = lastComment ? lastComment.unresolved : undefined; this.addDraft(opt_lineNum, range, unresolved); } diff --git a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread_test.html b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread_test.html index b525a60291..868be90a5e 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread_test.html @@ -464,7 +464,7 @@ limitations under the License. done(); }); draftEl.fire('comment-discard', {comment: draftEl.comment}, - {bubbles: false}); + {bubbles: false}); }); test('first editing comment does not add __otherEditing attribute', () => { diff --git a/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.js b/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.js index 90d465f026..6de07468f5 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-comment/gr-diff-comment.js @@ -425,7 +425,7 @@ // Ignore saves started while already saving. if (this.disabled) { return; } const timingLabel = this.comment.id ? - REPORT_UPDATE_DRAFT : REPORT_CREATE_DRAFT; + REPORT_UPDATE_DRAFT : REPORT_CREATE_DRAFT; const timer = this.$.reporting.getTimer(timingLabel); this.set('comment.__editing', false); return this.save().then(() => { timer.end(); }); @@ -568,13 +568,13 @@ this._showStartRequest(); return this.$.restAPI.deleteDiffDraft(this.changeNum, this.patchNum, draft).then(result => { - if (result.ok) { - this._showEndRequest(); - } else { - this._handleFailedDraftRequest(); - } - return result; - }); + if (result.ok) { + this._showEndRequest(); + } else { + this._handleFailedDraftRequest(); + } + return result; + }); }, _getPatchNum() { diff --git a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js index aee7a62e2c..de7660d584 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js @@ -304,7 +304,7 @@ if (this._getViewMode() === DiffViewMode.SIDE_BY_SIDE && this._isTargetBlank()) { this.side = this.side === DiffSides.LEFT ? - DiffSides.RIGHT : DiffSides.LEFT; + DiffSides.RIGHT : DiffSides.LEFT; } }, @@ -380,15 +380,15 @@ splice = changeRecord.indexSplices[spliceIdx]; for (i = splice.index; - i < splice.index + splice.addedCount; - i++) { + i < splice.index + splice.addedCount; + i++) { this.listen(this.diffs[i], 'render-start', '_handleDiffRenderStart'); this.listen(this.diffs[i], 'render-content', 'handleDiffUpdate'); } for (i = 0; - i < splice.removed && splice.removed.length; - i++) { + i < splice.removed && splice.removed.length; + i++) { this.unlisten(splice.removed[i], 'render-start', '_handleDiffRenderStart'); this.unlisten(splice.removed[i], diff --git a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-annotation_test.html b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-annotation_test.html index 652aa4c804..c07d3708e7 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-annotation_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-annotation_test.html @@ -166,7 +166,7 @@ limitations under the License. assert.equal(layer4[0].textContent + layer4[1].textContent + layer4[2].textContent, - layers[3]); + layers[3]); }); test('splitTextNode', () => { diff --git a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight_test.html b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight_test.html index b10e3cc167..1c37380e06 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight_test.html @@ -259,12 +259,12 @@ limitations under the License. }; const getActionRange = () => - Polymer.dom(element.root).querySelector( - 'gr-selection-action-box').range; + Polymer.dom(element.root).querySelector( + 'gr-selection-action-box').range; const getActionSide = () => - Polymer.dom(element.root).querySelector( - 'gr-selection-action-box').side; + Polymer.dom(element.root).querySelector( + 'gr-selection-action-box').side; const getLineElByChild = node => { const stubs = contentStubs.find(stub => stub.contentTd.contains(node)); diff --git a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js index fa1d9ca31c..d495dfc7a6 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js @@ -394,7 +394,7 @@ // digits. Diffs with no delta are considered 0%. const totalDelta = rebaseDelta + nonRebaseDelta; const percentRebaseDelta = !totalDelta ? 0 : - Math.round(100 * rebaseDelta / totalDelta); + Math.round(100 * rebaseDelta / totalDelta); // Report the due_to_rebase percentage in the "diff" category when // applicable. diff --git a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.html b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.html index f83253eee8..b553ae6903 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.html @@ -177,7 +177,7 @@ limitations under the License. 'getB64FileContents', (changeId, patchNum, path, opt_parentIndex) => { return Promise.resolve(opt_parentIndex === 1 ? mockFile1 : - mockFile2); + mockFile2); }); element.patchRange = {basePatchNum: 'PARENT', patchNum: 1}; diff --git a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js index 27e467dcf8..b37a511303 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js @@ -87,8 +87,8 @@ const side = this.diffBuilder.getSideByLineEl(lineEl); targetClasses.push(side === 'left' ? - SelectionClass.LEFT : - SelectionClass.RIGHT); + SelectionClass.LEFT : + SelectionClass.RIGHT); if (commentSelected) { targetClasses.push(SelectionClass.COMMENT); diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js index 6b17b9a73d..4cec917368 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view.js @@ -257,8 +257,8 @@ const patchRange = patchRangeRecord.base; return this.$.restAPI.getChangeFilePathsAsSpeciallySortedArray( changeNum, patchRange).then(files => { - this._fileList = files; - }); + this._fileList = files; + }); }, _getDiffPreferences() { @@ -550,8 +550,8 @@ let idx = fileList.indexOf(path); if (idx === -1) { const file = direction > 0 ? - fileList[0] : - fileList[fileList.length - 1]; + fileList[0] : + fileList[fileList.length - 1]; return {path: file}; } @@ -681,8 +681,8 @@ // is specified. this._getReviewedStatus(this.editMode, this._changeNum, this._patchRange.patchNum, this._path).then(status => { - this.$.reviewed.checked = status; - }); + this.$.reviewed.checked = status; + }); return; } @@ -1080,7 +1080,7 @@ // so we resolve the right "next" file. const unreviewedFiles = this._fileList .filter(file => - (file === this._path || !this._reviewedFiles.has(file))); + (file === this._path || !this._reviewedFiles.has(file))); this._navToFile(this._path, unreviewedFiles, 1); }, diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.html b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.html index c47bfee773..b5aa57923e 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.html @@ -262,28 +262,28 @@ limitations under the License. assert.isTrue(element._loading); assert(diffNavStub.lastCall.calledWithExactly(element._change, 'wheatley.md', '10', '5'), - 'Should navigate to /c/42/5..10/wheatley.md'); + 'Should navigate to /c/42/5..10/wheatley.md'); element._path = 'wheatley.md'; MockInteractions.pressAndReleaseKeyOn(element, 219, null, '['); assert.isTrue(element._loading); assert(diffNavStub.lastCall.calledWithExactly(element._change, 'glados.txt', '10', '5'), - 'Should navigate to /c/42/5..10/glados.txt'); + 'Should navigate to /c/42/5..10/glados.txt'); element._path = 'glados.txt'; MockInteractions.pressAndReleaseKeyOn(element, 219, null, '['); assert.isTrue(element._loading); assert(diffNavStub.lastCall.calledWithExactly(element._change, 'chell.go', '10', '5'), - 'Should navigate to /c/42/5..10/chell.go'); + 'Should navigate to /c/42/5..10/chell.go'); element._path = 'chell.go'; MockInteractions.pressAndReleaseKeyOn(element, 219, null, '['); assert.isTrue(element._loading); assert(changeNavStub.lastCall.calledWithExactly(element._change, '10', '5'), - 'Should navigate to /c/42/5..10'); + 'Should navigate to /c/42/5..10'); }); test('keyboard shortcuts with old patch number', () => { @@ -325,13 +325,13 @@ limitations under the License. MockInteractions.pressAndReleaseKeyOn(element, 221, null, ']'); assert(diffNavStub.lastCall.calledWithExactly(element._change, 'wheatley.md', '1', PARENT), - 'Should navigate to /c/42/1/wheatley.md'); + 'Should navigate to /c/42/1/wheatley.md'); element._path = 'wheatley.md'; MockInteractions.pressAndReleaseKeyOn(element, 219, null, '['); assert(diffNavStub.lastCall.calledWithExactly(element._change, 'glados.txt', '1', PARENT), - 'Should navigate to /c/42/1/glados.txt'); + 'Should navigate to /c/42/1/glados.txt'); element._path = 'glados.txt'; MockInteractions.pressAndReleaseKeyOn(element, 219, null, '['); diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js index f66fea48af..74087947d0 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js @@ -69,7 +69,7 @@ * @event diff-comments-modified */ - /** + /** * Fired when a draft is added or edited. * * @event draft-interaction @@ -353,8 +353,8 @@ return false; } const patchNum = el.classList.contains(DiffSide.LEFT) ? - this.patchRange.basePatchNum : - this.patchRange.patchNum; + this.patchRange.basePatchNum : + this.patchRange.patchNum; const isEdit = this.patchNumEquals(patchNum, this.EDIT_NAME); const isEditBase = this.patchNumEquals(patchNum, this.PARENT_NAME) && @@ -763,8 +763,8 @@ chunkIndex--; chunk = diff.content[chunkIndex]; } while ( - // We haven't reached the beginning. - chunkIndex >= 0 && + // We haven't reached the beginning. + chunkIndex >= 0 && // The chunk doesn't have both sides. !chunk.ab && diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html index faf529b464..ec715630f0 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html @@ -339,7 +339,7 @@ limitations under the License. const threadGroup = contentEl.querySelector( 'gr-diff-comment-thread-group'); const threadLength = Polymer.dom(threadGroup.root). - querySelectorAll('gr-diff-comment-thread').length; + querySelectorAll('gr-diff-comment-thread').length; assert.equal(threadLength, 2); }); diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js index beacdb4a1d..a3456e2cc7 100644 --- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js +++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js @@ -69,7 +69,7 @@ changeComments, revisionInfo) { const parentCounts = revisionInfo.getParentCountMap(); const currentParentCount = parentCounts.hasOwnProperty(patchNum) ? - parentCounts[patchNum] : 1; + parentCounts[patchNum] : 1; const maxParents = revisionInfo.getMaxParents(); const isMerge = currentParentCount > 1; @@ -225,7 +225,7 @@ _computePatchSetDescription(revisions, patchNum, opt_addFrontSpace) { const rev = this.getRevisionByPatchNum(revisions, patchNum); return (rev && rev.description) ? - (opt_addFrontSpace ? ' ' : '') + + (opt_addFrontSpace ? ' ' : '') + rev.description.substring(0, PATCH_DESC_MAX_LENGTH) : ''; }, diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html index f6394e742e..f2b35a5300 100644 --- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html +++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html @@ -183,7 +183,7 @@ limitations under the License. assert.deepEqual(element._computeBaseDropdownContent(availablePatches, patchNum, sortedRevisions, element.changeComments, element.revisionInfo), - expectedResult); + expectedResult); }); test('_computeBaseDropdownContent called when patchNum updates', () => { @@ -342,7 +342,7 @@ limitations under the License. assert.deepEqual(element._computePatchDropdownContent(availablePatches, basePatchNum, sortedRevisions, element.changeComments), - expectedResult); + expectedResult); }); test('filesWeblinks', () => { diff --git a/polygerrit-ui/app/elements/diff/gr-ranged-comment-layer/gr-ranged-comment-layer.js b/polygerrit-ui/app/elements/diff/gr-ranged-comment-layer/gr-ranged-comment-layer.js index db14fc85ac..1d05e493f3 100644 --- a/polygerrit-ui/app/elements/diff/gr-ranged-comment-layer/gr-ranged-comment-layer.js +++ b/polygerrit-ui/app/elements/diff/gr-ranged-comment-layer/gr-ranged-comment-layer.js @@ -53,12 +53,12 @@ annotate(el, line) { let ranges = []; if (line.type === GrDiffLine.Type.REMOVE || ( - line.type === GrDiffLine.Type.BOTH && + line.type === GrDiffLine.Type.BOTH && el.getAttribute('data-side') !== 'right')) { ranges = ranges.concat(this._getRangesForLine(line, 'left')); } if (line.type === GrDiffLine.Type.ADD || ( - line.type === GrDiffLine.Type.BOTH && + line.type === GrDiffLine.Type.BOTH && el.getAttribute('data-side') !== 'left')) { ranges = ranges.concat(this._getRangesForLine(line, 'right')); } @@ -165,8 +165,8 @@ for (const splice of record.indexSplices) { const ranges = splice.removed.length ? - splice.removed.map(c => { return c.range; }) : - [splice.object[splice.index].range]; + splice.removed.map(c => { return c.range; }) : + [splice.object[splice.index].range]; for (const range of ranges) { if (!range) { continue; } this._notifyUpdateRange(range.start_line, range.end_line, side); diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js index 3a2a6d5dce..9d37638b5e 100644 --- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js +++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js @@ -177,11 +177,11 @@ // Determine the side. let side; if (line.type === GrDiffLine.Type.REMOVE || ( - line.type === GrDiffLine.Type.BOTH && + line.type === GrDiffLine.Type.BOTH && el.getAttribute('data-side') !== 'right')) { side = 'left'; } else if (line.type === GrDiffLine.Type.ADD || ( - el.getAttribute('data-side') !== 'left')) { + el.getAttribute('data-side') !== 'left')) { side = 'right'; } diff --git a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.js b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.js index 8740b0dd8a..696726c95e 100644 --- a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.js +++ b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.js @@ -207,17 +207,17 @@ _handleRenameConfirm(e) { return this.$.restAPI.renameFileInChangeEdit(this.change._number, this._path, this._newPath).then(res => { - if (!res.ok) { return; } - this._closeDialog(this._getDialogFromEvent(e), true); - Gerrit.Nav.navigateToChange(this.change); - }); + if (!res.ok) { return; } + this._closeDialog(this._getDialogFromEvent(e), true); + Gerrit.Nav.navigateToChange(this.change); + }); }, _queryFiles(input) { return this.$.restAPI.queryChangeFiles(this.change._number, this.patchNum, input).then(res => res.map(file => { - return {name: file}; - })); + return {name: file}; + })); }, _computeIsInvisible(id, hiddenActions) { diff --git a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.js b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.js index bf7fc99d09..51dc0f6b3e 100644 --- a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.js +++ b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.js @@ -136,11 +136,11 @@ if (path === this._path) { return Promise.resolve(); } return this.$.restAPI.renameFileInChangeEdit(this._changeNum, this._path, path).then(res => { - if (!res.ok) { return; } + if (!res.ok) { return; } - this._successfulSave = true; - this._viewEditInChangeView(); - }); + this._successfulSave = true; + this._viewEditInChangeView(); + }); }, _viewEditInChangeView() { @@ -183,13 +183,13 @@ this.$.storage.eraseEditableContentItem(this.storageKey); return this.$.restAPI.saveChangeEdit(this._changeNum, this._path, this._newContent).then(res => { - this._saving = false; - this._showAlert(res.ok ? SAVED_MESSAGE : SAVE_FAILED_MSG); - if (!res.ok) { return; } + this._saving = false; + this._showAlert(res.ok ? SAVED_MESSAGE : SAVE_FAILED_MSG); + if (!res.ok) { return; } - this._content = this._newContent; - this._successfulSave = true; - }); + this._content = this._newContent; + this._successfulSave = true; + }); }, _showAlert(message) { diff --git a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.html b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.html index 2f5332dd1d..010ff4adec 100644 --- a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.html +++ b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.html @@ -104,7 +104,7 @@ suite('gr-editor-view tests', () => { // Calling with the same path should not navigate. return element._handlePathChanged({detail: mockParams.path}).then(() => { assert.isFalse(savePathStub.called); - // !ok response + // !ok response element._handlePathChanged({detail: 'newPath'}).then(() => { assert.isTrue(savePathStub.called); assert.isFalse(navigateStub.called); diff --git a/polygerrit-ui/app/elements/plugins/gr-change-metadata-api/gr-change-metadata-api.js b/polygerrit-ui/app/elements/plugins/gr-change-metadata-api/gr-change-metadata-api.js index b550f73b62..0454767ff0 100644 --- a/polygerrit-ui/app/elements/plugins/gr-change-metadata-api/gr-change-metadata-api.js +++ b/polygerrit-ui/app/elements/plugins/gr-change-metadata-api/gr-change-metadata-api.js @@ -31,7 +31,7 @@ this._createHook(); } this._hook.onAttached(element => - this.plugin.attributeHelper(element).bind('labels', callback)); + this.plugin.attributeHelper(element).bind('labels', callback)); return this; }; diff --git a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js index 82f8f370a8..d3c6d103af 100644 --- a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js +++ b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js @@ -91,15 +91,15 @@ return helper.get('value').then( value => helper.bind('value', value => plugin.attributeHelper(el).set(paramName, value)) - ); + ); }); let timeoutId; const timeout = new Promise( - resolve => timeoutId = setTimeout(() => { - console.warn( - 'Timeout waiting for endpoint properties initialization: ' + + resolve => timeoutId = setTimeout(() => { + console.warn( + 'Timeout waiting for endpoint properties initialization: ' + `plugin ${plugin.getPluginName()}, endpoint ${this.name}`); - }, INIT_PROPERTIES_TIMEOUT_MS)); + }, INIT_PROPERTIES_TIMEOUT_MS)); return Promise.race([timeout, Promise.all(expectProperties)]) .then(() => { clearTimeout(timeoutId); diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js index 111cdc6f6f..dcd9049eec 100644 --- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js +++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js @@ -38,8 +38,8 @@ .filter(p => !Gerrit._isPluginPreloaded(p)); const jsPlugins = this._handleMigrations(plugins.js_resource_paths || [], htmlPlugins) - .map(p => this._urlFor(p)) - .filter(p => !Gerrit._isPluginPreloaded(p)); + .map(p => this._urlFor(p)) + .filter(p => !Gerrit._isPluginPreloaded(p)); const shouldLoadTheme = config.default_theme && !Gerrit._isPluginPreloaded('preloaded:gerrit-theme'); const defaultTheme = diff --git a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.js b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.js index 556cfd85dd..e3f869481a 100644 --- a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.js +++ b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.js @@ -46,17 +46,17 @@ if (!this._openingPromise) { this._openingPromise = this.plugin.hook('plugin-overlay').getLastAttached() - .then(hookEl => { - const popup = document.createElement('gr-plugin-popup'); - if (this._moduleName) { - const el = Polymer.dom(popup).appendChild( - document.createElement(this._moduleName)); - el.plugin = this.plugin; - } - this._popup = Polymer.dom(hookEl).appendChild(popup); - Polymer.dom.flush(); - return this._popup.open().then(() => this); - }); + .then(hookEl => { + const popup = document.createElement('gr-plugin-popup'); + if (this._moduleName) { + const el = Polymer.dom(popup).appendChild( + document.createElement(this._moduleName)); + el.plugin = this.plugin; + } + this._popup = Polymer.dom(hookEl).appendChild(popup); + Polymer.dom.flush(); + return this._popup.open().then(() => this); + }); } return this._openingPromise; }; diff --git a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info.js b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info.js index fcc99aa777..cc32690af1 100644 --- a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info.js +++ b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info.js @@ -123,20 +123,20 @@ _maybeSetName() { return this._hasNameChange && this.nameMutable ? - this.$.restAPI.setAccountName(this._account.name) : - Promise.resolve(); + this.$.restAPI.setAccountName(this._account.name) : + Promise.resolve(); }, _maybeSetUsername() { return this._hasUsernameChange && this.usernameMutable ? - this.$.restAPI.setAccountUsername(this._username) : - Promise.resolve(); + this.$.restAPI.setAccountUsername(this._username) : + Promise.resolve(); }, _maybeSetStatus() { return this._hasStatusChange ? - this.$.restAPI.setAccountStatus(this._account.status) : - Promise.resolve(); + this.$.restAPI.setAccountStatus(this._account.status) : + Promise.resolve(); }, _computeHasUnsavedChanges(nameChanged, usernameChanged, statusChanged) { diff --git a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.html b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.html index f91277a283..75b9910772 100644 --- a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.html +++ b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.html @@ -150,7 +150,7 @@ limitations under the License. usernameChangedSpy = sandbox.spy(element, '_usernameChanged'); statusChangedSpy = sandbox.spy(element, '_statusChanged'); element.set('_serverConfig', - {auth: {editable_account_fields: ['FULL_NAME', 'USER_NAME']}}); + {auth: {editable_account_fields: ['FULL_NAME', 'USER_NAME']}}); nameStub = sandbox.stub(element.$.restAPI, 'setAccountName', name => Promise.resolve()); @@ -278,7 +278,7 @@ limitations under the License. setup(() => { statusChangedSpy = sandbox.spy(element, '_statusChanged'); element.set('_serverConfig', - {auth: {editable_account_fields: []}}); + {auth: {editable_account_fields: []}}); statusStub = sandbox.stub(element.$.restAPI, 'setAccountStatus', status => Promise.resolve()); diff --git a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js index 493b1794cf..ae534899f9 100644 --- a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js +++ b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js @@ -121,7 +121,7 @@ _hideAgreements(item, groups, signedAgreements) { return this._disableAgreements(item, groups, signedAgreements) ? - '' : 'hide'; + '' : 'hide'; }, _disableAgreementsText(text) { diff --git a/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor.js b/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor.js index 78025d1d42..890061e87b 100644 --- a/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor.js +++ b/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor.js @@ -46,11 +46,11 @@ return; } this._keys = Object.keys(keys) - .map(key => { - const gpgKey = keys[key]; - gpgKey.id = key; - return gpgKey; - }); + .map(key => { + const gpgKey = keys[key]; + gpgKey.id = key; + return gpgKey; + }); }); }, diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.html b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.html index 288a670a77..cd8e194e03 100644 --- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.html +++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.html @@ -67,17 +67,17 @@ limitations under the License. name: 'Andrew Bonventre', email: 'andybons+gerrit@gmail.com', }), - 'Andrew Bonventre '); + 'Andrew Bonventre '); assert.equal(element._computeAccountTitle( {name: 'Andrew Bonventre'}), - 'Andrew Bonventre'); + 'Andrew Bonventre'); assert.equal(element._computeAccountTitle( { email: 'andybons+gerrit@gmail.com', }), - 'Anonymous '); + 'Anonymous '); assert.equal(element._computeShowEmailClass( { diff --git a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html index 5ce17c05b9..63718c533c 100644 --- a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html +++ b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html @@ -51,22 +51,22 @@ limitations under the License. { _account_id: 123, }), - '/accounts/123/avatar?s=16'); + '/accounts/123/avatar?s=16'); assert.equal(element._buildAvatarURL( { email: 'test@example.com', }), - '/accounts/test%40example.com/avatar?s=16'); + '/accounts/test%40example.com/avatar?s=16'); assert.equal(element._buildAvatarURL( { name: 'John Doe', }), - '/accounts/John%20Doe/avatar?s=16'); + '/accounts/John%20Doe/avatar?s=16'); assert.equal(element._buildAvatarURL( { username: 'John_Doe', }), - '/accounts/John_Doe/avatar?s=16'); + '/accounts/John_Doe/avatar?s=16'); assert.equal(element._buildAvatarURL( { _account_id: 123, @@ -85,7 +85,7 @@ limitations under the License. }, ], }), - 'https://cdn.example.com/s16-p/photo.jpg'); + 'https://cdn.example.com/s16-p/photo.jpg'); assert.equal(element._buildAvatarURL( { _account_id: 123, @@ -96,7 +96,7 @@ limitations under the License. }, ], }), - '/accounts/123/avatar?s=16'); + '/accounts/123/avatar?s=16'); assert.equal(element._buildAvatarURL(undefined), ''); }); diff --git a/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js b/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js index f750cd268c..8d66d0b673 100644 --- a/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js +++ b/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js @@ -254,8 +254,8 @@ _getTop(target) { let top = target.offsetTop; for (let offsetParent = target.offsetParent; - offsetParent; - offsetParent = offsetParent.offsetParent) { + offsetParent; + offsetParent = offsetParent.offsetParent) { top += offsetParent.offsetTop; } return top; @@ -284,7 +284,7 @@ const dims = this._getWindowDims(); const top = this._getTop(this.target); const bottomIsVisible = this._targetHeight ? - this._targetIsVisible(top + this._targetHeight) : true; + this._targetIsVisible(top + this._targetHeight) : true; const scrollToValue = this._calculateScrollToValue(top, this.target); if (this._targetIsVisible(top)) { diff --git a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.js b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.js index 3417a0d545..43ec20e3b6 100644 --- a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.js +++ b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.js @@ -167,8 +167,8 @@ _timeToSecondsFormat(timeFormat) { return timeFormat === TimeFormats.TIME_12 ? - TimeFormats.TIME_12_WITH_SEC : - TimeFormats.TIME_24_WITH_SEC; + TimeFormats.TIME_12_WITH_SEC : + TimeFormats.TIME_24_WITH_SEC; }, _computeFullDateStr(dateStr, timeFormat) { diff --git a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.html b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.html index ad4d0daced..798aa68b1d 100644 --- a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.html +++ b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.html @@ -87,7 +87,7 @@ limitations under the License. suite('24 hours time format preference', () => { setup(() => { return stubRestAPI( - {time_format: 'HHMM_24', relative_date_in_change_table: false} + {time_format: 'HHMM_24', relative_date_in_change_table: false} ).then(() => { element = fixture('basic'); sandbox.stub(element, '_getUtcOffsetString').returns(''); @@ -137,7 +137,7 @@ limitations under the License. setup(() => { // relative_date_in_change_table is not set when false. return stubRestAPI( - {time_format: 'HHMM_12'} + {time_format: 'HHMM_12'} ).then(() => { element = fixture('basic'); sandbox.stub(element, '_getUtcOffsetString').returns(''); @@ -157,7 +157,7 @@ limitations under the License. suite('relative date preference', () => { setup(() => { return stubRestAPI( - {time_format: 'HHMM_12', relative_date_in_change_table: true} + {time_format: 'HHMM_12', relative_date_in_change_table: true} ).then(() => { element = fixture('basic'); sandbox.stub(element, '_getUtcOffsetString').returns(''); @@ -185,7 +185,7 @@ limitations under the License. suite('logged in', () => { setup(() => { return stubRestAPI( - {time_format: 'HHMM_12', relative_date_in_change_table: true} + {time_format: 'HHMM_12', relative_date_in_change_table: true} ).then(() => { element = fixture('basic'); return element._loadPreferences(); diff --git a/polygerrit-ui/app/elements/shared/gr-diff-preferences/gr-diff-preferences_test.html b/polygerrit-ui/app/elements/shared/gr-diff-preferences/gr-diff-preferences_test.html index 5bd72c4815..055d7aa2c3 100644 --- a/polygerrit-ui/app/elements/shared/gr-diff-preferences/gr-diff-preferences_test.html +++ b/polygerrit-ui/app/elements/shared/gr-diff-preferences/gr-diff-preferences_test.html @@ -108,7 +108,7 @@ limitations under the License. .returns(Promise.resolve()); const showTrailingWhitespaceCheckbox = valueOf('Show trailing whitespace', 'diffPreferences') - .firstElementChild; + .firstElementChild; showTrailingWhitespaceCheckbox.checked = false; element._handleShowTrailingWhitespaceTap(); diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.js b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.js index c8f4f63f3c..b7ddfd74a8 100644 --- a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.js +++ b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.js @@ -109,7 +109,7 @@ }); if (!selectedObj) { return; } this.text = selectedObj.triggerText? selectedObj.triggerText : - selectedObj.text; + selectedObj.text; this.dispatchEvent(new CustomEvent('value-change', { detail: {value}, bubbles: false, diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js index c06ffc9e54..f3e19b835f 100644 --- a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js +++ b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js @@ -206,7 +206,7 @@ */ _computeURLHelper(host, path) { const base = path.startsWith(this.getBaseUrl()) ? - '' : this.getBaseUrl(); + '' : this.getBaseUrl(); return '//' + host + base + path; }, diff --git a/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content.js b/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content.js index f567d39372..482cacf11f 100644 --- a/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content.js +++ b/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content.js @@ -105,8 +105,8 @@ // TODO(wyatta) switch linkify sequence, see issue 5526. this._newContent = this.removeZeroWidthSpace ? - content.replace(/^R=\u200B/gm, 'R=') : - content; + content.replace(/^R=\u200B/gm, 'R=') : + content; }, _computeSaveDisabled(disabled, content, newContent) { diff --git a/polygerrit-ui/app/elements/shared/gr-event-interface/gr-event-interface_test.html b/polygerrit-ui/app/elements/shared/gr-event-interface/gr-event-interface_test.html index 137ed25042..643e9188d4 100644 --- a/polygerrit-ui/app/elements/shared/gr-event-interface/gr-event-interface_test.html +++ b/polygerrit-ui/app/elements/shared/gr-event-interface/gr-event-interface_test.html @@ -62,7 +62,7 @@ limitations under the License. p = plugin; Gerrit.emit(eventName, {value: 'test', plugin}); }, '0.1', - 'http://test.com/plugins/testplugin/static/test.js'); + 'http://test.com/plugins/testplugin/static/test.js'); }); test('listen on events from core', done => { @@ -83,19 +83,21 @@ limitations under the License. done(); }); }, '0.1', - 'http://test.com/plugins/testA/static/testA.js'); + 'http://test.com/plugins/testA/static/testA.js'); Gerrit.install(plugin => { Gerrit.emit(eventName, {plugin}); }, '0.1', - 'http://test.com/plugins/testB/static/testB.js'); + 'http://test.com/plugins/testB/static/testB.js'); }); }); suite('test on interfaces', () => { let testObj; + class TestClass extends EventEmitter { } + setup(() => { testObj = new TestClass(); }); diff --git a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard.js b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard.js index f9c1da161c..71621fab9e 100644 --- a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard.js +++ b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard.js @@ -136,8 +136,8 @@ target = Polymer.dom(ownerRoot).querySelector('#' + this.for); } else { target = parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE ? - ownerRoot.host : - parentNode; + ownerRoot.host : + parentNode; } return target; }, @@ -244,7 +244,7 @@ hovercardLeft = targetLeft + (targetRect.width - thisRect.width) / 2; hovercardTop = targetTop - thisRect.height - this.offset; cssText += `padding-bottom:${this.offset - }px; margin-bottom:-${this.offset}px;`; + }px; margin-bottom:-${this.offset}px;`; break; case 'bottom': hovercardLeft = targetLeft + (targetRect.width - thisRect.width) / 2; diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.js index 47281c28bb..b0ed5925b3 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.js @@ -124,7 +124,7 @@ GrAnnotationActionsInterface.prototype.getLayer = function( path, changeNum, patchNum) { const annotationLayer = new AnnotationLayer(path, changeNum, patchNum, - this._addLayerFunc); + this._addLayerFunc); this._annotationLayers.push(annotationLayer); return annotationLayer; }; diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface.js index 820d2c0afd..b5686bd04d 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface.js @@ -202,7 +202,7 @@ getDiffLayers(path, changeNum, patchNum) { const layers = []; for (const annotationApi of - this._getEventCallbacks(EventType.ANNOTATE_DIFF)) { + this._getEventCallbacks(EventType.ANNOTATE_DIFF)) { try { const layer = annotationApi.getLayer(path, changeNum, patchNum); layers.push(layer); @@ -216,7 +216,7 @@ getAdminMenuLinks() { const links = []; for (const adminApi of - this._getEventCallbacks(EventType.ADMIN_MENU_LINKS)) { + this._getEventCallbacks(EventType.ADMIN_MENU_LINKS)) { links.push(...adminApi.getMenuLinks()); } return links; diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.js index 9931f72ce6..f9eb128e82 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.js @@ -32,7 +32,7 @@ GrPluginEndpoints.prototype._getOrCreateModuleInfo = function(plugin, endpoint, type, moduleName, domHook) { const existingModule = this._endpoints[endpoint].find(info => - info.plugin === plugin && + info.plugin === plugin && info.moduleName === moduleName && info.domHook === domHook ); diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js index 1311105572..e980e0e7ad 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js @@ -192,7 +192,7 @@ Plugin.prototype.registerCustomComponent = function( endpointName, opt_moduleName, opt_options) { const type = opt_options && opt_options.replace ? - EndpointType.REPLACE : EndpointType.DECORATE; + EndpointType.REPLACE : EndpointType.DECORATE; const hook = this._domHooks.getDomHook(endpointName, opt_moduleName); const moduleName = opt_moduleName || hook.getModuleName(); Gerrit._endpoints.registerModule( @@ -258,14 +258,14 @@ Plugin.prototype.changeActions = function() { return new GrChangeActionsInterface(this, - Plugin._sharedAPIElement.getElement( - Plugin._sharedAPIElement.Element.CHANGE_ACTIONS)); + Plugin._sharedAPIElement.getElement( + Plugin._sharedAPIElement.Element.CHANGE_ACTIONS)); }; Plugin.prototype.changeReply = function() { return new GrChangeReplyInterface(this, - Plugin._sharedAPIElement.getElement( - Plugin._sharedAPIElement.Element.REPLY_DIALOG)); + Plugin._sharedAPIElement.getElement( + Plugin._sharedAPIElement.Element.REPLY_DIALOG)); }; Plugin.prototype.changeView = function() { diff --git a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.js b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.js index 40edc28015..202000835b 100644 --- a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.js +++ b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.js @@ -125,14 +125,14 @@ const accountID = parseInt(target.getAttribute('data-account-id'), 10); this._xhrPromise = this.$.restAPI.deleteVote(this.change._number, accountID, this.label) - .then(response => { - target.disabled = false; - if (!response.ok) { return; } - Gerrit.Nav.navigateToChange(this.change); - }).catch(err => { - target.disabled = false; - return; - }); + .then(response => { + target.disabled = false; + if (!response.ok) { return; } + Gerrit.Nav.navigateToChange(this.change); + }).catch(err => { + target.disabled = false; + return; + }); }, _computeValueTooltip(labelInfo, score) { diff --git a/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav.js b/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav.js index 9ccff600f9..2e056075c5 100644 --- a/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav.js +++ b/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav.js @@ -36,8 +36,8 @@ if (this._headerHeight === undefined) { let top = this._getOffsetTop(this); for (let offsetParent = this.offsetParent; - offsetParent; - offsetParent = this._getOffsetParent(offsetParent)) { + offsetParent; + offsetParent = this._getOffsetParent(offsetParent)) { top += this._getOffsetTop(offsetParent); } this._headerHeight = top; diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-auth.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-auth.js index 43e39223ae..2ff5f85e69 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-auth.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-auth.js @@ -146,7 +146,7 @@ params.push(`access_token=${accessToken}`); const baseUrl = Gerrit.BaseUrlBehavior.getBaseUrl(); const pathname = baseUrl ? - url.substring(url.indexOf(baseUrl) + baseUrl.length) : url; + url.substring(url.indexOf(baseUrl) + baseUrl.length) : url; if (!pathname.startsWith('/a/')) { url = url.replace(pathname, '/a' + pathname); } diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-auth_test.html b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-auth_test.html index a571be929f..f20359466e 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-auth_test.html +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-auth_test.html @@ -109,8 +109,8 @@ limitations under the License. test('getToken calls are cached', () => { return Promise.all([ auth.fetch('/url-one'), auth.fetch('/url-two')]).then(() => { - assert.equal(getToken.callCount, 1); - }); + assert.equal(getToken.callCount, 1); + }); }); test('getToken refreshes token', () => { diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js index 79e3fa8df5..6ab484845e 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js @@ -278,7 +278,7 @@ */ _logCall(req, startTime, status) { const method = (req.fetchOptions && req.fetchOptions.method) ? - req.fetchOptions.method : 'GET'; + req.fetchOptions.method : 'GET'; const elapsed = (Date.now() - startTime); console.log([ 'HTTP', @@ -1149,7 +1149,7 @@ return Promise.resolve({ changes_per_page: 25, default_diff_view: this._isNarrowScreen() ? - DiffViewMode.UNIFIED : DiffViewMode.SIDE_BY_SIDE, + DiffViewMode.UNIFIED : DiffViewMode.SIDE_BY_SIDE, diff_view: 'SIDE_BY_SIDE', size_bar_in_change_table: true, }); @@ -1391,8 +1391,8 @@ } const payloadPromise = response ? - this._readResponsePayload(response) : - Promise.resolve(null); + this._readResponsePayload(response) : + Promise.resolve(null); return payloadPromise.then(payload => { if (!payload) { return null; } @@ -1480,7 +1480,7 @@ getChangeOrEditFiles(changeNum, patchRange) { if (this.patchNumEquals(patchRange.patchNum, this.EDIT_NAME)) { return this.getChangeEditFiles(changeNum, patchRange).then(res => - res.files); + res.files); } return this.getChangeFiles(changeNum, patchRange); }, @@ -2013,8 +2013,8 @@ return res; }; const promise = this.patchNumEquals(patchNum, this.EDIT_NAME) ? - this._getFileInChangeEdit(changeNum, path) : - this._getFileInRevision(changeNum, path, patchNum, suppress404s); + this._getFileInChangeEdit(changeNum, path) : + this._getFileInRevision(changeNum, path, patchNum, suppress404s); return promise.then(res => { if (!res.ok) { return res; } @@ -2185,7 +2185,7 @@ options.headers.set( 'Content-Type', req.contentType || 'application/json'); options.body = typeof req.body === 'string' ? - req.body : JSON.stringify(req.body); + req.body : JSON.stringify(req.body); } if (req.headers) { if (!options.headers) { options.headers = new Headers(); } @@ -2195,7 +2195,7 @@ } } const url = req.url.startsWith('http') ? - req.url : this.getBaseUrl() + req.url; + req.url : this.getBaseUrl() + req.url; const fetchReq = { url, fetchOptions: options, @@ -2531,7 +2531,7 @@ */ getB64FileContents(changeId, patchNum, path, opt_parentIndex) { const parent = typeof opt_parentIndex === 'number' ? - '?parent=' + opt_parentIndex : ''; + '?parent=' + opt_parentIndex : ''; return this._changeBaseURL(changeId, patchNum).then(url => { url = `${url}/files/${encodeURIComponent(path)}/content${parent}`; return this._fetchB64File(url); @@ -2590,8 +2590,8 @@ // TODO(kaspern): For full slicer migration, app should warn with a call // stack every time _changeBaseURL is called without a project. const projectPromise = opt_project ? - Promise.resolve(opt_project) : - this.getFromProjectLookup(changeNum); + Promise.resolve(opt_project) : + this.getFromProjectLookup(changeNum); return projectPromise.then(project => { let url = `/changes/${encodeURIComponent(project)}~${changeNum}`; if (opt_patchNum) { @@ -2923,9 +2923,9 @@ */ _getChangeURLAndSend(req) { const anonymizedBaseUrl = req.patchNum ? - ANONYMIZED_REVISION_BASE_URL : ANONYMIZED_CHANGE_BASE_URL; + ANONYMIZED_REVISION_BASE_URL : ANONYMIZED_CHANGE_BASE_URL; const anonymizedEndpoint = req.reportEndpointAsIs ? - req.endpoint : req.anonymizedEndpoint; + req.endpoint : req.anonymizedEndpoint; return this._changeBaseURL(req.changeNum, req.patchNum).then(url => { return this._send({ @@ -2937,7 +2937,7 @@ headers: req.headers, parseResponse: req.parseResponse, anonymizedUrl: anonymizedEndpoint ? - (anonymizedBaseUrl + anonymizedEndpoint) : undefined, + (anonymizedBaseUrl + anonymizedEndpoint) : undefined, }); }); }, @@ -2949,9 +2949,9 @@ */ _getChangeURLAndFetch(req) { const anonymizedEndpoint = req.reportEndpointAsIs ? - req.endpoint : req.anonymizedEndpoint; + req.endpoint : req.anonymizedEndpoint; const anonymizedBaseUrl = req.patchNum ? - ANONYMIZED_REVISION_BASE_URL : ANONYMIZED_CHANGE_BASE_URL; + ANONYMIZED_REVISION_BASE_URL : ANONYMIZED_CHANGE_BASE_URL; return this._changeBaseURL(req.changeNum, req.patchNum).then(url => { return this._fetchJSON({ url: url + req.endpoint, @@ -2959,7 +2959,7 @@ params: req.params, fetchOptions: req.fetchOptions, anonymizedUrl: anonymizedEndpoint ? - (anonymizedBaseUrl + anonymizedEndpoint) : undefined, + (anonymizedBaseUrl + anonymizedEndpoint) : undefined, }); }); }, diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.js index 24519819c2..a8d8351df4 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.js @@ -204,7 +204,7 @@ messages.forEach((message, index) => { const messageDate = util.parseDate(message.date).getTime(); const nextMessageDate = index === messages.length - 1 ? null : - util.parseDate(messages[index + 1].date).getTime(); + util.parseDate(messages[index + 1].date).getTime(); for (const update of updates) { const date = util.parseDate(update.date).getTime(); if (date >= messageDate @@ -212,7 +212,7 @@ const timestamp = util.parseDate(update.date).getTime() - GrReviewerUpdatesParser.MESSAGE_REVIEWERS_THRESHOLD_MILLIS; update.date = new Date(timestamp) - .toISOString().replace('T', ' ').replace('Z', '000000'); + .toISOString().replace('T', ' ').replace('Z', '000000'); } if (nextMessageDate && date > nextMessageDate) { break; diff --git a/polygerrit-ui/app/elements/shared/gr-storage/gr-storage.js b/polygerrit-ui/app/elements/shared/gr-storage/gr-storage.js index c425609e02..6d82dad9b4 100644 --- a/polygerrit-ui/app/elements/shared/gr-storage/gr-storage.js +++ b/polygerrit-ui/app/elements/shared/gr-storage/gr-storage.js @@ -85,9 +85,9 @@ _getDraftKey(location) { const range = location.range ? - `${location.range.start_line}-${location.range.start_character}` + + `${location.range.start_line}-${location.range.start_character}` + `-${location.range.end_character}-${location.range.end_line}` : - null; + null; let key = ['draft', location.changeNum, location.patchNum, location.path, location.line || ''].join(':'); if (range) { diff --git a/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.html b/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.html index 3a5254304a..f010fb3234 100644 --- a/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.html +++ b/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.html @@ -132,16 +132,16 @@ limitations under the License. assert.isTrue(formatSpy.called); assert.isTrue(formatSpy.lastCall.calledWithExactly( [{dataValue: '😢', value: '😢', match: 'tear', text: '😢 tear'}, - {dataValue: '😂', value: '😂', match: 'tears', text: '😂 tears'}])); + {dataValue: '😂', value: '😂', match: 'tears', text: '😂 tears'}])); }); test('_formatSuggestions', () => { const matchedSuggestions = [{value: '😢', match: 'tear'}, - {value: '😂', match: 'tears'}]; + {value: '😂', match: 'tears'}]; element._formatSuggestions(matchedSuggestions); assert.deepEqual( [{value: '😢', dataValue: '😢', match: 'tear', text: '😢 tear'}, - {value: '😂', dataValue: '😂', match: 'tears', text: '😂 tears'}], + {value: '😂', dataValue: '😂', match: 'tears', text: '😂 tears'}], element._suggestions); }); diff --git a/polygerrit-ui/app/elements/shared/revision-info/revision-info.html b/polygerrit-ui/app/elements/shared/revision-info/revision-info.html index 91f87d0e43..5cb56a7cd2 100644 --- a/polygerrit-ui/app/elements/shared/revision-info/revision-info.html +++ b/polygerrit-ui/app/elements/shared/revision-info/revision-info.html @@ -68,7 +68,7 @@ limitations under the License. */ RevisionInfo.prototype.getParentId = function(patchNum, parentIndex) { const rev = Object.values(this._change.revisions).find(rev => - Gerrit.PatchSetBehavior.patchNumEquals(rev._number, patchNum)); + Gerrit.PatchSetBehavior.patchNumEquals(rev._number, patchNum)); return rev.commit.parents[parentIndex].commit; }; diff --git a/polygerrit-ui/app/samples/coverage-plugin.html b/polygerrit-ui/app/samples/coverage-plugin.html index 9bec658708..b29823792d 100644 --- a/polygerrit-ui/app/samples/coverage-plugin.html +++ b/polygerrit-ui/app/samples/coverage-plugin.html @@ -34,16 +34,16 @@ const annotationApi = plugin.annotationApi(); annotationApi.addLayer(context => { if (Object.keys(coverageData).length === 0) { - // Coverage data is not ready yet. + // Coverage data is not ready yet. return; } const path = context.path; const line = context.line; - // Highlight lines missing coverage with this background color if - // coverage should be displayed, else do nothing. + // Highlight lines missing coverage with this background color if + // coverage should be displayed, else do nothing. const cssClass = displayCoverage - ? Gerrit.css('background-color: #EF9B9B') - : Gerrit.css(''); + ? Gerrit.css('background-color: #EF9B9B') + : Gerrit.css(''); if (coverageData[path] && coverageData[path].changeNum === context.changeNum && coverageData[path].patchNum === context.patchNum) { From a68dbd29cbf29a42f2883c317a3037bdc8e38d09 Mon Sep 17 00:00:00 2001 From: Tao Zhou Date: Wed, 4 Dec 2019 15:11:48 +0100 Subject: [PATCH 07/15] Downport "Remove `|| exit 0` as eslint already supported correct exit code" https://eslint.org/docs/user-guide/command-line-interface#exit-codes Change-Id: I64168fe7e94956e6926f95f2f185d6ad55e98002 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8fb3d3d8cc..c931f5530c 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "scripts": { "start": "polygerrit-ui/run-server.sh", "test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh", - "eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0", - "eslintfix": "./node_modules/eslint/bin/eslint.js --fix --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app || exit 0", + "eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app", + "eslintfix": "npm run eslint -- --fix", "test-template": "./polygerrit-ui/app/run_template_test.sh", "polylint": "bazel test polygerrit-ui/app:polylint_test" }, From 3445b3d2c4346a9c1cbc87d1a5ce2e953c012e82 Mon Sep 17 00:00:00 2001 From: Tao Zhou Date: Wed, 11 Dec 2019 15:25:26 +0100 Subject: [PATCH 08/15] Downport "Add a shared pre-commit to run eslintfix for frontend code changes" This pre-commit hook will fail the commit when you have linter errors. It will also only run on changed staged files. Also cleaned up linter config in package and lint_test. Change-Id: I70d906b5c5c0180d88e0d0ff9840387e9f013fe2 --- package.json | 2 +- polygerrit-ui/app/lint_test.sh | 2 +- tools/dev-hooks/pre-commit | 47 ++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100755 tools/dev-hooks/pre-commit diff --git a/package.json b/package.json index c931f5530c..73763a122b 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "scripts": { "start": "polygerrit-ui/run-server.sh", "test": "WCT_HEADLESS_MODE=1 WCT_ARGS='--verbose -l chrome' ./polygerrit-ui/app/run_test.sh", - "eslint": "./node_modules/eslint/bin/eslint.js --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js polygerrit-ui/app", + "eslint": "./node_modules/eslint/bin/eslint.js --ext .html,.js polygerrit-ui/app", "eslintfix": "npm run eslint -- --fix", "test-template": "./polygerrit-ui/app/run_template_test.sh", "polylint": "bazel test polygerrit-ui/app:polylint_test" diff --git a/polygerrit-ui/app/lint_test.sh b/polygerrit-ui/app/lint_test.sh index fce5fdd525..0fd95df399 100755 --- a/polygerrit-ui/app/lint_test.sh +++ b/polygerrit-ui/app/lint_test.sh @@ -30,4 +30,4 @@ cd ${UI_PATH} # eslint installation. npm link eslint eslint-config-google eslint-plugin-html -${eslint_bin} -c ${UI_PATH}/.eslintrc.json --ignore-pattern 'node_modules/' --ignore-pattern 'bower_components/' --ignore-pattern 'gr-linked-text' --ignore-pattern 'scripts/vendor' --ext .html,.js ${UI_PATH} +${eslint_bin} -c ${UI_PATH}/.eslintrc.json --ext .html,.js ${UI_PATH} diff --git a/tools/dev-hooks/pre-commit b/tools/dev-hooks/pre-commit new file mode 100755 index 0000000000..b77f38279f --- /dev/null +++ b/tools/dev-hooks/pre-commit @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Part of Gerrit Code Review (https://www.gerritcodereview.com/) +# +# Copyright (C) 2019 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# To enable this hook: +# - copy this file or content to ".git/hooks/pre-commit" +# - (optional if you copied this file) make it executable: `chmod +x .git/hooks/pre-commit` + +set -ue + +# gitroot, default to . +gitroot=$(git rev-parse --show-cdup) +gitroot=${gitroot:-.}; + +# eslint +eslint=${gitroot}/node_modules/eslint/bin/eslint.js + +# Run eslint over changed frontend code +CHANGED_UI_FILES=$(git diff --cached --name-only -- '*.js' '*.html' | grep 'polygerrit-ui') && true +if [ "${CHANGED_UI_FILES}" ]; then + if $eslint --fix ${CHANGED_UI_FILES}; then + # Add again in case lint fix modified some files + git add ${CHANGED_UI_FILES} + exit 0 + else + echo "Failed to fix all linter issues."; + exit 1 + fi +else + echo "No UI files changed" + exit 0 +fi \ No newline at end of file From 25673abbae908f96255067d50f6aa036be165b24 Mon Sep 17 00:00:00 2001 From: Tao Zhou Date: Tue, 17 Dec 2019 09:59:28 +0100 Subject: [PATCH 09/15] Downport "Replace deprecated `require-jsdoc`, `valid-jsdoc` with jsdoc plugin for eslint" Enabled and fixed for `check-alignment`, `implements-on-classes`, `newline-after-description`, `require-param-name`, `require-param-type`, `require-returns-type` and `valid-types`. Change-Id: I493b498d81d5f8d908bb45de37de9c9ef956f7d8 --- package.json | 1 + polygerrit-ui/app/.eslintrc.json | 34 +++++++++++++++++-- .../docs-url-behavior/docs-url-behavior.html | 1 + .../dom-util-behavior/dom-util-behavior.html | 1 + .../gr-change-table-behavior.html | 2 ++ .../gr-patch-set-behavior.html | 2 ++ .../gr-url-encoding-behavior.html | 2 ++ .../safe-types-behavior.html | 2 ++ .../gr-access-section/gr-access-section.js | 1 + .../gr-admin-group-list.js | 1 + .../admin/gr-permission/gr-permission.js | 1 + .../admin/gr-repo-access/gr-repo-access.js | 1 + .../admin/gr-repo-list/gr-repo-list.js | 1 + .../admin/gr-rule-editor/gr-rule-editor.js | 1 + .../gr-change-list-view.js | 1 + .../change/gr-account-list/gr-account-list.js | 1 + .../gr-change-actions/gr-change-actions.js | 8 +++-- .../gr-change-metadata/gr-change-metadata.js | 1 + .../change/gr-change-view/gr-change-view.js | 2 ++ .../gr-file-list-header.js | 1 + .../change/gr-file-list/gr-file-list.js | 15 ++++++++ .../gr-messages-list/gr-messages-list.js | 1 + .../gr-related-changes-list.js | 3 ++ .../change/gr-reply-dialog/gr-reply-dialog.js | 9 ++--- .../gr-reviewer-list/gr-reviewer-list.js | 2 ++ .../change/gr-thread-list/gr-thread-list.js | 1 + .../core/gr-navigation/gr-navigation.html | 6 ++++ .../core/gr-reporting/gr-reporting.js | 6 ++++ .../app/elements/core/gr-router/gr-router.js | 6 ++++ .../core/gr-search-bar/gr-search-bar.js | 2 ++ .../core/gr-smart-search/gr-smart-search.js | 3 ++ .../diff/gr-comment-api/gr-comment-api.js | 15 ++++---- .../diff/gr-diff-builder/gr-diff-builder.html | 2 ++ .../diff/gr-diff-builder/gr-diff-builder.js | 9 +++++ .../gr-diff-comment-thread.js | 1 + .../diff/gr-diff-cursor/gr-diff-cursor.js | 5 ++- .../diff/gr-diff-highlight/gr-annotation.js | 1 + .../gr-diff-highlight/gr-diff-highlight.js | 2 ++ .../gr-diff-highlight/gr-range-normalizer.js | 1 + .../diff/gr-diff-host/gr-diff-host.js | 4 +++ .../gr-diff-processor/gr-diff-processor.js | 6 ++++ .../gr-diff-selection/gr-diff-selection.js | 1 + .../app/elements/diff/gr-diff/gr-diff.js | 14 +++++--- .../gr-patch-range-select.js | 1 + .../gr-ranged-comment-layer.js | 5 +++ .../diff/gr-syntax-layer/gr-syntax-layer.js | 6 ++++ .../edit/gr-edit-controls/gr-edit-controls.js | 2 ++ polygerrit-ui/app/elements/gr-app.js | 1 + .../gr-attribute-helper.js | 1 + .../plugins/gr-dom-hooks/gr-dom-hooks.js | 2 ++ .../gr-endpoint-decorator.js | 1 + .../gr-event-helper/gr-event-helper.js | 3 ++ .../gr-popup-interface/gr-popup-interface.js | 2 ++ .../gr-change-table-editor.js | 1 + .../shared/gr-autocomplete/gr-autocomplete.js | 1 + .../gr-cursor-manager/gr-cursor-manager.js | 12 +++++-- .../gr-dropdown-list/gr-dropdown-list.js | 2 ++ .../shared/gr-dropdown/gr-dropdown.js | 13 +++++++ .../gr-event-interface/gr-event-interface.js | 1 + .../gr-formatted-text/gr-formatted-text.js | 1 + .../gr-annotation-actions-context.js | 2 ++ .../gr-annotation-actions-js-api.js | 8 +++++ .../gr-change-actions-js-api.js | 2 ++ .../gr-change-reply-js-api.js | 1 + .../gr-plugin-endpoints.js | 3 ++ .../gr-js-api-interface/gr-plugin-rest-api.js | 2 ++ .../gr-js-api-interface/gr-public-js-api.js | 2 ++ .../shared/gr-lib-loader/gr-lib-loader.js | 5 +++ .../shared/gr-linked-text/gr-linked-text.js | 2 ++ .../shared/gr-linked-text/link-text-parser.js | 12 +++++++ .../gr-etag-decorator.js | 2 ++ .../gr-rest-api-interface.js | 18 ++++++++++ .../gr-reviewer-updates-parser.js | 5 +++ .../shared/revision-info/revision-info.html | 3 ++ polygerrit-ui/app/lint_test.sh | 2 +- 75 files changed, 278 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 73763a122b..08ffc5598d 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "eslint": "^6.6.0", "eslint-config-google": "^0.13.0", "eslint-plugin-html": "^6.0.0", + "eslint-plugin-jsdoc": "^18.4.3", "fried-twinkie": "^0.2.2", "polylint": "^2.10.4", "typescript": "^2.x.x", diff --git a/polygerrit-ui/app/.eslintrc.json b/polygerrit-ui/app/.eslintrc.json index 17b7c5fca2..c481fd01ba 100644 --- a/polygerrit-ui/app/.eslintrc.json +++ b/polygerrit-ui/app/.eslintrc.json @@ -88,13 +88,41 @@ "prefer-promise-reject-errors": "off", "prefer-spread": "error", "quote-props": ["error", "consistent-as-needed"], - "require-jsdoc": "off", "semi": [2, "always"], "template-curly-spacing": "error", - "valid-jsdoc": "off" + + "require-jsdoc": 0, + "valid-jsdoc": 0, + "jsdoc/check-alignment": 2, + "jsdoc/check-examples": 0, + "jsdoc/check-indentation": 0, + "jsdoc/check-param-names": 0, + "jsdoc/check-syntax": 0, + "jsdoc/check-tag-names": 0, + "jsdoc/check-types": 0, + "jsdoc/implements-on-classes": 2, + "jsdoc/match-description": 0, + "jsdoc/newline-after-description": 2, + "jsdoc/no-types": 0, + "jsdoc/no-undefined-types": 0, + "jsdoc/require-description": 0, + "jsdoc/require-description-complete-sentence": 0, + "jsdoc/require-example": 0, + "jsdoc/require-hyphen-before-param-description": 0, + "jsdoc/require-jsdoc": 0, + "jsdoc/require-param": 0, + "jsdoc/require-param-description": 0, + "jsdoc/require-param-name": 2, + "jsdoc/require-param-type": 2, + "jsdoc/require-returns": 0, + "jsdoc/require-returns-check": 0, + "jsdoc/require-returns-description": 0, + "jsdoc/require-returns-type": 2, + "jsdoc/valid-types": 2 }, "plugins": [ - "html" + "html", + "jsdoc" ], "settings": { "html/report-bad-indent": "error" diff --git a/polygerrit-ui/app/behaviors/docs-url-behavior/docs-url-behavior.html b/polygerrit-ui/app/behaviors/docs-url-behavior/docs-url-behavior.html index 4e2553050f..f07a9557dd 100644 --- a/polygerrit-ui/app/behaviors/docs-url-behavior/docs-url-behavior.html +++ b/polygerrit-ui/app/behaviors/docs-url-behavior/docs-url-behavior.html @@ -31,6 +31,7 @@ limitations under the License. /** * Get the docs base URL from either the server config or by probing. + * * @param {Object} config The server config. * @param {!Object} restApi A REST API instance * @return {!Promise} A promise that resolves with the docs base diff --git a/polygerrit-ui/app/behaviors/dom-util-behavior/dom-util-behavior.html b/polygerrit-ui/app/behaviors/dom-util-behavior/dom-util-behavior.html index 2d25b291c7..e0a15cf8ff 100644 --- a/polygerrit-ui/app/behaviors/dom-util-behavior/dom-util-behavior.html +++ b/polygerrit-ui/app/behaviors/dom-util-behavior/dom-util-behavior.html @@ -25,6 +25,7 @@ limitations under the License. /** * Are any ancestors of the element (or the element itself) members of the * given class. + * * @param {!Element} element * @param {string} className * @param {Element=} opt_stopElement If provided, stop traversing the diff --git a/polygerrit-ui/app/behaviors/gr-change-table-behavior/gr-change-table-behavior.html b/polygerrit-ui/app/behaviors/gr-change-table-behavior/gr-change-table-behavior.html index c462c6fa3e..f81fef0712 100644 --- a/polygerrit-ui/app/behaviors/gr-change-table-behavior/gr-change-table-behavior.html +++ b/polygerrit-ui/app/behaviors/gr-change-table-behavior/gr-change-table-behavior.html @@ -41,6 +41,7 @@ limitations under the License. /** * Returns the complement to the given column array + * * @param {Array} columns * @return {!Array} */ @@ -63,6 +64,7 @@ limitations under the License. * The Project column was renamed to Repo, but some users may have * preferences that use its old name. If that column is found, rename it * before use. + * * @param {!Array} columns * @return {!Array} If the column was renamed, returns a new array * with the corrected name. Otherwise, it returns the original param. diff --git a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html index b819ad6106..31a51a9966 100644 --- a/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html +++ b/polygerrit-ui/app/behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html @@ -52,6 +52,7 @@ limitations under the License. /** * Whether the given patch is a numbered parent of a merge (i.e. a negative * number). + * * @param {string|number} n * @return {Boolean} */ @@ -264,6 +265,7 @@ limitations under the License. /** * Convert parent indexes from patch range expressions to numbers. * For example, in a patch range expression `"-3"` becomes `3`. + * * @param {number|string} rangeBase * @return {number} */ diff --git a/polygerrit-ui/app/behaviors/gr-url-encoding-behavior/gr-url-encoding-behavior.html b/polygerrit-ui/app/behaviors/gr-url-encoding-behavior/gr-url-encoding-behavior.html index 69703f6302..64274d26ea 100644 --- a/polygerrit-ui/app/behaviors/gr-url-encoding-behavior/gr-url-encoding-behavior.html +++ b/polygerrit-ui/app/behaviors/gr-url-encoding-behavior/gr-url-encoding-behavior.html @@ -25,6 +25,7 @@ limitations under the License. /** * Pretty-encodes a URL. Double-encodes the string, and then replaces * benevolent characters for legibility. + * * @param {string} url * @param {boolean=} replaceSlashes * @return {string} @@ -45,6 +46,7 @@ limitations under the License. * Single decode for URL components. Will decode plus signs ('+') to spaces. * Note: because this function decodes once, it is not the inverse of * encodeURL. + * * @param {string} url * @return {string} */ diff --git a/polygerrit-ui/app/behaviors/safe-types-behavior/safe-types-behavior.html b/polygerrit-ui/app/behaviors/safe-types-behavior/safe-types-behavior.html index 43022d9b42..8f08f0caba 100644 --- a/polygerrit-ui/app/behaviors/safe-types-behavior/safe-types-behavior.html +++ b/polygerrit-ui/app/behaviors/safe-types-behavior/safe-types-behavior.html @@ -28,6 +28,7 @@ limitations under the License. /** * Wraps a string to be used as a URL. An error is thrown if the string cannot * be considered safe. + * * @constructor * @param {string} url the unwrapped, potentially unsafe URL. */ @@ -40,6 +41,7 @@ limitations under the License. /** * Get the string representation of the safe URL. + * * @returns {string} */ Gerrit.SafeTypes.SafeUrl.prototype.asString = function() { diff --git a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js index 6fb7b0e018..409fab43b1 100644 --- a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js +++ b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js @@ -25,6 +25,7 @@ /** * Fired when a section that was previously added was removed. + * * @event added-section-removed */ diff --git a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js index f1e1d54404..f1c27af6a5 100644 --- a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js +++ b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js @@ -87,6 +87,7 @@ /** * Opens the create overlay if the route has a hash 'create' + * * @param {!Object} params */ _maybeOpenCreateOverlay(params) { diff --git a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js index fc65fd8f81..633a1db226 100644 --- a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js +++ b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js @@ -32,6 +32,7 @@ /** * Fired when a permission that was previously added was removed. + * * @event added-permission-removed */ diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js index e9b13cdcb3..f7ddb23289 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js +++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js @@ -345,6 +345,7 @@ /** * As add / delete both can happen in the new section, * so here to make sure it will remove the deleted ones. + * * @see Issue 11339 */ this._recursivelyRemoveDeleted(addRemoveObj.add[k]); diff --git a/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list.js b/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list.js index e0b054bd98..0eaa496c08 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list.js +++ b/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list.js @@ -90,6 +90,7 @@ /** * Opens the create overlay if the route has a hash 'create' + * * @param {!Object} params */ _maybeOpenCreateOverlay(params) { diff --git a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor.js b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor.js index 06f703f34b..a5dc04e49c 100644 --- a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor.js +++ b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor.js @@ -25,6 +25,7 @@ /** * Fired when a rule that was previously added was removed. + * * @event added-rule-removed */ diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.js b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.js index d5ae7c107e..64cedf308b 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.js +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.js @@ -70,6 +70,7 @@ * * Need sub-property declaration since it is used in template before * assignment. + * * @type {{ selectedChangeIndex: (number|undefined) }} * */ diff --git a/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js b/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js index b568437505..458719a881 100644 --- a/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js +++ b/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js @@ -39,6 +39,7 @@ placeholder: String, /** * Needed for template checking since value is initially set to null. + * * @type {?Object} */ pendingConfirmation: { type: Object, diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js index af811f5248..60177d1588 100644 --- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js +++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js @@ -203,7 +203,7 @@ /** * Fired when an action is tapped. * - * @event -tap + * @event custom-tap - naming pattern: -tap */ /** @@ -569,8 +569,8 @@ }, /** - * @param {string=} actionName - */ + * @param {string=} actionName + */ _deleteAndNotify(actionName) { if (this.actions[actionName]) { delete this.actions[actionName]; @@ -800,6 +800,7 @@ /** * Capitalize the first letter and lowecase all others. + * * @param {string} s * @return {string} */ @@ -1295,6 +1296,7 @@ /** * Merge sources of change actions into a single ordered array of action * values. + * * @param {!Array} changeActionsRecord * @param {!Array} revisionActionsRecord * @param {!Array} primariesRecord diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js index dfc4ecf00d..a540665e30 100644 --- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js +++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js @@ -410,6 +410,7 @@ /** * Get the user with the specified role on the change. Returns null if the * user with that role is the same as the owner. + * * @param {!Object} change * @param {string} role One of the values from _CHANGE_ROLE * @return {Object|null} either an accound or null. diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js index aa2e135a4c..ea54239714 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.js @@ -810,6 +810,7 @@ /** * Gets base patch number, if it is a parent try and decide from * preference weather to default to `auto merge`, `Parent 1` or `PARENT`. + * * @param {Object} change * @param {Object} patchRange * @return {number|string} @@ -1282,6 +1283,7 @@ /** * Reload the change. + * * @param {boolean=} opt_reloadRelatedChanges Reloads the related chanegs * when true. * @return {Promise} A promise that resolves when the core data has loaded. diff --git a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.js b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.js index 94484adb5b..da8384ffb8 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.js +++ b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header.js @@ -160,6 +160,7 @@ /** * Update the patchset description with the rest API. + * * @param {string} desc * @param {?(Event|Node)} e * @return {!Promise} diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js index 891033280e..0f2b37ec8a 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js @@ -498,6 +498,7 @@ /** * The closure compiler doesn't realize this.specialFilePathCompare is * valid. + * * @suppress {checkTypes} */ _normalizeChangeFilesResponse(response) { @@ -906,6 +907,7 @@ /** * Get a descriptive label for use in the status indicator's tooltip and * ARIA label. + * * @param {string} status * @return {string} */ @@ -938,6 +940,7 @@ * entries in the expanded list, then render each diff corresponding in * order by waiting for the previous diff to finish before starting the next * one. + * * @param {!Array} record The splice record in the expanded paths list. */ _expandedPathsChanged(record) { @@ -982,6 +985,7 @@ * Given an array of paths and a NodeList of diff elements, render the diff * for each path in order, awaiting the previous render to complete before * continung. + * * @param {!Array} paths * @param {!NodeList} diffElements (GrDiffHostElement) * @param {number} initialCount The total number of paths in the pass. This @@ -1027,6 +1031,7 @@ /** * In the given NodeList of diff elements, find the diff for the given path. + * * @param {string} path * @param {!NodeList} diffElements (GrDiffElement) * @return {!Object|undefined} (GrDiffElement) @@ -1041,6 +1046,7 @@ /** * Reset the comments of a modified thread + * * @param {string} rootId * @param {string} path */ @@ -1087,6 +1093,7 @@ * Update the loading class for the file list rows. The update is inside a * debouncer so that the file list doesn't flash gray when the API requests * are reasonably fast. + * * @param {boolean} loading */ _loadingChanged(loading) { @@ -1112,6 +1119,7 @@ /** * Given a file path, return whether that path should have visible size bars * and be included in the size bars calculation. + * * @param {string} path * @return {boolean} */ @@ -1121,6 +1129,7 @@ /** * Compute size bar layout values from the file list. + * * @return {Defs.LayoutStats|undefined} */ _computeSizeBarLayout(shownFilesRecord) { @@ -1155,6 +1164,7 @@ /** * Get the width of the addition bar for a file. + * * @param {Object} file * @param {Defs.LayoutStats} stats * @return {number} @@ -1172,6 +1182,7 @@ /** * Get the x-offset of the addition bar for a file. + * * @param {Object} file * @param {Defs.LayoutStats} stats * @return {number} @@ -1183,6 +1194,7 @@ /** * Get the width of the deletion bar for a file. + * * @param {Object} file * @param {Defs.LayoutStats} stats * @return {number} @@ -1200,6 +1212,7 @@ /** * Get the x-offset of the deletion bar for a file. + * * @param {Defs.LayoutStats} stats * @return {number} */ @@ -1223,6 +1236,7 @@ /** * Returns true if none of the inline diffs have been expanded. + * * @return {boolean} */ _noDiffsExpanded() { @@ -1233,6 +1247,7 @@ * Method to call via binding when each file list row is rendered. This * allows approximate detection of when the dom-repeat has completed * rendering. + * * @param {number} index The index of the row being rendered. * @return {string} an empty string. */ diff --git a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js index 1a6a243739..6d8bb453db 100644 --- a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js +++ b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list.js @@ -206,6 +206,7 @@ * Computes message author's file comments for change's message. * Method uses this.messages to find next message and relies on messages * to be sorted by date field descending. + * * @param {!Object} changeComments changeComment object, which includes * a method to get all published comments (including robot comments), * which returns a Hash of arrays of comments, filename as key. diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js index 6fe066f766..7f4d782147 100644 --- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js +++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.js @@ -157,6 +157,7 @@ * Determines whether or not the given change has a parent change. If there * is a relation chain, and the change id is not the last item of the * relation chain, there is a parent. + * * @param {number} currentChangeId * @param {!Array} relatedChanges * @return {boolean} @@ -215,6 +216,7 @@ /** * Do the given objects describe the same change? Compares the changes by * their numbers. + * * @see /Documentation/rest-api-changes.html#change-info * @see /Documentation/rest-api-changes.html#related-change-and-commit-info * @param {!Object} a Either ChangeInfo or RelatedChangeAndCommitInfo @@ -232,6 +234,7 @@ * SubmittedTogetherInfo responses) or get the change number from a * RelatedChangeAndCommitInfo (such as those included in a * RelatedChangesInfo response). + * * @see /Documentation/rest-api-changes.html#change-info * @see /Documentation/rest-api-changes.html#related-change-and-commit-info * diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js index 3d2aa74f0a..40a0922779 100644 --- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js +++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.js @@ -92,10 +92,10 @@ */ /** - * Fires when the state of the send button (enabled/disabled) changes. - * - * @event send-disabled-changed - */ + * Fires when the state of the send button (enabled/disabled) changes. + * + * @event send-disabled-changed + */ properties: { /** @@ -677,6 +677,7 @@ * Generates a function to filter out reviewer/CC entries. When isCCs is * truthy, the function filters out entries that already exist in this._ccs. * When falsy, the function filters entries that exist in this._reviewers. + * * @param {boolean} isCCs * @return {!Function} */ diff --git a/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list.js b/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list.js index ab1f55e0e0..ab677041d7 100644 --- a/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list.js +++ b/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list.js @@ -101,6 +101,7 @@ /** * Returns hash of labels to max permitted score. + * * @param {!Object} change * @returns {!Object} labels to max permitted scores hash */ @@ -115,6 +116,7 @@ /** * Returns max permitted score for reviewer. + * * @param {!Object} reviewer * @param {!Object} change * @param {string} label diff --git a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.js b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.js index e171472b98..dd6db8cb9b 100644 --- a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.js +++ b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list.js @@ -62,6 +62,7 @@ * - Unresolved threads without drafts (reverse chronological) * - Resolved threads with drafts (reverse chronological) * - Resolved threads without drafts (reverse chronological) + * * @param {!Object} changeRecord */ _computeSortedThreads(changeRecord) { diff --git a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html index c51435b1e7..3d0f6f21ca 100644 --- a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html +++ b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.html @@ -217,6 +217,7 @@ limitations under the License. /** * Setup router implementation. + * * @param {function(!string)} navigate the router-abstracted equivalent of * `window.location.href = ...`. Takes a string. * @param {function(!Object): string} generateUrl generates a URL given @@ -253,6 +254,7 @@ limitations under the License. /** * Generate a URL for the given route parameters. + * * @param {Object} params * @return {string} */ @@ -329,6 +331,7 @@ limitations under the License. /** * Navigate to a search for changes with the given status. + * * @param {string} status */ navigateToStatusSearch(status) { @@ -340,6 +343,7 @@ limitations under the License. /** * Navigate to a search query + * * @param {string} query * @param {number=} opt_offset */ @@ -538,6 +542,7 @@ limitations under the License. /** * Navigate to an arbitrary relative URL. + * * @param {string} relativeUrl */ navigateToRelativeUrl(relativeUrl) { @@ -560,6 +565,7 @@ limitations under the License. /** * Navigate to a repo settings page. + * * @param {string} repoName */ navigateToRepo(repoName) { diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js index c635999864..9b4c6114f7 100644 --- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js +++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js @@ -175,6 +175,7 @@ /** * The default reporter reports events immediately. + * * @param {string} type * @param {string} category * @param {string} eventName @@ -202,6 +203,7 @@ /** * The caching reporter will queue reports until plugins have loaded, and * log events immediately if they're reported after plugins have loaded. + * * @param {string} type * @param {string} category * @param {string} eventName @@ -345,6 +347,7 @@ /** * Reports just line timeEnd, but additionally reports an average given a * denominator and a separate reporiting name for the average. + * * @param {string} name Timing name. * @param {string} averageName Average timing name. * @param {number} denominator Number by which to divide the total to @@ -363,6 +366,7 @@ /** * Send a timing report with an arbitrary time value. + * * @param {string} name Timing name. * @param {number} time The time to report as an integer of milliseconds. */ @@ -375,6 +379,7 @@ * Get a timer object to for reporing a user timing. The start time will be * the time that the object has been created, and the end time will be the * time that the "end" method is called on the object. + * * @param {string} name Timing name. * @returns {!Object} The timer object. */ @@ -421,6 +426,7 @@ /** * Log timing information for an RPC. + * * @param {string} anonymizedUrl The URL of the RPC with tokens obfuscated. * @param {number} elapsed The time elapsed of the RPC. */ diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.js b/polygerrit-ui/app/elements/core/gr-router/gr-router.js index 78d00aea45..2c9a7326e5 100644 --- a/polygerrit-ui/app/elements/core/gr-router/gr-router.js +++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.js @@ -103,6 +103,7 @@ /** * Support vestigial params from GWT UI. + * * @see Issue 7673. * @type {!RegExp} */ @@ -159,6 +160,7 @@ * the hash of diff URLs. In this format, a number on its own indicates that * line number in the revision of the diff. A number prefixed by either an 'a' * or a 'b' indicates that line number of the base of the diff. + * * @type {RegExp} */ const LINE_ADDRESS_PATTERN = /^([ab]?)(\d+)$/; @@ -521,6 +523,7 @@ * Given an object of parameters, potentially including a `patchNum` or a * `basePatchNum` or both, return a string representation of that range. If * no range is indicated in the params, the empty string is returned. + * * @param {!Object} params * @return {string} */ @@ -597,6 +600,7 @@ /** * Redirect the user to login using the given return-URL for redirection * after authentication success. + * * @param {string} returnUrl */ _redirectToLogin(returnUrl) { @@ -609,6 +613,7 @@ * Hashes parsed by page.js exclude "inner" hashes, so a URL like "/a#b#c" * is parsed to have a hash of "b" rather than "b#c". Instead, this method * parses hashes correctly. Will return an empty string if there is no hash. + * * @param {!string} canonicalPath * @return {!string} Everything after the first '#' ("a#b#c" -> "b#c"). */ @@ -629,6 +634,7 @@ * Check to see if the user is logged in and return a promise that only * resolves if the user is logged in. If the user us not logged in, the * promise is rejected and the page is redirected to the login flow. + * * @param {!Object} data The parsed route data. * @return {!Promise} A promise yielding the original route data * (if it resolves). diff --git a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js index b04bbfd65c..9a2be9649b 100644 --- a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js +++ b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js @@ -204,6 +204,7 @@ /** * Determine what array of possible suggestions should be provided * to _getSearchSuggestions. + * * @param {string} input - The full search term, in lowercase. * @return {!Promise} This returns a promise that resolves to an array of * suggestion objects. @@ -245,6 +246,7 @@ /** * Get the sorted, pruned list of suggestions for the current search query. + * * @param {string} input - The complete search query. * @return {!Promise} This returns a promise that resolves to an array of * suggestions. diff --git a/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js b/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js index f2e8f24078..f2f9a4c6a5 100644 --- a/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js +++ b/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search.js @@ -70,6 +70,7 @@ /** * Fetch from the API the predicted projects. + * * @param {string} predicate - The first part of the search term, e.g. * 'project' * @param {string} expression - The second part of the search term, e.g. @@ -90,6 +91,7 @@ /** * Fetch from the API the predicted groups. + * * @param {string} predicate - The first part of the search term, e.g. * 'ownerin' * @param {string} expression - The second part of the search term, e.g. @@ -111,6 +113,7 @@ /** * Fetch from the API the predicted accounts. + * * @param {string} predicate - The first part of the search term, e.g. * 'owner' * @param {string} expression - The second part of the search term, e.g. diff --git a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.js b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.js index ff9dee5eb7..6c0d19a746 100644 --- a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.js +++ b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.js @@ -426,12 +426,13 @@ }; /** - * Whether the given comment should be included in the base side of the - * given patch range. - * @param {!Object} comment - * @param {!Defs.patchRange} range - * @return {boolean} - */ + * Whether the given comment should be included in the base side of the + * given patch range. + * + * @param {!Object} comment + * @param {!Defs.patchRange} range + * @return {boolean} + */ ChangeComments.prototype._isInBaseOfPatchRange = function(comment, range) { // If the base of the patch range is a parent of a merge, and the comment // appears on a specific parent then only show the comment if the parent @@ -459,6 +460,7 @@ /** * Whether the given comment should be included in the revision side of the * given patch range. + * * @param {!Object} comment * @param {!Defs.patchRange} range * @return {boolean} @@ -471,6 +473,7 @@ /** * Whether the given comment should be included in the given patch range. + * * @param {!Object} comment * @param {!Defs.patchRange} range * @return {boolean|undefined} diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html index 4bda1e194f..2a2b75316b 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html @@ -452,6 +452,7 @@ limitations under the License. * which, in turn, triggers a reflow on the page. Create a hidden * thread, attach it to the page, and remove it so the stylesheet will * already exist and the user's comment will be quick to load. + * * @see https://gerrit-review.googlesource.com/c/82213/ */ _preRenderThread() { @@ -489,6 +490,7 @@ limitations under the License. /** * Get the approximate length of the diff as the sum of the maximum * length of the chunks. + * * @return {number} */ getDiffLength() { diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js index 30b6fbf9f3..f37b5d8ddf 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.js @@ -95,6 +95,7 @@ /** * Abstract method + * * @param {string} outputEl * @param {number} fontSize */ @@ -104,6 +105,7 @@ /** * Abstract method + * * @param {Object} group */ GrDiffBuilder.prototype.buildSectionElement = function() { @@ -623,6 +625,7 @@ /** * Finds the next DIV.contentText element following the given element, and on * the same side. Will only search within a group. + * * @param {HTMLElement} content * @param {string} side Either 'left' or 'right' * @return {HTMLElement} @@ -634,6 +637,7 @@ /** * Determines whether the given group is either totally an addition or totally * a removal. + * * @param {!Object} group (GrDiffGroup) * @return {boolean} */ @@ -646,6 +650,7 @@ /** * Set the blame information for the diff. For any already-rendered line, * re-render its blame cell content. + * * @param {Object} blame */ GrDiffBuilder.prototype.setBlame = function(blame) { @@ -673,6 +678,7 @@ /** * Find the blame cell for a given line number. + * * @param {number} lineNum * @return {HTMLTableDataCellElement} */ @@ -685,6 +691,7 @@ * Given a base line number, return the commit containing that line in the * current set of blame information. If no blame information has been * provided, null is returned. + * * @param {number} lineNum * @return {Object} The commit information. */ @@ -704,6 +711,7 @@ /** * Given the number of a base line, get the content for the blame cell of that * line. If there is no blame information for that line, returns null. + * * @param {number} lineNum * @param {Object=} opt_commit Optionally provide the commit object, so that * it does not need to be searched. @@ -728,6 +736,7 @@ /** * Create a blame cell for the given base line. Blame information will be * included in the cell if available. + * * @param {GrDiffLine} line * @return {HTMLTableDataCellElement} */ diff --git a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js index 60966a79f9..4ef173a467 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-comment-thread/gr-diff-comment-thread.js @@ -453,6 +453,7 @@ /** * Load the project config when a project name has been provided. + * * @param {string} name The project name. */ _projectNameChanged(name) { diff --git a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js index de7660d584..556a53abf2 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js @@ -66,7 +66,7 @@ * the first chunk) the next time the diff renders. It is set back to null * when used. * - * @type (?number) + * @type {?number} */ initialLineNumber: { type: Number, @@ -173,6 +173,7 @@ /** * Get the line number element targeted by the cursor row and side. + * * @return {?Element|undefined} */ getTargetLineElement() { @@ -240,6 +241,7 @@ * {leftSide: false, number: 123} for line 123 of the revision, or * {leftSide: true, number: 321} for line 321 of the base patch. * Returns null if an address is not available. + * * @return {?Object} */ getAddress() { @@ -364,6 +366,7 @@ /** * Setup and tear down on-render listeners for any diffs that are added or * removed from the cursor. + * * @private */ _diffsChanged(changeRecord) { diff --git a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-annotation.js b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-annotation.js index c1d53aa4ce..ab2e65df90 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-annotation.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-annotation.js @@ -31,6 +31,7 @@ /** * The DOM API textContent.length calculation is broken when the text * contains Unicode. See https://mathiasbynens.be/notes/javascript-unicode . + * * @param {!Text} node text node. * @return {number} The length of the text. */ diff --git a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight.js b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight.js index af8725e772..cd5b53a108 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-diff-highlight.js @@ -107,6 +107,7 @@ * Merges multiple ranges, accounts for triple click, accounts for * syntax highligh, convert native DOM Range objects to Gerrit concepts * (line, side, etc). + * * @return {({ * start: { * node: Node, @@ -142,6 +143,7 @@ /** * Normalize a specific DOM Range. + * * @return {!Object} fixed normalized range */ _normalizeRange(domRange) { diff --git a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-range-normalizer.js b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-range-normalizer.js index eb4123d5ce..927c7591a6 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-range-normalizer.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-highlight/gr-range-normalizer.js @@ -97,6 +97,7 @@ /** * The DOM API textContent.length calculation is broken when the text * contains Unicode. See https://mathiasbynens.be/notes/javascript-unicode . + * * @param {text} node A text node. * @return {number} The length of the text. */ diff --git a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js index d495dfc7a6..9b1084720b 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js @@ -57,6 +57,7 @@ /** * Fired when the user selects a line. + * * @event line-selected */ @@ -123,6 +124,7 @@ /** * Special line number which should not be collapsed into a shared region. + * * @type {{ * number: number, * leftSide: {boolean} @@ -284,6 +286,7 @@ /** * Load and display blame information for the base of the diff. + * * @return {Promise} A promise that resolves when blame finishes rendering. */ loadBlame() { @@ -458,6 +461,7 @@ * Take a diff that was loaded with a ignore-whitespace other than * IGNORE_NONE, and convert delta chunks labeled as common into shared * chunks. + * * @param {!Object} diff * @returns {!Object} */ diff --git a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js index 0ed2db2997..b934d02764 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js @@ -104,6 +104,7 @@ /** * Asynchronously process the diff object into groups. As it processes, it * will splice groups into the `groups` property of the component. + * * @return {Promise} A promise that resolves when the diff is completely * processed. */ @@ -230,6 +231,7 @@ /** * Take rows of a shared diff section and produce an array of corresponding * (potentially collapsed) groups. + * * @param {!Array} rows * @param {number} context * @param {number} startLineNumLeft @@ -293,6 +295,7 @@ /** * Take the rows of a delta diff section and produce the corresponding * group. + * * @param {!Array} rowsAdded * @param {!Array} rowsRemoved * @param {number} startLineNumLeft @@ -353,6 +356,7 @@ * In order to show comments out of the bounds of the selected context, * treat them as separate chunks within the model so that the content (and * context surrounding it) renders correctly. + * * @param {?} content The diff content object. (has to be iterable) * @return {!Object} A new diff content object with regions split up. */ @@ -497,6 +501,7 @@ * If a group is an addition or a removal, break it down into smaller groups * of that type using the MAX_GROUP_SIZE. If the group is a shared section * or a delta it is returned as the single element of the result array. + * * @param {!Object} group A raw chunk from a diff response. * @return {!Array>} */ @@ -526,6 +531,7 @@ /** * Given an array and a size, return an array of arrays where no inner array * is larger than that size, preserving the original order. + * * @param {!Array} array * @param {number} size * @return {!Array>} diff --git a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js index b37a511303..7f25b3e1c3 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js @@ -101,6 +101,7 @@ /** * Set the provided list of classes on the element, to the exclusion of all * other SelectionClass values. + * * @param {!Array} targetClasses */ _setClasses(targetClasses) { diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js index 74087947d0..7a670d3e49 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js @@ -54,6 +54,7 @@ /** * Fired when the user selects a line. + * * @event line-selected */ @@ -70,10 +71,10 @@ */ /** - * Fired when a draft is added or edited. - * - * @event draft-interaction - */ + * Fired when a draft is added or edited. + * + * @event draft-interaction + */ properties: { changeNum: String, @@ -126,6 +127,7 @@ /** * Special line number which should not be collapsed into a shared region. + * * @type {{ * number: number, * leftSide: {boolean} @@ -167,7 +169,7 @@ * bypassed. If the value is a number, then that number represents the * context preference to use when rendering the bypassed diff. * - * @type (number|null) + * @type {number|null} */ _safetyBypass: { type: Number, @@ -746,6 +748,7 @@ /** * Find the last chunk for the given side. + * * @param {!Object} diff * @param {boolean} leftSide true if checking the base of the diff, * false if testing the revision. @@ -781,6 +784,7 @@ /** * Check whether the specified side of the diff has a trailing newline. + * * @param {!Object} diff * @param {boolean} leftSide true if checking the base of the diff, * false if testing the revision. diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js index a3456e2cc7..ad2e599aea 100644 --- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js +++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js @@ -157,6 +157,7 @@ * The basePatchNum should always be <= patchNum -- because sortedRevisions * is sorted in reverse order (higher patchset nums first), invalid base * patch nums have an index greater than the index of patchNum. + * * @param {number|string} basePatchNum The possible base patch num. * @param {number|string} patchNum The current selected patch num. * @param {!Array} sortedRevisions diff --git a/polygerrit-ui/app/elements/diff/gr-ranged-comment-layer/gr-ranged-comment-layer.js b/polygerrit-ui/app/elements/diff/gr-ranged-comment-layer/gr-ranged-comment-layer.js index 1d05e493f3..fb48b39659 100644 --- a/polygerrit-ui/app/elements/diff/gr-ranged-comment-layer/gr-ranged-comment-layer.js +++ b/polygerrit-ui/app/elements/diff/gr-ranged-comment-layer/gr-ranged-comment-layer.js @@ -46,6 +46,7 @@ /** * Layer method to add annotations to a line. + * * @param {!HTMLElement} el The DIV.contentText element to apply the * annotation to. * @param {!Object} line The line object. (GrDiffLine) @@ -72,6 +73,7 @@ /** * Register a listener for layer updates. + * * @param {function(number, number, string)} fn The update handler function. * Should accept as arguments the line numbers for the start and end of * the update and the side as a string. @@ -82,6 +84,7 @@ /** * Notify Layer listeners of changes to annotations. + * * @param {number} start The line where the update starts. * @param {number} end The line where the update ends. * @param {string} side The side of the update. ('left' or 'right') @@ -95,6 +98,7 @@ /** * Handle change in the comments by updating the comment maps and by * emitting appropriate update notifications. + * * @param {Object} record The change record. */ _handleCommentChange(record) { @@ -136,6 +140,7 @@ * Take a list of comments and return a sparse list mapping line numbers to * partial ranges. Uses an end-character-index of -1 to indicate the end of * the line. + * * @param {?} commentList The list of comments. * Getting this param to match closure requirements caused problems. * @return {!Object} The sparse list. diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js index 9d37638b5e..446805e291 100644 --- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js +++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.js @@ -168,6 +168,7 @@ /** * Annotation layer method to add syntax annotations to the given element * for the given line. + * * @param {!HTMLElement} el * @param {!Object} line (GrDiffLine) */ @@ -204,6 +205,7 @@ /** * Start processing symtax for the loaded diff and notify layer listeners * as syntax info comes online. + * * @return {Promise} */ process() { @@ -291,6 +293,7 @@ * Take a string of HTML with the (potentially nested) syntax markers * Highlight.js emits and emit a list of text ranges and classes for the * markers. + * * @param {string} str The string of HTML. * @return {!Array} The list of ranges. */ @@ -326,6 +329,7 @@ /** * For a given state, process the syntax for the next line (or pair of * lines). + * * @param {!Object} state The processing state for the layer. */ _processNextLine(state) { @@ -438,6 +442,7 @@ /** * Tells whether the state has exhausted its current section. + * * @param {!Object} state * @return {boolean} */ @@ -454,6 +459,7 @@ /** * For a given state, notify layer listeners of any processed line ranges * that have not yet been notified. + * * @param {!Object} state */ _notify(state) { diff --git a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.js b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.js index 696726c95e..610e9ed5af 100644 --- a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.js +++ b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls.js @@ -111,6 +111,7 @@ /** * Given a path string, checks that it is a valid file path. + * * @param {string} path * @return {boolean} */ @@ -125,6 +126,7 @@ /** * Given a dom event, gets the dialog that lies along this event path. + * * @param {!Event} e * @return {!Element|undefined} */ diff --git a/polygerrit-ui/app/elements/gr-app.js b/polygerrit-ui/app/elements/gr-app.js index 2dc345e186..f48951bd53 100644 --- a/polygerrit-ui/app/elements/gr-app.js +++ b/polygerrit-ui/app/elements/gr-app.js @@ -51,6 +51,7 @@ /** * The last time the g key was pressed in milliseconds (or a keydown event * was handled if the key is held down). + * * @type {number|null} */ _lastGKeyPressTimestamp: { diff --git a/polygerrit-ui/app/elements/plugins/gr-attribute-helper/gr-attribute-helper.js b/polygerrit-ui/app/elements/plugins/gr-attribute-helper/gr-attribute-helper.js index df71da616a..358fba7e58 100644 --- a/polygerrit-ui/app/elements/plugins/gr-attribute-helper/gr-attribute-helper.js +++ b/polygerrit-ui/app/elements/plugins/gr-attribute-helper/gr-attribute-helper.js @@ -28,6 +28,7 @@ /** * Returns true if the property is defined on wrapped element. + * * @param {string} name * @return {boolean} */ diff --git a/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.js b/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.js index 230be0e03a..2d07382b1f 100644 --- a/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.js +++ b/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.js @@ -76,6 +76,7 @@ /** * Get instance of last DOM hook element attached into the endpoint. * Returns a Promise, that's resolved when attachment is done. + * * @return {!Promise} */ GrDomHook.prototype.getLastAttached = function() { @@ -108,6 +109,7 @@ /** * Install a new callback to invoke when a new instance of DOM hook element * is attached. + * * @param {function(Element)} callback */ GrDomHook.prototype.onAttached = function(callback) { diff --git a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js index d3c6d103af..c0dd5d6c44 100644 --- a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js +++ b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js @@ -33,6 +33,7 @@ * This map prevents importing the same endpoint twice. * Without caching, if a plugin is loaded after the loaded plugins * callback fires, it will be imported twice and appear twice on the page. + * * @type {!Map} */ _initializedPlugins: { diff --git a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js index 414abad6f6..81b59b6a38 100644 --- a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js +++ b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js @@ -25,6 +25,7 @@ /** * Add a callback to arbitrary event. * The callback may return false to prevent event bubbling. + * * @param {string} event Event name * @param {function(Event):boolean} callback * @return {function()} Unsubscribe function. @@ -36,6 +37,7 @@ /** * Add a callback to element click or touch. * The callback may return false to prevent event bubbling. + * * @param {function(Event):boolean} callback * @return {function()} Unsubscribe function. */ @@ -48,6 +50,7 @@ * Callback is installed on parent during capture phase. * https://www.w3.org/TR/DOM-Level-3-Events/#event-flow * The callback may return false to cancel regular event listeners. + * * @param {function(Event):boolean} callback * @return {function()} Unsubscribe function. */ diff --git a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.js b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.js index e3f869481a..5418267c6c 100644 --- a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.js +++ b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.js @@ -22,6 +22,7 @@ * Provides method for opening and closing popups from plugin. * opt_moduleName is a name of custom element that will be automatically * inserted on popup opening. + * * @param {!Object} plugin * @param {opt_moduleName=} string */ @@ -40,6 +41,7 @@ * Opens the popup, inserts it into DOM over current UI. * Creates the popup if not previously created. Creates popup content element, * if it was provided with constructor. + * * @returns {!Promise} */ GrPopupInterface.prototype.open = function() { diff --git a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.js b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.js index 7d10963386..1ed91b806c 100644 --- a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.js +++ b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.js @@ -38,6 +38,7 @@ /** * Get the list of enabled column names from whichever checkboxes are * checked (excluding the number checkbox). + * * @return {!Array} */ _getDisplayedColumns() { diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.js b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.js index 4efa7ad926..04815efdf8 100644 --- a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.js +++ b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.js @@ -215,6 +215,7 @@ /** * Set the text of the input without triggering the suggestion dropdown. + * * @param {string} text The new text for the input. */ setText(text) { diff --git a/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js b/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js index 8d66d0b673..5e1f5872cb 100644 --- a/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js +++ b/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js @@ -34,7 +34,7 @@ observer: '_updateIndex', }, /** - * @type (?Object) + * @type {?Object} */ target: { type: Object, @@ -43,7 +43,8 @@ }, /** * The height of content intended to be included with the target. - * @type (?number) + * + * @type {?number} */ _targetHeight: Number, @@ -69,7 +70,8 @@ * 'keep-visible'. 'keep-visible' will only scroll if the cursor is beyond * the viewport. * TODO (beckysiegel) figure out why it can be undefined - * @type (string|undefined) + * + * @type {string|undefined} */ scrollBehavior: { type: String, @@ -99,6 +101,7 @@ /** * Set the cursor to an arbitrary element. + * * @param {!HTMLElement} element * @param {boolean=} opt_noScroll prevent any potential scrolling in response * setting the cursor. @@ -146,6 +149,7 @@ /** * Move the cursor forward or backward by delta. Noop if moving past either * end of the stop list. + * * @param {number} delta either -1 or 1. * @param {!Function=} opt_condition Optional stop condition. If a condition * is passed the cursor will continue to move in the specified direction @@ -200,6 +204,7 @@ /** * Get the next stop index indicated by the delta direction. + * * @param {number} delta either -1 or 1. * @param {!Function=} opt_condition Optional stop condition. * @return {number} the new index. @@ -248,6 +253,7 @@ /** * Calculate where the element is relative to the window. + * * @param {!Object} target Target to scroll to. * @return {number} Distance to top of the target. */ diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.js b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.js index b7ddfd74a8..2962dbe1d2 100644 --- a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.js +++ b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list.js @@ -73,6 +73,7 @@ /** * Handle a click on the iron-dropdown element. + * * @param {!Event} e */ _handleDropdownClick(e) { @@ -85,6 +86,7 @@ /** * Handle a click on the button to open the dropdown. + * * @param {!Event} e */ _showDropdownTapHandler(e) { diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js index f3e19b835f..7ee2f44f5a 100644 --- a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js +++ b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js @@ -92,6 +92,7 @@ /** * Handle the up key. + * * @param {!Event} e */ _handleUp(e) { @@ -106,6 +107,7 @@ /** * Handle the down key. + * * @param {!Event} e */ _handleDown(e) { @@ -120,6 +122,7 @@ /** * Handle the tab key. + * * @param {!Event} e */ _handleTab(e) { @@ -132,6 +135,7 @@ /** * Handle the enter key. + * * @param {!Event} e */ _handleEnter(e) { @@ -150,6 +154,7 @@ /** * Handle a click on the iron-dropdown element. + * * @param {!Event} e */ _handleDropdownClick(e) { @@ -158,6 +163,7 @@ /** * Hanlde a click on the button to open the dropdown. + * * @param {!Event} e */ _dropdownTriggerTapHandler(e) { @@ -190,6 +196,7 @@ /** * Get the class for a top-content item based on the given boolean. + * * @param {boolean} bold Whether the item is bold. * @return {string} The class for the top-content item. */ @@ -200,6 +207,7 @@ /** * Build a URL for the given host and path. The base URL will be only added, * if it is not already included in the path. + * * @param {!string} host * @param {!string} path * @return {!string} The scheme-relative URL. @@ -214,6 +222,7 @@ * Build a scheme-relative URL for the current host. Will include the base * URL if one is present. Note: the URL will be scheme-relative but absolute * with regard to the host. + * * @param {!string} path The path for the URL. * @return {!string} The scheme-relative URL. */ @@ -224,6 +233,7 @@ /** * Compute the URL for a link object. + * * @param {!Object} link The object describing the link. * @return {!string} The URL. */ @@ -241,6 +251,7 @@ * Compute the value for the rel attribute of an anchor for the given link * object. If the link has a target value, then the rel must be "noopener" * for security reasons. + * * @param {!Object} link The object describing the link. * @return {?string} The rel value for the link. */ @@ -253,6 +264,7 @@ /** * Handle a click on an item of the dropdown. + * * @param {!Event} e */ _handleItemTap(e) { @@ -268,6 +280,7 @@ /** * If a dropdown item is shown as a button, get the class for the button. + * * @param {string} id * @param {!Object} disabledIdsRecord The change record for the disabled IDs * list. diff --git a/polygerrit-ui/app/elements/shared/gr-event-interface/gr-event-interface.js b/polygerrit-ui/app/elements/shared/gr-event-interface/gr-event-interface.js index d024bb2df3..f76345737e 100644 --- a/polygerrit-ui/app/elements/shared/gr-event-interface/gr-event-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-event-interface/gr-event-interface.js @@ -39,6 +39,7 @@ constructor() { /** * Shared events map from name to the listeners. + * * @type {!Object>} */ this._listenersMap = new Map(); diff --git a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.js b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.js index 4e68d426c5..feae17314e 100644 --- a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.js +++ b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.js @@ -245,6 +245,7 @@ /** * Map an array of block objects to an array of DOM nodes. + * * @param {!Array} blocks * @return {!Array} */ diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-context.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-context.js index 933117367a..af137e5ec2 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-context.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-context.js @@ -19,6 +19,7 @@ /** * Used to create a context for GrAnnotationActionsInterface. + * * @param {HTMLElement} el The DIV.contentText element to apply the * annotation to using annotateRange. * @param {GrDiffLine} line The line object. @@ -37,6 +38,7 @@ /** * Method to add annotations to a line. + * * @param {Number} start The line number where the update starts. * @param {Number} end The line number where the update ends. * @param {String} cssClass The name of a CSS class created using Gerrit.css. diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.js index b0ed5925b3..0be557fff6 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-annotation-actions-js-api.js @@ -34,6 +34,7 @@ * Register a function to call to apply annotations. Plugins should use * GrAnnotationActionsContext.annotateRange to apply a CSS class to a range * within a line. + * * @param {function(GrAnnotationActionsContext)} addLayerFunc The function * that will be called when the AnnotationLayer is ready to annotate. */ @@ -45,6 +46,7 @@ /** * The specified function will be called with a notify function for the plugin * to call when it has all required data for annotation. Optional. + * * @param {function(function(String, Number, Number, String))} notifyFunc See * doc of the notify function below to see what it does. */ @@ -97,6 +99,7 @@ * The notify function will call the listeners of all required annotation * layers. Intended to be called by the plugin when all required data for * annotation is available. + * * @param {String} path The file path whose listeners should be notified. * @param {Number} start The line where the update starts. * @param {Number} end The line where the update ends. @@ -117,6 +120,7 @@ /** * Should be called to register annotation layers by the framework. Not * intended to be called by plugins. + * * @param {String} path The file path (eg: /COMMIT_MSG'). * @param {String} changeNum The Gerrit change number. * @param {String} patchNum The Gerrit patch number. @@ -131,6 +135,7 @@ /** * Used to create an instance of the Annotation Layer interface. + * * @param {String} path The file path (eg: /COMMIT_MSG'). * @param {String} changeNum The Gerrit change number. * @param {String} patchNum The Gerrit patch number. @@ -148,6 +153,7 @@ /** * Register a listener for layer updates. + * * @param {function(Number, Number, String)} fn The update handler function. * Should accept as arguments the line numbers for the start and end of * the update and the side as a string. @@ -158,6 +164,7 @@ /** * Layer method to add annotations to a line. + * * @param {HTMLElement} el The DIV.contentText element to apply the * annotation to. * @param {GrDiffLine} line The line object. @@ -170,6 +177,7 @@ /** * Notify Layer listeners of changes to annotations. + * * @param {Number} start The line where the update starts. * @param {Number} end The line where the update ends. * @param {String} side The side of the update. ('left' or 'right') diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.js index 407a6a8b0c..5658245665 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.js @@ -20,6 +20,7 @@ /** * Ensure GrChangeActionsInterface instance has access to gr-change-actions * element and retrieve if the interface was created before element. + * * @param {!GrChangeActionsInterface} api */ function ensureEl(api) { @@ -32,6 +33,7 @@ /** * Set gr-change-actions element to a GrChangeActionsInterface instance. + * * @param {!GrChangeActionsInterface} api * @param {!Element} el gr-change-actions */ diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api.js index e86ba4db46..bef709430e 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api.js @@ -20,6 +20,7 @@ /** * Ensure GrChangeReplyInterface instance has access to gr-reply-dialog * element and retrieve if the interface was created before element. + * * @param {!GrChangeReplyInterfaceOld} api */ function ensureEl(api) { diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.js index f9eb128e82..899a45efa4 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-endpoints.js @@ -66,6 +66,7 @@ /** * Get detailed information about modules registered with an extension * endpoint. + * * @param {string} name Endpoint name. * @param {?{ * type: (string|undefined), @@ -92,6 +93,7 @@ /** * Get detailed module names for instantiating at the endpoint. + * * @param {string} name Endpoint name. * @param {?{ * type: (string|undefined), @@ -109,6 +111,7 @@ /** * Get .html plugin URLs with element and module definitions. + * * @param {string} name Endpoint name. * @param {?{ * type: (string|undefined), diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api.js index 10deb951fa..7e84a4b342 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api.js @@ -48,6 +48,7 @@ /** * Fetch and return native browser REST API Response. + * * @param {string} method HTTP Method (GET, POST, etc) * @param {string} url URL without base path or plugin prefix * @param {Object=} payload Respected for POST and PUT only. @@ -63,6 +64,7 @@ /** * Fetch and parse REST API response, if request succeeds. + * * @param {string} method HTTP Method (GET, POST, etc) * @param {string} url URL without base path or plugin prefix * @param {Object=} payload Respected for POST and PUT only. diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js index e980e0e7ad..580bf77fe3 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js @@ -294,6 +294,7 @@ /** * To make REST requests for plugin-provided endpoints, use + * * @example * const pluginRestApi = plugin.restApi(plugin.url()); * @@ -567,6 +568,7 @@ /** * Install "stepping stones" API for GWT-compiled plugins by default. + * * @deprecated best effort support, will be removed with GWT UI. */ Gerrit.installGwt = function(url) { diff --git a/polygerrit-ui/app/elements/shared/gr-lib-loader/gr-lib-loader.js b/polygerrit-ui/app/elements/shared/gr-lib-loader/gr-lib-loader.js index ef8c112278..63214af01b 100644 --- a/polygerrit-ui/app/elements/shared/gr-lib-loader/gr-lib-loader.js +++ b/polygerrit-ui/app/elements/shared/gr-lib-loader/gr-lib-loader.js @@ -40,6 +40,7 @@ * Get the HLJS library. Returns a promise that resolves with a reference to * the library after it's been loaded. The promise resolves immediately if * it's already been loaded. + * * @return {!Promise} */ getHLJS() { @@ -64,6 +65,7 @@ /** * Loads the dark theme document. Returns a promise that resolves with a * custom-style DOM element. + * * @return {!Promise} */ getDarkTheme() { @@ -91,6 +93,7 @@ /** * Get the HLJS library, assuming it has been loaded. Configure the library * if it hasn't already been configured. + * * @return {!Object} */ _getHighlightLib() { @@ -106,6 +109,7 @@ /** * Get the resource path used to load the application. If the application * was loaded through a CDN, then this will be the path to CDN resources. + * * @return {string} */ _getLibRoot() { @@ -117,6 +121,7 @@ /** * Load and execute a JS file from the lib root. + * * @param {string} src The path to the JS file without the lib root. * @return {Promise} a promise that resolves when the script's onload * executes. diff --git a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text.js b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text.js index 530da02926..09f7bbf1b2 100644 --- a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text.js +++ b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text.js @@ -54,6 +54,7 @@ /** * Because either the source text or the linkification config has changed, * the content should be re-parsed. + * * @param {string|null|undefined} content The raw, un-linkified source * string to parse. * @param {Object|null|undefined} config The server config specifying @@ -83,6 +84,7 @@ * element should be created and attached to the resulting DOM. * - To attach an arbitrary fragment: when called with only the `fragment` * argument, the fragment should be attached to the resulting DOM as is. + * * @param {string|null} text * @param {string|null} href * @param {DocumentFragment|undefined} fragment diff --git a/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js b/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js index cff345d155..23a71f99e3 100644 --- a/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js +++ b/polygerrit-ui/app/elements/shared/gr-linked-text/link-text-parser.js @@ -30,6 +30,7 @@ /** * Pattern describing URLs with supported protocols. + * * @type {RegExp} */ const URL_PROTOCOL_PATTERN = /^(https?:\/\/|mailto:)/; @@ -38,6 +39,7 @@ * Construct a parser for linkifying text. Will linkify plain URLs that appear * in the text as well as custom links if any are specified in the linkConfig * parameter. + * * @param {Object|null|undefined} linkConfig Comment links as specified by the * commentlinks field on a project config. * @param {Function} callback The callback to be fired when an intermediate @@ -56,6 +58,7 @@ /** * Emit a callback to create a link element. + * * @param {string} text The text of the link. * @param {string} href The URL to use as the href of the link. */ @@ -67,6 +70,7 @@ /** * Given the source text and a list of CommentLinkItem objects that were * generated by the commentlinks config, emit parsing callbacks. + * * @param {string} text The chuml of source text over which the outputArray * items range. * @param {!Array} outputArray The list of items to add @@ -104,6 +108,7 @@ /** * Sort the given array of CommentLinkItems such that the positions are in * reverse order. + * * @param {!Array} outputArray */ GrLinkTextParser.prototype.sortArrayReverse = function(outputArray) { @@ -119,6 +124,7 @@ * - With the `html` paremeter provided, and the `text` and `href` parameters * passed as `null`. In this case, the string of HTML will be parsed and the * first resulting node will be used as the resulting content. + * * @param {string|null} text The text to use if creating a link. * @param {string|null} href The href to use as the URL if creating a link. * @param {string|null} html The html to parse and use as the result. @@ -161,6 +167,7 @@ /** * Create a CommentLinkItem for a link and append it to the given output * array. + * * @param {string|null} text The text for the link. * @param {string|null} href The href to use as the URL of the link. * @param {number} position The position inside the source text where the link @@ -183,6 +190,7 @@ /** * Create a CommentLinkItem specified by an HTMl string and append it to the * given output array. + * * @param {string|null} html The html to parse and use as the result. * @param {number} position The position inside the source text where the item * starts. @@ -203,6 +211,7 @@ /** * Does the given range overlap with anything already in the item list. + * * @param {number} position * @param {number} length * @param {!Array} outputArray @@ -225,6 +234,7 @@ /** * Parse the given source text and emit callbacks for the items that are * parsed. + * * @param {string} text */ GrLinkTextParser.prototype.parse = function(text) { @@ -240,6 +250,7 @@ * ba-linkify has found a plain URL and wants it linkified. * - With only a `text` parameter provided: this represents the non-link * content that lies between the links the library has found. + * * @param {string} text * @param {string|null|undefined} href */ @@ -266,6 +277,7 @@ /** * Walk over the given source text to find matches for comemntlink patterns * and emit parse result callbacks. + * * @param {string} text The raw source text. * @param {Object|null|undefined} patterns A comment links specification * object. diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-etag-decorator.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-etag-decorator.js index f72c7cc84d..c20cdd7e46 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-etag-decorator.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-etag-decorator.js @@ -30,6 +30,7 @@ /** * Get or upgrade fetch options to include an ETag in a request. + * * @param {string} url The URL being fetched. * @param {!Object=} opt_options Optional options object in which to include * the ETag request header. If omitted, the result will be a fresh option @@ -77,6 +78,7 @@ /** * Get the cached payload for a given URL. + * * @param {string} url * @return {string|undefined} Returns the unparsed JSON payload from the * cache. diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js index 6ab484845e..ad1fac048d 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js @@ -43,6 +43,7 @@ * - cancelCondition is a function that, if provided and returns true, will * cancel the response after it resolves. * - params is a key-value hash to specify get params for the request URL. + * * @typedef {{ * url: string, * errFn: (function(?Response, string=)|null|undefined), @@ -82,6 +83,7 @@ * - headers is a key-value hash to describe HTTP headers for the request. * - parseResponse states whether the result should be parsed as a JSON * object using getResponseObject. + * * @typedef {{ * method: string, * url: string, @@ -253,6 +255,7 @@ /** * Wraps calls to the underlying authenticated fetch function (_auth.fetch) * with timing and logging. + * * @param {Defs.FetchRequest} req */ _fetch(req) { @@ -270,6 +273,7 @@ * Log information about a REST call. Because the elapsed time is determined * by this method, it should be called immediately after the request * finishes. + * * @param {Defs.FetchRequest} req * @param {number} startTime the time that the request was started. * @param {number} status the HTTP status of the response. The status value @@ -298,6 +302,7 @@ * Returns a Promise that resolves to a native Response. * Doesn't do error checking. Supports cancel condition. Performs auth. * Validates auth expiry errors. + * * @param {Defs.FetchJSONRequest} req */ _fetchRawJSON(req) { @@ -332,6 +337,7 @@ * Fetch JSON from url provided. * Returns a Promise that resolves to a parsed response. * Same as {@link _fetchRawJSON}, plus error handling. + * * @param {Defs.FetchJSONRequest} req */ _fetchJSON(req) { @@ -1293,6 +1299,7 @@ /** * Inserts a change into _projectLookup iff it has a valid structure. + * * @param {?{ _number: (number|string) }} change */ _maybeInsertInLookup(change) { @@ -1488,6 +1495,7 @@ /** * The closure compiler doesn't realize this.specialFilePathCompare is * valid. + * * @suppress {checkTypes} */ getChangeFilePathsAsSpeciallySortedArray(changeNum, patchRange) { @@ -2030,6 +2038,7 @@ /** * Gets a file in a specific change and revision. + * * @param {number|string} changeNum * @param {string} path * @param {number|string} patchNum @@ -2049,6 +2058,7 @@ /** * Gets a file in a change edit. + * * @param {number|string} changeNum * @param {string} path */ @@ -2175,6 +2185,7 @@ /** * Send an XHR. + * * @param {Defs.SendRequest} req * @return {Promise} */ @@ -2227,6 +2238,7 @@ /** * Public version of the _send method preserved for plugins. + * * @param {string} method * @param {string} url * @param {?string|number|Object=} opt_body passed as null sometimes @@ -2917,6 +2929,7 @@ /** * Alias for _changeBaseURL.then(send). + * * @todo(beckysiegel) clean up comments * @param {Defs.ChangeSendRequest} req * @return {!Promise} @@ -2944,6 +2957,7 @@ /** * Alias for _changeBaseURL.then(_fetchJSON). + * * @param {Defs.ChangeFetchRequest} req * @return {!Promise} */ @@ -2966,6 +2980,7 @@ /** * Execute a change action or revision action on a change. + * * @param {number} changeNum * @param {string} method * @param {string} endpoint @@ -2988,6 +3003,7 @@ /** * Get blame information for the given diff. + * * @param {string|number} changeNum * @param {string|number} patchNum * @param {string} path @@ -3009,6 +3025,7 @@ /** * Modify the given create draft request promise so that it fails and throws * an error if the response bears HTTP status 200 instead of HTTP 201. + * * @see Issue 7763 * @param {Promise} promise The original promise. * @return {Promise} The modified promise. @@ -3038,6 +3055,7 @@ /** * Fetch a project dashboard definition. * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-dashboard + * * @param {string} project * @param {string} dashboard * @param {function(?Response, string=)=} opt_errFn diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.js index a8d8351df4..8ddb255f90 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.js @@ -61,6 +61,7 @@ /** * Is a part of _groupUpdates(). Creates a new batch of updates. + * * @param {Object} update instance of ReviewerUpdateInfo */ GrReviewerUpdatesParser.prototype._startBatch = function(update) { @@ -76,6 +77,7 @@ * Is a part of _groupUpdates(). Validates current batch: * - filters out updates that don't change reviewer state. * - updates current reviewer state. + * * @param {Object} update instance of ReviewerUpdateInfo */ GrReviewerUpdatesParser.prototype._completeBatch = function(update) { @@ -137,6 +139,7 @@ /** * Generates update message for reviewer state change. + * * @param {string} prev previous reviewer state. * @param {string} state current reviewer state. * @return {string} @@ -158,6 +161,7 @@ /** * Groups updates for same category (eg CC->CC) into a hash arrays of * reviewers. + * * @param {!Array} updates Array of ReviewerUpdateItemInfo. * @return {!Object} Hash of arrays of AccountInfo, message as key. */ @@ -175,6 +179,7 @@ /** * Generates text messages for grouped reviewer updates. * Formats reviewer updates to a (not yet implemented) EventInfo instance. + * * @see https://gerrit-review.googlesource.com/c/94490/ */ GrReviewerUpdatesParser.prototype._formatUpdates = function() { diff --git a/polygerrit-ui/app/elements/shared/revision-info/revision-info.html b/polygerrit-ui/app/elements/shared/revision-info/revision-info.html index 5cb56a7cd2..0846728b86 100644 --- a/polygerrit-ui/app/elements/shared/revision-info/revision-info.html +++ b/polygerrit-ui/app/elements/shared/revision-info/revision-info.html @@ -32,6 +32,7 @@ limitations under the License. * example, with normal changes this will always return 1. For merge changes * wherein the revisions are merge commits this will return 2 or potentially * more. + * * @return {Number} */ RevisionInfo.prototype.getMaxParents = function() { @@ -42,6 +43,7 @@ limitations under the License. /** * Get an object that maps revision numbers to the number of parents of the * commit of that revision. + * * @return {!Object} */ RevisionInfo.prototype.getParentCountMap = function() { @@ -62,6 +64,7 @@ limitations under the License. /** * Get the commit ID of the (0-offset) indexed parent in the given revision * number. + * * @param {number|string} patchNum * @param {number} parentIndex (0-offset) * @return {string} diff --git a/polygerrit-ui/app/lint_test.sh b/polygerrit-ui/app/lint_test.sh index 0fd95df399..f8e233d839 100755 --- a/polygerrit-ui/app/lint_test.sh +++ b/polygerrit-ui/app/lint_test.sh @@ -28,6 +28,6 @@ cd ${UI_PATH} # Linking global eslint packages to the local project. Required to use eslint plugins with a global # eslint installation. -npm link eslint eslint-config-google eslint-plugin-html +npm link eslint eslint-config-google eslint-plugin-html eslint-plugin-jsdoc ${eslint_bin} -c ${UI_PATH}/.eslintrc.json --ext .html,.js ${UI_PATH} From ce751c1d8bd2411dd98b82544b3464504278660d Mon Sep 17 00:00:00 2001 From: Marco Miller Date: Sat, 28 Dec 2019 16:58:55 -0500 Subject: [PATCH 10/15] Update git submodules * Update plugins/webhooks from branch 'stable-3.0' to 0b787b1abc35ac12cd0ea2a9242bafb15c93bd5b - Merge branch 'stable-2.16' into stable-3.0 * stable-2.16: Bump Bazel version to 2.0.0 Bazel: Remove empty glob Upgrade bazlets to latest stable-2.16 to build with 2.16.15 API Upgrade bazlets to latest stable-2.16 to build with 2.16.14 API Upgrade bazlets to latest stable-2.16 to build with 2.16.13 API Upgrade bazlets to latest stable-2.16 Upgrade bazlets to latest stable-2.15 to build with 2.15.18 API Bazel: Migrate workspace status script to python Upgrade bazlets to latest stable-2.15 Upgrade bazlets to latest stable-2.14 Upgrade bazlets to latest stable-2.16 Upgrade bazlets to latest stable-2.15 Upgrade bazlets to latest stable-2.14 Bump Bazel version to 1.1.0 Remove bazel-genfiles from .gitignore Replace bazel-genfiles with bazel-bin in documentation Change-Id: I83a8f4400e5f49b1453bbeac3cd93733a26be3fb - Bump Bazel version to 2.0.0 Change-Id: I0a836dc57d4749ec5874afa5d1388e4e737cc618 - Bazel: Remove empty glob Bug: Issue 12110 Change-Id: If9bf21aeab2428c45748870a7eaa0cc6baad6058 - Upgrade bazlets to latest stable-2.16 to build with 2.16.15 API Change-Id: I8d8aa4924e85437283a66bf256fcce351a425af8 - Upgrade bazlets to latest stable-2.16 to build with 2.16.14 API Change-Id: I1622a992c2a24deba350af915866775c299a4a50 - Upgrade bazlets to latest stable-2.16 to build with 2.16.13 API Change-Id: I53ea39b9eb2da2198b9175642cd62f6aed5fa2ec - Upgrade bazlets to latest stable-2.16 download_file.py: Fix root workspace directory detection Change-Id: I26017fc180b761feba2b5f01d4eb7a0e7c7b690c - Merge branch 'stable-2.15' into stable-2.16 * stable-2.15: Upgrade bazlets to latest stable-2.15 to build with 2.15.18 API Bazel: Migrate workspace status script to python Upgrade bazlets to latest stable-2.15 Upgrade bazlets to latest stable-2.14 Change-Id: I3fd7407a08292ae56e93bea820a781c6e71c397f - Upgrade bazlets to latest stable-2.15 to build with 2.15.18 API Change-Id: I5b0cfcdf3c988793ef0d8b1e56d012b26dff2614 - Merge branch 'stable-2.14' into stable-2.15 * stable-2.14: Bazel: Migrate workspace status script to python Change-Id: I141919270fe4590f38fc794ff4b65c8c54d66193 - Bazel: Migrate workspace status script to python Migrate tools/workspace-status.sh script to Python to ensure better compatibility with other operating systems, as suggested in: [1]. [1] https://github.com/bazelbuild/bazel/issues/5958 Change-Id: I20ec325d610353309a40fc85132382004bc61bd0 - Merge branch 'stable-2.14' into stable-2.15 * stable-2.14: Upgrade bazlets to latest stable-2.14 Change-Id: Ica546d49b8e6c1ce41e08ad6e0ab1c1d0153bccb - Upgrade bazlets to latest stable-2.15 download_file.py: Fix root workspace directory detection Change-Id: I1c5eb23dfe5978270c10ef6d2baaed7ecd0a04fc - Upgrade bazlets to latest stable-2.14 download_file.py: Fix root workspace directory detection Change-Id: Id2da57a98ab0344dc9942d9ff0338309494b0f48 - Upgrade bazlets to latest stable-2.16 Fix genrule2 to clean up temporary folder content Change-Id: I1d186a2082b364f7acc2d99c20ec0211efebbfd2 - Merge branch 'stable-2.15' into stable-2.16 * stable-2.15: Upgrade bazlets to latest stable-2.15 Upgrade bazlets to latest stable-2.14 Bump Bazel version to 1.1.0 Change-Id: Iabfc1dd9e5144e1506601c1cf62fc94c8764b654 - Upgrade bazlets to latest stable-2.15 Fix genrule2 to clean up temporary folder content Change-Id: I1d186a2082b364f7acc2d99c20ec0211efebbfd2 - Merge branch 'stable-2.14' into stable-2.15 * stable-2.14: Upgrade bazlets to latest stable-2.14 Change-Id: I8620ef4dfc850e234759da59253ea2939566e730 - Upgrade bazlets to latest stable-2.14 Fix genrule2 to clean up temporary folder content Change-Id: I1d186a2082b364f7acc2d99c20ec0211efebbfd2 - Merge branch 'stable-2.14' into stable-2.15 * stable-2.14: Bump Bazel version to 1.1.0 Change-Id: I0059aac96c20c4245edf565198d693c6bd5da133 - Bump Bazel version to 1.1.0 Change-Id: I324d090b867d43741cd8d3eedcc12db054a60762 - Merge branch 'stable-2.15' into stable-2.16 * stable-2.15: Remove bazel-genfiles from .gitignore Replace bazel-genfiles with bazel-bin in documentation Change-Id: I263039fc29ba0e5822ca63d93728d340bcb5d06f - Merge branch 'stable-2.14' into stable-2.15 * stable-2.14: Remove bazel-genfiles from .gitignore Replace bazel-genfiles with bazel-bin in documentation Change-Id: I6ff50d492444ea044f9814ea5d30e585bbd8e415 - Remove bazel-genfiles from .gitignore Change-Id: I1af194ce981f0de2fdd5e52d1ff57b80300e1950 - Replace bazel-genfiles with bazel-bin in documentation Bug: Issue 11757 Change-Id: Idd8a9b212db874f55902844f4522e8a25e3d6657 --- plugins/webhooks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/webhooks b/plugins/webhooks index ec0daf8913..0b787b1abc 160000 --- a/plugins/webhooks +++ b/plugins/webhooks @@ -1 +1 @@ -Subproject commit ec0daf89137c0e5adb4990264d0d0f651ecf0fb6 +Subproject commit 0b787b1abc35ac12cd0ea2a9242bafb15c93bd5b From cfd870a8a6e64e15eef3c1c26c11e3eca52435cf Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Wed, 1 Jan 2020 19:17:34 +0000 Subject: [PATCH 11/15] Use gerritCheck API for posting checker result Since the upgrade to the Gerrit Code Review plugin v0.4.0, the integration with Checks is tighter and it isn't needed anymore to make a direct invocation of the Checks API to submit the checker result. Change-Id: Icc06094e0a66d7a0b2e1428dcb605395d4027501 --- Jenkinsfile | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dff993234f..2b5414a649 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,15 +53,11 @@ class Builds { class GerritCheck { String uuid - String changeNum - String sha1 Build build - GerritCheck(name, changeNum, sha1, build) { + GerritCheck(name, build) { this.uuid = "gerritforge:" + name.replaceAll("(bazel/)", "") + Globals.gerritRepositoryNameSha1Suffix - this.changeNum = changeNum - this.sha1 = sha1 this.build = build } @@ -93,21 +89,7 @@ def hasChangeNumber() { } def postCheck(check) { - def gerritPostUrl = Globals.gerritUrl + - "a/changes/${check.changeNum}/revisions/${check.sha1}/checks" - - try { - def json = check.createCheckPayload() - httpRequest(httpMode: 'POST', authentication: Globals.gerritCredentialsId, - contentType: 'APPLICATION_JSON', requestBody: json, - validResponseCodes: '200', url: gerritPostUrl) - echo "----------------------------------------------------------------------------" - echo "Gerrit Check: ${check.uuid}=" + check.build.result + " to change " + - check.changeNum + "/" + check.sha1 - echo "----------------------------------------------------------------------------" - } catch(Exception e) { - echo "ERROR> Failed to post check results to Gerrit: ${e}" - } + gerritCheck(checks: [ "${check.uuid}" : "${check.getCheckResultFromBuild()}" ]) } def queryChangedFiles(url, changeNum, sha1) { @@ -313,7 +295,7 @@ node ('master') { gerritReview( labels: ['Code-Style': resCodeStyle], message: createCodeStyleMsgBody(Builds.codeStyle, resCodeStyle)) - postCheck(new GerritCheck("codestyle", Change.number, Change.sha1, Builds.codeStyle)) + postCheck(new GerritCheck("codestyle", Builds.codeStyle)) def verificationResults = Builds.verification.collect { k, v -> v } def resVerify = verificationResults.inject(1) { @@ -324,7 +306,7 @@ node ('master') { message: createVerifyMsgBody(Builds.verification)) Builds.verification.each { type, build -> postCheck( - new GerritCheck(type, Change.number, Change.sha1, build) + new GerritCheck(type, build) )} setResult(resVerify, resCodeStyle) From dbb15fba04e81eaa4394a86d5bba8cb2f0bf7c90 Mon Sep 17 00:00:00 2001 From: Thomas Draebing Date: Fri, 3 Jan 2020 16:15:59 +0100 Subject: [PATCH 12/15] Set version in package.json to 2.16.16-SNAPSHOT When downporting the package.json, the version was not adapted to the current SNAPSHOT-version of the branch. Change-Id: I1f54441d6c131085421b6de10f87101e08d1465c --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 08ffc5598d..b200b9cabb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gerrit", - "version": "3.1.0-SNAPSHOT", + "version": "2.16.16-SNAPSHOT", "description": "Gerrit Code Review", "dependencies": {}, "devDependencies": { From 31384e8da7dda8c93255b5d3fed04225c456d7bf Mon Sep 17 00:00:00 2001 From: Thomas Draebing Date: Fri, 3 Jan 2020 16:21:14 +0100 Subject: [PATCH 13/15] Set version in package.json to 3.0.7-SNAPSHOT When downporting the package.json, the version was not adapted to the current SNAPSHOT-version of the branch. Change-Id: I43d0c98daa3af2a68ad94b2323440fb27af59be6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 08ffc5598d..1e6a9c25c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gerrit", - "version": "3.1.0-SNAPSHOT", + "version": "3.0.7-SNAPSHOT", "description": "Gerrit Code Review", "dependencies": {}, "devDependencies": { From 9acae0640d1708ec25968305d3b61945ae3f488e Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Fri, 27 Dec 2019 00:54:28 +0100 Subject: [PATCH 14/15] Bump Bazel version to 2.0.0 Bazel 2.0 is a new major version of Bazel and brings some important flag flips that did not make it into Bazel 1.0. In particular Bazel's Debian package and the binary installer now include an improved wrapper that understands /.bazelversion files and the $USE_BAZEL_VERSION environment variable. This is similar to what Bazelisk offers, except that it works offline and integrates with apt-get. Change-Id: Ia0bbd19649880a6803f69b85fad0283b52a5721f --- .bazelversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelversion b/.bazelversion index 26aaba0e86..227cea2156 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -1.2.0 +2.0.0 From 7dd43b3147b8ff9f81100b23d961c37f01427c9f Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sat, 4 Jan 2020 13:53:38 +0100 Subject: [PATCH 15/15] Fix formatting issues flagged by eslint Change-Id: I13d9c4b2331bd5071cfa094d3cdbb5de2e380d8f --- .../rest-client-behavior.html | 6 ++-- .../gr-access-section/gr-access-section.js | 4 +-- .../elements/admin/gr-repo/gr-repo_test.html | 2 +- .../gr-change-actions/gr-change-actions.js | 2 +- .../change/gr-label-scores/gr-label-scores.js | 4 +-- .../gr-main-header/gr-main-header_test.html | 28 +++++++++---------- .../diff/gr-diff-cursor/gr-diff-cursor.js | 6 ++-- .../gr-diff-selection/gr-diff-selection.js | 4 +-- .../elements/diff/gr-diff/gr-diff-group.js | 5 ++-- .../app/elements/diff/gr-diff/gr-diff-line.js | 2 +- .../elements/diff/gr-diff/gr-diff_test.html | 10 +++---- .../gr-edit-controls_test.html | 4 +-- polygerrit-ui/app/elements/gr-app-element.js | 1 + .../gr-event-helper/gr-event-helper.js | 2 ++ .../plugins/gr-styles-api/gr-styles-api.js | 7 +++-- .../gr-account-entry/gr-account-entry.js | 2 +- .../gr-account-entry_test.html | 2 +- .../gr-account-list/gr-account-list_test.html | 1 + .../gr-js-api-interface/gr-api-utils.js | 1 + .../shared/gr-js-api-interface/gr-gerrit.js | 14 +++++----- .../gr-js-api-interface.js | 2 +- .../gr-js-api-interface/gr-plugin-loader.js | 12 +++++--- .../gr-js-api-interface/gr-public-js-api.js | 4 +-- .../gr-rest-api-interface_test.html | 4 +-- .../gr-rest-apis/gr-rest-api-helper.js | 11 ++++++-- .../gr-email-suggestions-provider_test.html | 2 +- .../gr-reviewer-suggestions-provider.js | 15 +++++----- polygerrit-ui/app/types/types.js | 3 ++ 28 files changed, 91 insertions(+), 69 deletions(-) diff --git a/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html b/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html index fbeaa64017..85bc6a194d 100644 --- a/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html +++ b/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html @@ -99,9 +99,9 @@ limitations under the License. SKIP_MERGEABLE: 22, /** - * Skip diffstat computation that compute the insertions field (number of lines inserted) and - * deletions field (number of lines deleted) - */ + * Skip diffstat computation that compute the insertions field (number of lines inserted) and + * deletions field (number of lines deleted) + */ SKIP_DIFFSTAT: 23, }, diff --git a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js index 61f01a70de..77e35c68d3 100644 --- a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js +++ b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js @@ -225,8 +225,8 @@ editRefInput() { return Polymer.dom(this.root).querySelector(Polymer.Element ? - 'iron-input.editRefInput' : - 'input[is=iron-input].editRefInput'); + 'iron-input.editRefInput' : + 'input[is=iron-input].editRefInput'); }, editReference() { diff --git a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.html b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.html index f22c5a5e56..4e81565ec9 100644 --- a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.html +++ b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.html @@ -367,7 +367,7 @@ limitations under the License. element.$.matchAuthoredDateWithCommitterDateSelect.bindValue = configInputObj.match_author_to_committer_date; const inputElement = Polymer.Element ? - element.$.maxGitObjSizeIronInput : element.$.maxGitObjSizeInput; + element.$.maxGitObjSizeIronInput : element.$.maxGitObjSizeInput; inputElement.bindValue = configInputObj.max_object_size_limit; element.$.contributorAgreementSelect.bindValue = configInputObj.use_contributor_agreements; diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js index 3819944949..88d2f76e1c 100644 --- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js +++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.js @@ -434,7 +434,7 @@ _getRebaseAction(revisionActions) { return this._getRevisionAction(revisionActions, 'rebase', - {rebaseOnCurrent: null} + {rebaseOnCurrent: null} ); }, diff --git a/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores.js b/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores.js index 5b498c202b..dffba3e60d 100644 --- a/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores.js +++ b/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores.js @@ -122,8 +122,8 @@ }, /** - * @param label {string|undefined} - * @param permittedLabels {Object|undefined} + * @param {string|undefined} label + * @param {Object|undefined} permittedLabels * @return {string} */ _computeLabelAccessClass(label, permittedLabels) { diff --git a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html index 9a49d7e120..3309aa594e 100644 --- a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html +++ b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html @@ -118,26 +118,26 @@ limitations under the License. /* topMenus= */[], /* docBaseUrl= */ '' ), - defaultLinks.concat({ - title: 'Browse', - links: adminLinks, - })); + defaultLinks.concat({ + title: 'Browse', + links: adminLinks, + })); assert.deepEqual(element._computeLinks( defaultLinks, userLinks, adminLinks, /* topMenus= */[], /* docBaseUrl= */ '' - ), - defaultLinks.concat([ - { - title: 'Your', - links: userLinks, - }, - { - title: 'Browse', - links: adminLinks, - }]) + ), + defaultLinks.concat([ + { + title: 'Your', + links: userLinks, + }, + { + title: 'Browse', + links: adminLinks, + }]) ); }); diff --git a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js index fcfc9435dc..6ddb3902f3 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.js @@ -197,7 +197,7 @@ if (!this.diffRow) return null; const hostOwner = Polymer.dom(/** @type {Node} */ (this.diffRow)) - .getOwnerRoot(); + .getOwnerRoot(); if (hostOwner && hostOwner.host && hostOwner.host.tagName === 'GR-DIFF') { return hostOwner.host; @@ -233,8 +233,8 @@ if (!this.diffRow) { // does not scroll during init unless requested const scrollingBehaviorForInit = this.initialLineNumber ? - ScrollBehavior.KEEP_VISIBLE : - ScrollBehavior.NEVER; + ScrollBehavior.KEEP_VISIBLE : + ScrollBehavior.NEVER; this._scrollBehavior = scrollingBehaviorForInit; this.reInitCursor(); } diff --git a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js index 7e61249732..5caac74053 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection.js @@ -79,8 +79,8 @@ this._setClasses([ SelectionClass.COMMENT, node.commentSide === 'left' ? - SelectionClass.LEFT : - SelectionClass.RIGHT, + SelectionClass.LEFT : + SelectionClass.RIGHT, ]); return true; } diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-group.js b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-group.js index 02ca7e5f5d..a7e391a7aa 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-group.js +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-group.js @@ -36,6 +36,7 @@ /** * True means all changes in this line are whitespace changes that should * not be highlighted as changed as per the user settings. + * * @type{boolean} */ this.ignoredWhitespaceOnly = false; @@ -185,11 +186,11 @@ if (before.length) { beforeGroups.push(before.length === group.lines.length ? - group : group.cloneWithLines(before)); + group : group.cloneWithLines(before)); } if (after.length) { afterGroups.push(after.length === group.lines.length ? - group : group.cloneWithLines(after)); + group : group.cloneWithLines(after)); } } return [beforeGroups, afterGroups]; diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-line.js b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-line.js index b64385d7d6..a29529375d 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-line.js +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff-line.js @@ -37,7 +37,7 @@ /** @type {boolean} */ this.hasIntralineInfo = false; - /** @type Array */ + /** @type {Array} */ this.highlights = []; /** @type {?Array} ?Array */ diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html index 09342e13f9..ec2f5f185e 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html @@ -1070,7 +1070,7 @@ limitations under the License. /* loading= */ false, element.prefs, element._diffLength - )); + )); }); test('do not show the message if still loading', () => { @@ -1079,7 +1079,7 @@ limitations under the License. /* loading= */ true, element.prefs, element._diffLength - )); + )); }); test('do not show the message if contains valid changes', () => { @@ -1098,7 +1098,7 @@ limitations under the License. /* loading= */ false, element.prefs, element._diffLength - )); + )); }); test('do not show message if ignore whitespace is disabled', () => { @@ -1116,7 +1116,7 @@ limitations under the License. /* loading= */ false, element.prefs, element._diffLength - )); + )); }); }); @@ -1129,7 +1129,7 @@ limitations under the License. element = fixture('basic'); element.prefs = {}; renderStub = sandbox.stub(element.$.diffBuilder, 'render') - .returns(Promise.resolve()); + .returns(Promise.resolve()); element.addEventListener('render', event => { assert.isTrue(event.detail.contentRendered); done(); diff --git a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.html b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.html index df029edafd..dd8cb74841 100644 --- a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.html +++ b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.html @@ -192,8 +192,8 @@ suite('gr-edit-controls tests', () => { let renameStub; let renameAutocomplete; const inputSelector = Polymer.Element ? - '.newPathIronInput' : - '.newPathInput'; + '.newPathIronInput' : + '.newPathInput'; setup(() => { navStub = sandbox.stub(Gerrit.Nav, 'navigateToChange'); diff --git a/polygerrit-ui/app/elements/gr-app-element.js b/polygerrit-ui/app/elements/gr-app-element.js index 0a0a80af7e..ce6b98bedc 100644 --- a/polygerrit-ui/app/elements/gr-app-element.js +++ b/polygerrit-ui/app/elements/gr-app-element.js @@ -44,6 +44,7 @@ /** * The last time the g key was pressed in milliseconds (or a keydown event * was handled if the key is held down). + * * @type {number|null} */ _lastGKeyPressTimestamp: { diff --git a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js index 69669d7b1c..845c1e1794 100644 --- a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js +++ b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.js @@ -36,6 +36,7 @@ /** * Alias of onClick + * * @see onClick */ GrEventHelper.prototype.onTap = function(callback) { @@ -55,6 +56,7 @@ /** * Alias of captureClick + * * @see captureClick */ GrEventHelper.prototype.captureTap = function(callback) { diff --git a/polygerrit-ui/app/elements/plugins/gr-styles-api/gr-styles-api.js b/polygerrit-ui/app/elements/plugins/gr-styles-api/gr-styles-api.js index 1de8283439..d5647eae9a 100644 --- a/polygerrit-ui/app/elements/plugins/gr-styles-api/gr-styles-api.js +++ b/polygerrit-ui/app/elements/plugins/gr-styles-api/gr-styles-api.js @@ -33,12 +33,13 @@ * if it hasn't been added yet. A root node is an document or is the * associated shadowRoot. This class can be added to any element with the same * root node. + * * @param {HTMLElement} element The element to get class name for. * @return {string} Appropriate class name for the element is returned */ GrStyleObject.prototype.getClassName = function(element) { let rootNode = Polymer.Settings.useShadow - ? element.getRootNode() : document.body; + ? element.getRootNode() : document.body; if (rootNode === document) { rootNode = document.head; } @@ -56,6 +57,7 @@ /** * Apply shared style to the element. + * * @param {HTMLElement} element The element to apply style for */ GrStyleObject.prototype.apply = function(element) { @@ -68,9 +70,10 @@ /** * Creates a new GrStyleObject with specified style properties. + * * @param {string} String with style properties. * @return {GrStyleObject} - */ + */ GrStylesApi.prototype.css = function(ruleStr) { return new GrStyleObject(ruleStr); }; diff --git a/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry.js b/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry.js index 92836a8210..b2e0973b9b 100644 --- a/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry.js +++ b/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry.js @@ -94,7 +94,7 @@ _inputTextChanged(text) { if (text.length && this.allowAnyInput) { this.dispatchEvent(new CustomEvent( - 'account-text-changed', {bubbles: true, composed: true})); + 'account-text-changed', {bubbles: true, composed: true})); } }, }); diff --git a/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.html b/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.html index 59792a7461..6896af9537 100644 --- a/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.html +++ b/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.html @@ -92,7 +92,7 @@ limitations under the License. test('account-text-changed not fired when input text changed without ' + 'allowAnyInput', () => { - // Spy on query, as that is called when _updateSuggestions proceeds. + // Spy on query, as that is called when _updateSuggestions proceeds. const changeStub = sandbox.stub(); element.querySuggestions = input => Promise.resolve([]); element.addEventListener('account-text-changed', changeStub); diff --git a/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.html b/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.html index 6f265e7cfd..f931a69ec2 100644 --- a/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.html +++ b/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.html @@ -44,6 +44,7 @@ limitations under the License. return item; } } + suite('gr-account-list tests', () => { let _nextAccountId = 0; const makeAccount = function() { diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-api-utils.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-api-utils.js index 4123f70111..2925736755 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-api-utils.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-api-utils.js @@ -35,6 +35,7 @@ /** * Retrieves the name of the plugin base on the url. + * * @param {string|URL} url */ function getPluginNameFromUrl(url) { diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-gerrit.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-gerrit.js index 7a23fdb176..73a248063e 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-gerrit.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-gerrit.js @@ -15,18 +15,18 @@ * limitations under the License. */ - /** - * This defines the Gerrit instance. All methods directly attached to Gerrit - * should be defined or linked here. - */ +/** + * This defines the Gerrit instance. All methods directly attached to Gerrit + * should be defined or linked here. + */ (function(window) { 'use strict'; // Import utils methods const { - send, - getRestAPI, + send, + getRestAPI, } = window._apiUtils; /** @@ -54,7 +54,7 @@ testOnly_resetInternalState, } = window._apiUtils; Gerrit._testOnly_installPreloadedPlugins = (...args) => Gerrit._pluginLoader - .installPreloadedPlugins(...args); + .installPreloadedPlugins(...args); Gerrit._testOnly_flushPreinstalls = flushPreinstalls; Gerrit._testOnly_resetPlugins = () => { testOnly_resetInternalState(); diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface.js index eb846812d7..9eca3a9002 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface.js @@ -243,7 +243,7 @@ getCoverageRanges(changeNum, path, basePatchNum, patchNum) { return Gerrit.awaitPluginsLoaded().then(() => { for (const annotationApi of - this._getEventCallbacks(EventType.ANNOTATE_DIFF)) { + this._getEventCallbacks(EventType.ANNOTATE_DIFF)) { const provider = annotationApi.getCoverageProvider(); // Only one coverage provider makes sense. If there are more, then we // simply ignore them. diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.js index fef026a12c..201b68302b 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-loader.js @@ -20,10 +20,10 @@ // Import utils methods const { - PLUGIN_LOADING_TIMEOUT_MS, - PRELOADED_PROTOCOL, - getPluginNameFromUrl, - getBaseUrl, + PLUGIN_LOADING_TIMEOUT_MS, + PRELOADED_PROTOCOL, + getPluginNameFromUrl, + getBaseUrl, } = window._apiUtils; /** @@ -95,6 +95,7 @@ /** * Use the plugin name or use the full url if not recognized. + * * @see gr-api-utils#getPluginNameFromUrl * @param {string|URL} url */ @@ -282,6 +283,7 @@ /** * Checks if given plugin path/url is enabled or not. + * * @param {string} pathOrUrl */ isPluginEnabled(pathOrUrl) { @@ -293,6 +295,7 @@ /** * Returns the plugin object with a given url. + * * @param {string} pathOrUrl */ getPlugin(pathOrUrl) { @@ -302,6 +305,7 @@ /** * Checks if given plugin path/url is loaded or not. + * * @param {string} pathOrUrl */ isPluginLoaded(pathOrUrl) { diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js index b09ec47541..b261a90a01 100644 --- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js +++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.js @@ -26,8 +26,8 @@ // Import utils methods const { - getPluginNameFromUrl, - send, + getPluginNameFromUrl, + send, } = window._apiUtils; /** diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.html b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.html index ea71522a59..1781ce70df 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.html +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.html @@ -691,7 +691,7 @@ limitations under the License. test('setAccountStatus', () => { const sendStub = sandbox.stub(element._restApiHelper, 'send') - .returns(Promise.resolve('OOO')); + .returns(Promise.resolve('OOO')); element._cache.set('/accounts/self/detail', {}); return element.setAccountStatus('OOO').then(() => { assert.isTrue(sendStub.calledOnce); @@ -702,7 +702,7 @@ limitations under the License. {status: 'OOO'}); assert.deepEqual(element._restApiHelper ._cache.get('/accounts/self/detail'), - {status: 'OOO'}); + {status: 'OOO'}); }); }); diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.js index 5cea96b24e..3908a001bb 100644 --- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.js +++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.js @@ -122,6 +122,7 @@ /** * Wraps calls to the underlying authenticated fetch function (_auth.fetch) * with timing and logging. + * * @param {Gerrit.FetchRequest} req */ fetch(req) { @@ -139,6 +140,7 @@ * Log information about a REST call. Because the elapsed time is determined * by this method, it should be called immediately after the request * finishes. + * * @param {Gerrit.FetchRequest} req * @param {number} startTime the time that the request was started. * @param {number} status the HTTP status of the response. The status value @@ -147,7 +149,7 @@ */ _logCall(req, startTime, status) { const method = (req.fetchOptions && req.fetchOptions.method) ? - req.fetchOptions.method : 'GET'; + req.fetchOptions.method : 'GET'; const endTime = Date.now(); const elapsed = (endTime - startTime); const startAt = new Date(startTime); @@ -171,6 +173,7 @@ * Returns a Promise that resolves to a native Response. * Doesn't do error checking. Supports cancel condition. Performs auth. * Validates auth expiry errors. + * * @param {Gerrit.FetchJSONRequest} req */ fetchRawJSON(req) { @@ -205,6 +208,7 @@ * Fetch JSON from url provided. * Returns a Promise that resolves to a parsed response. * Same as {@link fetchRawJSON}, plus error handling. + * * @param {Gerrit.FetchJSONRequest} req */ fetchJSON(req) { @@ -329,6 +333,7 @@ /** * Send an XHR. + * * @param {Gerrit.SendRequest} req * @return {Promise} */ @@ -339,7 +344,7 @@ options.headers.set( 'Content-Type', req.contentType || 'application/json'); options.body = typeof req.body === 'string' ? - req.body : JSON.stringify(req.body); + req.body : JSON.stringify(req.body); } if (req.headers) { if (!options.headers) { options.headers = new Headers(); } @@ -349,7 +354,7 @@ } } const url = req.url.startsWith('http') ? - req.url : this.getBaseUrl() + req.url; + req.url : this.getBaseUrl() + req.url; const fetchReq = { url, fetchOptions: options, diff --git a/polygerrit-ui/app/scripts/gr-email-suggestions-provider/gr-email-suggestions-provider_test.html b/polygerrit-ui/app/scripts/gr-email-suggestions-provider/gr-email-suggestions-provider_test.html index fb6b5d4948..0266ab91d9 100644 --- a/polygerrit-ui/app/scripts/gr-email-suggestions-provider/gr-email-suggestions-provider_test.html +++ b/polygerrit-ui/app/scripts/gr-email-suggestions-provider/gr-email-suggestions-provider_test.html @@ -68,7 +68,7 @@ limitations under the License. test('getSuggestions', done => { const getSuggestedAccountsStub = sandbox.stub(restAPI, 'getSuggestedAccounts') - .returns(Promise.resolve([account1, account2])); + .returns(Promise.resolve([account1, account2])); provider.getSuggestions('Some input').then(res => { assert.deepEqual(res, [account1, account2]); diff --git a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.js b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.js index c83e5a2235..ffcdba9846 100644 --- a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.js +++ b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.js @@ -35,14 +35,15 @@ switch (usersType) { case Gerrit.SUGGESTIONS_PROVIDERS_USERS_TYPES.REVIEWER: return new GrReviewerSuggestionsProvider(restApi, changeNumber, - input => restApi.getChangeSuggestedReviewers(changeNumber, input)); + input => restApi.getChangeSuggestedReviewers(changeNumber, + input)); case Gerrit.SUGGESTIONS_PROVIDERS_USERS_TYPES.CC: return new GrReviewerSuggestionsProvider(restApi, changeNumber, - input => restApi.getChangeSuggestedCCs(changeNumber, input)); + input => restApi.getChangeSuggestedCCs(changeNumber, input)); case Gerrit.SUGGESTIONS_PROVIDERS_USERS_TYPES.ANY: return new GrReviewerSuggestionsProvider(restApi, changeNumber, - input => restApi.getSuggestedAccounts( - `cansee:${changeNumber} ${input}`)); + input => restApi.getSuggestedAccounts( + `cansee:${changeNumber} ${input}`)); default: throw new Error(`Unknown users type: ${usersType}`); } @@ -65,9 +66,9 @@ this._loggedIn = loggedIn; }); this._initPromise = Promise.all([getConfigPromise, getLoggedInPromise]) - .then(() => { - this._initialized = true; - }); + .then(() => { + this._initialized = true; + }); return this._initPromise; } diff --git a/polygerrit-ui/app/types/types.js b/polygerrit-ui/app/types/types.js index 8dd65cb29b..e17bec8a81 100644 --- a/polygerrit-ui/app/types/types.js +++ b/polygerrit-ui/app/types/types.js @@ -99,6 +99,7 @@ Gerrit.ChangeFetchRequest; * - headers is a key-value hash to describe HTTP headers for the request. * - parseResponse states whether the result should be parsed as a JSON * object using getResponseObject. + * * @typedef {{ * method: string, * url: string, @@ -146,6 +147,7 @@ Gerrit.FetchRequest; * - cancelCondition is a function that, if provided and returns true, will * cancel the response after it resolves. * - params is a key-value hash to specify get params for the request URL. + * * @typedef {{ * url: string, * errFn: (function(?Response, string=)|null|undefined), @@ -217,6 +219,7 @@ Gerrit.CommentsBySide; * Note that the implied newline character at the end of each line is included * in the length calculation, and thus it is possible for the edits to span * newlines. + * * @typedef {!Array} */ Gerrit.IntralineInfo;