-
Notifications
You must be signed in to change notification settings - Fork 789
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
add identifier analysis script #13486
Conversation
Note the formulation in The FCS API is far from perfect and things like formatting of types are a bit messy (type abbreviations and other features make that a bit tricky). But we can still extract a lot of useful information from adhoc tools like this. |
printfn " %s" (vUse.ToString()) | ||
printfn "") | ||
|
||
(* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. I hacked it across from https://github.com/fsprojects/FSharp.Formatting/blob/main/src/fsdocs-tool/ProjectCracker.fs and I think it was all a workaround for something, I'm not sure. Or else maybe it was there to cope with non-standard install locations for dotnet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW Ionide.ProjInfo is here: https://github.com/ionide/proj-info
It's the project cracking code used by the Ionide tooling for F# in VSCode
* ValRepInfoForDisplay added for improved quick info for functions defined in expressions * Update * Update QuickInfoTests.fs * Update QuickInfoTests.fs * Update * add identifier analysis script (#13486) * add identifier analysis script * add identifier analysis script * Update fantomas alpha 11 (#13481) Co-authored-by: Don Syme <donsyme@fastmail.fm> Co-authored-by: Peter Semkin <petersemkin@duck.com> Co-authored-by: Don Syme <dsyme@users.noreply.github.com> Co-authored-by: Florian Verdonck <florian.verdonck@outlook.com> Co-authored-by: Petr Semkin <psfinaki@users.noreply.github.com>
* ValRepInfoForDisplay added for improved quick info for functions defined in expressions * Update * Update QuickInfoTests.fs * Update QuickInfoTests.fs * Update * add identifier analysis script (#13486) * add identifier analysis script * add identifier analysis script * Update fantomas alpha 11 (#13481) * Allow lower-case DU cases when RequireQualifiedAccess is specified (#13432) * Allow lower-case DU cases when RequireQualifiedAccess is specified * Fix PR suggestions and Add more testing * Protect feature under preview version * Add a NotUpperCaseConstructorWithoutRQA warning to be raised in lang version preview * Fix formatting * regularize some names (#13489) * normalize some names * format code * fix build * Subtraction of two chars, new conversions, and fixes for dynamic operator invocations and QuotationToExpression (#11681) Co-authored-by: Vlad Zarytovskii <vzaritovsky@hotmail.com> Co-authored-by: Don Syme <dsyme@users.noreply.github.com> * Mark backing fields as CompilerGenerated (fixes serialization of fields in FSI multiemit) (#13494) Co-authored-by: Don Syme <donsyme@fastmail.fm> Co-authored-by: Peter Semkin <petersemkin@duck.com> Co-authored-by: Don Syme <dsyme@users.noreply.github.com> Co-authored-by: Florian Verdonck <florian.verdonck@outlook.com> Co-authored-by: Petr Semkin <psfinaki@users.noreply.github.com> Co-authored-by: Edgar Gonzalez <edgar.gonzalez@fundourselves.com> Co-authored-by: Hadrian Tang <hadrianwttang@outlook.com> Co-authored-by: Vlad Zarytovskii <vzaritovsky@hotmail.com> Co-authored-by: Kevin Ransom (msft) <codecutter@hotmail.com>
Discussing codebase regularity with @psfinaki , here's a script to print a report by analysing all identifiers in an F# project by type.
Sample reports here:
FSharp.Compiler.Service.fsproj: https://gist.github.com/dsyme/13ad4220409914657b2a00d29a2427b6
FSharp.Build.fsproj: https://gist.github.com/dsyme/ea0b45d384465395a82c36970be82b7e
Run using:
For example this section of the output shows all the names used for
ValReprInfo
https://gist.github.com/dsyme/d47f113d7423e3cdc45a2f658c68a1a0I sometimes think F# should have a feature where you can put an attribute on a type saying "if you have a value of this type, it must be named according to this regular expression". I guess we could adjust this script easily to implement that as a check (so the tool reports warnings based on attributes)