Skip to content

Commit 1688368

Browse files
committed
feat: add Default to Lint groups
1 parent 272bbfb commit 1688368

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

util/gh-pages/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,12 @@ <h1>Clippy Lints</h1>
448448
None
449449
</label>
450450
</li>
451+
<li class="checkbox">
452+
<label ng-click="resetGroupsToDefault()">
453+
<input type="checkbox" class="invisible" />
454+
Default
455+
</label>
456+
</li>
451457
<li role="separator" class="divider"></li>
452458
<li class="checkbox" ng-repeat="(group, enabled) in groups">
453459
<label class="text-capitalize">

util/gh-pages/script.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
return $scope.levels[lint.level];
115115
};
116116

117-
var GROUPS_FILTER_DEFAULT = {
117+
const GROUPS_FILTER_DEFAULT = {
118118
cargo: true,
119119
complexity: true,
120120
correctness: true,
@@ -125,8 +125,12 @@
125125
restriction: true,
126126
style: true,
127127
suspicious: true,
128+
}
129+
130+
$scope.groups = {
131+
...GROUPS_FILTER_DEFAULT
128132
};
129-
$scope.groups = GROUPS_FILTER_DEFAULT;
133+
130134
const THEMES_DEFAULT = {
131135
light: "Light",
132136
rust: "Rust",
@@ -164,6 +168,15 @@
164168
}
165169
};
166170

171+
$scope.resetGroupsToDefault = function () {
172+
const groups = $scope.groups;
173+
for (const [key, value] of Object.entries(GROUPS_FILTER_DEFAULT)) {
174+
if (groups.hasOwnProperty(key)) {
175+
groups[key] = value;
176+
}
177+
}
178+
};
179+
167180
$scope.selectedValuesCount = function (obj) {
168181
return Object.values(obj).filter(x => x).length;
169182
}

0 commit comments

Comments
 (0)