diff options
| author | bors <bors@rust-lang.org> | 2022-10-11 08:35:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-11 08:35:12 +0000 |
| commit | 122ae228974c5e7047bf60c6c8f69430d63b1a5d (patch) | |
| tree | a1978a07ae3f96973d8dee9d086de6cf5debf820 | |
| parent | 8e87d39f992d132354a98d9d3a3e0574c61698b2 (diff) | |
| parent | 178799f9c1ddc6ac8ab7821ec56d5c1556b7e454 (diff) | |
| download | rust-122ae228974c5e7047bf60c6c8f69430d63b1a5d.tar.gz rust-122ae228974c5e7047bf60c6c8f69430d63b1a5d.zip | |
Auto merge of #9616 - unvalley:add-default-to-lint-groups, r=xFrednet
Add Default to Clippy Lints Lint groups - related to #7958 This PR adds a default (reset) button to Clippy Lints Lint groups. (change for website) [The page](https://rust-lang.github.io/rust-clippy/master/index.html) sets only `Deprecated` to false by default. Certainly it is easy to set only `deprecated` to false, but it may be a bit lazy for beginners. https://user-images.githubusercontent.com/38400669/194831117-3ade7e0d-c4de-4189-9daf-3be8ea3cdd18.mov changelog: none
| -rw-r--r-- | util/gh-pages/index.html | 6 | ||||
| -rw-r--r-- | util/gh-pages/script.js | 15 |
2 files changed, 19 insertions, 2 deletions
diff --git a/util/gh-pages/index.html b/util/gh-pages/index.html index c5d602ea303..e46ad2c6e0e 100644 --- a/util/gh-pages/index.html +++ b/util/gh-pages/index.html @@ -443,6 +443,12 @@ Otherwise, have a great day =^.^= </label> </li> <li class="checkbox"> + <label ng-click="resetGroupsToDefault()"> + <input type="checkbox" class="invisible" /> + Default + </label> + </li> + <li class="checkbox"> <label ng-click="toggleGroups(false)"> <input type="checkbox" class="invisible" /> None diff --git a/util/gh-pages/script.js b/util/gh-pages/script.js index 366e7c8843f..1c16ecd6b0b 100644 --- a/util/gh-pages/script.js +++ b/util/gh-pages/script.js @@ -114,7 +114,7 @@ return $scope.levels[lint.level]; }; - var GROUPS_FILTER_DEFAULT = { + const GROUPS_FILTER_DEFAULT = { cargo: true, complexity: true, correctness: true, @@ -125,8 +125,12 @@ restriction: true, style: true, suspicious: true, + } + + $scope.groups = { + ...GROUPS_FILTER_DEFAULT }; - $scope.groups = GROUPS_FILTER_DEFAULT; + const THEMES_DEFAULT = { light: "Light", rust: "Rust", @@ -164,6 +168,13 @@ } }; + $scope.resetGroupsToDefault = function () { + const groups = $scope.groups; + for (const [key, value] of Object.entries(GROUPS_FILTER_DEFAULT)) { + groups[key] = value; + } + }; + $scope.selectedValuesCount = function (obj) { return Object.values(obj).filter(x => x).length; } |
