Skip to content
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

Adds a script for removing unused diagnostics #44324

Merged
merged 3 commits into from Aug 24, 2021
Merged

Conversation

@orta
Copy link
Member

@orta orta commented May 28, 2021

This adds a script which only runs on linux boxes, that searches the codebase for every diagnostic and lets you know if nothing is found.

TODO: Add to CI.

@orta
Copy link
Member Author

@orta orta commented Jun 3, 2021

Screen Shot 2021-06-03 at 4 43 32 PM

I can use findstr to check

const diagName = line.split(":")[0].trim();

try {
execSync(`grep -rnw 'src' -e 'Diagnostics.${diagName}'`).toString();

This comment has been minimized.

@sandersn

sandersn Jun 8, 2021
Member

there's probably a platform-independent package on npm that does recursive file string search, although feature-detecting grep vs findstr would work too.

This comment has been minimized.

@orta

orta Jun 8, 2021
Author Member

wes thinks ripgrep ( https://www.npmjs.com/package/vscode-ripgrep ) should be a reasonable tradeoff here

This comment has been minimized.

@elibarzilay

elibarzilay Jun 11, 2021
Member

To avoid the offensive huge cost of this you could just grep all lines that include Diagnostics., print them to a temp file, then search through this file. Also, even if the names are well behaved, it would be better to add -F. Also, -n is redundant AFAICT.

(And doing it with a grep library seems like an overkill too...)

@@ -5793,10 +5617,6 @@
"category": "Message",
"code": 95001
},
"Convert function '{0}' to class": {

This comment has been minimized.

@sandersn

sandersn Jun 8, 2021
Member

I'm almost certain this message and the ones that follow are used in codefixes. I wonder why our fourslash tests don't fail with them gone.

@sandersn sandersn added this to Not started in PR Backlog Jun 8, 2021
@sandersn sandersn moved this from Not started to Waiting on author in PR Backlog Jun 8, 2021
Copy link
Member

@sandersn sandersn left a comment

Well...early in a release's development is the best time to try something like this.

@orta you want to try merging this early on Monday to see whether it breaks anything?

(I think @elibarzilay 's right about grep -- almost all the team can run this script in an environment with grep if they need to.)

PR Backlog automation moved this from Waiting on author to Needs merge Aug 20, 2021
@orta
Copy link
Member Author

@orta orta commented Aug 24, 2021

Yeah, lets do it

@orta orta merged commit 41dcad0 into microsoft:main Aug 24, 2021
9 checks passed
9 checks passed
@github-actions
build (10.x)
Details
@github-actions
CodeQL-Build
Details
@github-actions
build (12.x)
Details
@github-actions
build (14.x)
Details
@github-code-scanning
CodeQL 1 analysis not found
Details
@microsoft-cla
license/cla All CLA requirements met.
Details
@azure-pipelines
node10 Build #104277 succeeded
Details
@azure-pipelines
node12 Build #104275 succeeded
Details
@azure-pipelines
node14 Build #104276 succeeded
Details
PR Backlog automation moved this from Needs merge to Done Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
PR Backlog
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants