Skip to content

Add Default to Clippy Lints Lint groups #9616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions util/gh-pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ <h1>Clippy Lints</h1>
All
</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" />
Expand Down
15 changes: 13 additions & 2 deletions util/gh-pages/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
return $scope.levels[lint.level];
};

var GROUPS_FILTER_DEFAULT = {
const GROUPS_FILTER_DEFAULT = {
cargo: true,
complexity: true,
correctness: true,
Expand All @@ -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",
Expand Down Expand Up @@ -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;
}
Expand Down