@staff0rd/assist 0.121.0 → 0.122.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +39 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.122.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -163,6 +163,11 @@ var assistConfigSchema = z.strictObject({
|
|
|
163
163
|
news: z.strictObject({
|
|
164
164
|
feeds: z.array(z.string()).default([])
|
|
165
165
|
}).default({ feeds: [] }),
|
|
166
|
+
dotnet: z.strictObject({
|
|
167
|
+
inspect: z.strictObject({
|
|
168
|
+
suppress: z.array(z.string()).default([])
|
|
169
|
+
}).default({ suppress: [] })
|
|
170
|
+
}).optional(),
|
|
166
171
|
ravendb: z.strictObject({
|
|
167
172
|
connections: z.array(
|
|
168
173
|
z.strictObject({
|
|
@@ -4718,27 +4723,6 @@ function formatElapsed(ms) {
|
|
|
4718
4723
|
return `${mins}m ${remainSecs.toFixed(1)}s`;
|
|
4719
4724
|
}
|
|
4720
4725
|
|
|
4721
|
-
// src/commands/dotnet/deadCodeRules.ts
|
|
4722
|
-
var deadCodeRules = /* @__PURE__ */ new Set([
|
|
4723
|
-
"UnusedMember.Global",
|
|
4724
|
-
"UnusedMember.Local",
|
|
4725
|
-
"UnusedType.Global",
|
|
4726
|
-
"UnusedType.Local",
|
|
4727
|
-
"UnusedParameter.Global",
|
|
4728
|
-
"UnusedParameter.Local",
|
|
4729
|
-
"NotAccessedField.Global",
|
|
4730
|
-
"NotAccessedField.Local",
|
|
4731
|
-
"NotAccessedVariable.Local",
|
|
4732
|
-
"UnusedAutoPropertyAccessor.Global",
|
|
4733
|
-
"UnusedAutoPropertyAccessor.Local",
|
|
4734
|
-
"ClassNeverInstantiated.Global",
|
|
4735
|
-
"ClassNeverInstantiated.Local",
|
|
4736
|
-
"UnusedMethodReturnValue.Global",
|
|
4737
|
-
"UnusedMethodReturnValue.Local",
|
|
4738
|
-
"UnusedVariable.Compiler",
|
|
4739
|
-
"RedundantUsingDirective"
|
|
4740
|
-
]);
|
|
4741
|
-
|
|
4742
4726
|
// src/commands/dotnet/displayIssues.ts
|
|
4743
4727
|
import chalk52 from "chalk";
|
|
4744
4728
|
var SEVERITY_COLOR = {
|
|
@@ -4773,6 +4757,33 @@ function displayIssues(issues) {
|
|
|
4773
4757
|
${issues.length} issue(s) found`));
|
|
4774
4758
|
}
|
|
4775
4759
|
|
|
4760
|
+
// src/commands/dotnet/deadCodeRules.ts
|
|
4761
|
+
var deadCodeRules = /* @__PURE__ */ new Set([
|
|
4762
|
+
"UnusedMember.Local",
|
|
4763
|
+
"UnusedType.Local",
|
|
4764
|
+
"UnusedParameter.Global",
|
|
4765
|
+
"UnusedParameter.Local",
|
|
4766
|
+
"NotAccessedField.Global",
|
|
4767
|
+
"NotAccessedField.Local",
|
|
4768
|
+
"NotAccessedVariable.Local",
|
|
4769
|
+
"UnusedAutoPropertyAccessor.Global",
|
|
4770
|
+
"UnusedAutoPropertyAccessor.Local",
|
|
4771
|
+
"ClassNeverInstantiated.Global",
|
|
4772
|
+
"ClassNeverInstantiated.Local",
|
|
4773
|
+
"UnusedMethodReturnValue.Global",
|
|
4774
|
+
"UnusedMethodReturnValue.Local",
|
|
4775
|
+
"UnusedVariable.Compiler",
|
|
4776
|
+
"RedundantUsingDirective"
|
|
4777
|
+
]);
|
|
4778
|
+
|
|
4779
|
+
// src/commands/dotnet/filterIssues.ts
|
|
4780
|
+
function filterIssues(issues, all) {
|
|
4781
|
+
const suppress = new Set(loadConfig().dotnet?.inspect.suppress ?? []);
|
|
4782
|
+
return issues.filter(
|
|
4783
|
+
(i) => (all || deadCodeRules.has(i.typeId)) && !suppress.has(i.typeId)
|
|
4784
|
+
);
|
|
4785
|
+
}
|
|
4786
|
+
|
|
4776
4787
|
// src/commands/dotnet/findSolution.ts
|
|
4777
4788
|
import { readdirSync as readdirSync4 } from "fs";
|
|
4778
4789
|
import { dirname as dirname16, join as join17 } from "path";
|
|
@@ -4887,14 +4898,6 @@ function resolveSolution(sln) {
|
|
|
4887
4898
|
}
|
|
4888
4899
|
return findSolution();
|
|
4889
4900
|
}
|
|
4890
|
-
function runAndParse(resolved, changedFiles, all, swea) {
|
|
4891
|
-
const start3 = Date.now();
|
|
4892
|
-
const report = runInspectCode(resolved, changedFiles.join(";"), swea);
|
|
4893
|
-
const elapsed = Date.now() - start3;
|
|
4894
|
-
const allIssues = parseInspectReport(report);
|
|
4895
|
-
const issues = all ? allIssues : allIssues.filter((i) => deadCodeRules.has(i.typeId));
|
|
4896
|
-
return { issues, elapsed };
|
|
4897
|
-
}
|
|
4898
4901
|
function reportResults(issues, elapsed) {
|
|
4899
4902
|
if (issues.length > 0) displayIssues(issues);
|
|
4900
4903
|
else console.log(chalk55.green("No issues found"));
|
|
@@ -4913,13 +4916,15 @@ async function inspect(sln, options2) {
|
|
|
4913
4916
|
console.log(
|
|
4914
4917
|
chalk55.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
4915
4918
|
);
|
|
4916
|
-
const
|
|
4919
|
+
const start3 = Date.now();
|
|
4920
|
+
const report = runInspectCode(
|
|
4917
4921
|
resolved,
|
|
4918
|
-
changedFiles,
|
|
4919
|
-
!!options2.all,
|
|
4922
|
+
changedFiles.join(";"),
|
|
4920
4923
|
!!options2.swea
|
|
4921
4924
|
);
|
|
4922
|
-
|
|
4925
|
+
const elapsed = Date.now() - start3;
|
|
4926
|
+
const issues = filterIssues(parseInspectReport(report), !!options2.all);
|
|
4927
|
+
reportResults(issues, elapsed);
|
|
4923
4928
|
}
|
|
4924
4929
|
|
|
4925
4930
|
// src/commands/registerDotnet.ts
|