Skip to content
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
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"fsharp-analyzers": {
"version": "0.26.0",
"version": "0.32.1",
"commands": [
"fsharp-analyzers"
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
uses: github/codeql-action/upload-sarif@v3
if: matrix.os == 'ubuntu-latest'
with:
sarif_file: ./reports
sarif_file: ./analysis.sarif
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ tests/FSharp.Literate.Tests/output2/
tests/FSharp.Literate.Tests/previous-next-output/

# Analyzer
reports/
analysis.sarif
5 changes: 2 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Ionide.KeepAChangelog.Tasks" Version="0.1.8" />
<PackageVersion Include="FSharp.Analyzers.Build" Version="0.3.0" />
<PackageVersion Include="G-Research.FSharp.Analyzers" Version="0.10.0" />
<PackageVersion Include="Ionide.Analyzers" Version="0.11.0" />
<PackageVersion Include="G-Research.FSharp.Analyzers" Version="0.18.0" />
<PackageVersion Include="Ionide.Analyzers" Version="0.14.7" />
</ItemGroup>
</Project>
31 changes: 24 additions & 7 deletions Directory.Solution.targets
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<Project>
<ItemGroup>
<ProjectsToAnalyze Include="src/**/*.fsproj" />
</ItemGroup>
<!-- Import the NuGet props file to get access to Pkg* variables -->
<Import Project="src/FSharp.Formatting/obj/FSharp.Formatting.fsproj.nuget.g.props" Condition="Exists('src/FSharp.Formatting/obj/FSharp.Formatting.fsproj.nuget.g.props')" />

<Target Name="AnalyzeSolution">
<MSBuild Projects="@(ProjectsToAnalyze)" Targets="AnalyzeFSharpProject" />
</Target>
</Project>
<ItemGroup>
<ProjectsToAnalyze Include="src/**/*.fsproj" />
</ItemGroup>

<Target Name="AnalyzeSolution" Condition="Exists('src/FSharp.Formatting/obj/FSharp.Formatting.fsproj.nuget.g.props')">
<PropertyGroup>
<CodeRoot>$(SolutionDir)</CodeRoot>
<FSharpAnalyzersOtherFlags>--analyzers-path &quot;$(PkgG-Research_FSharp_Analyzers)/analyzers/dotnet/fs&quot;</FSharpAnalyzersOtherFlags>
<FSharpAnalyzersOtherFlags>$(FSharpAnalyzersOtherFlags) --analyzers-path &quot;$(PkgIonide_Analyzers)/analyzers/dotnet/fs&quot;</FSharpAnalyzersOtherFlags>
<FSharpAnalyzersOtherFlags>$(FSharpAnalyzersOtherFlags) --exclude-analyzers PartialAppAnalyzer ReturnStructPartialActivePatternAnalyzer -c Release</FSharpAnalyzersOtherFlags>
<FSharpAnalyzersOtherFlags>$(FSharpAnalyzersOtherFlags) --code-root $(CodeRoot)</FSharpAnalyzersOtherFlags>
<FSharpAnalyzersOtherFlags>$(FSharpAnalyzersOtherFlags) --report &quot;$(CodeRoot)/analysis.sarif&quot;</FSharpAnalyzersOtherFlags>
</PropertyGroup>
<Delete Files="$(SolutionDir)/analysis.sarif" Condition="Exists('$(SolutionDir)/analysis.sarif')" />

<!-- Execute fsharp-analyzers with all projects in a single process -->
<Exec
Command="dotnet fsharp-analyzers $(FSharpAnalyzersOtherFlags) @(ProjectsToAnalyze->'--project &quot;%(FullPath)&quot;', ' ')"
ContinueOnError="true"
/>
</Target>
</Project>
4 changes: 0 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<Project>
<Import Project="../Directory.Build.props" />
<ItemGroup>
<PackageReference Include="FSharp.Analyzers.Build">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>build</IncludeAssets>
</PackageReference>
<PackageReference Include="G-Research.FSharp.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>analyzers</IncludeAssets>
Expand Down
8 changes: 0 additions & 8 deletions src/Directory.Build.targets

This file was deleted.

34 changes: 19 additions & 15 deletions src/FSharp.Formatting.ApiDocs/Categorise.fs
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,32 @@ let entities (nsIndex: int, ns: ApiDocNamespace, suppress) =
// TODO: use <exclude /> to do these, or work out if there's a better way
if suppress then
categoryEntities

// Remove FSharp.Data.UnitSystems.SI from the list-of-namespaces
// display - it's just so rarely used, has long names and dominates the docs.
//
// See https://github.com/fsharp/fsharp-core-docs/issues/57, we may rethink this
|> List.filter (fun e ->
(e.Symbol.Namespace <> Some "Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols"))
|> List.filter (fun e ->
(e.Symbol.Namespace <> Some "Microsoft.FSharp.Data.UnitSystems.SI.UnitNames"))
// Don't show 'AnonymousObject' in list-of-namespaces navigation
|> List.filter (fun e ->
// Remove FSharp.Data.UnitSystems.SI from the list-of-namespaces
// display - it's just so rarely used, has long names and dominates the docs.
//
// See https://github.com/fsharp/fsharp-core-docs/issues/57, we may rethink this
(e.Symbol.Namespace <> Some "Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols")
&& (e.Symbol.Namespace <> Some "Microsoft.FSharp.Data.UnitSystems.SI.UnitNames")

&&

// Don't show 'AnonymousObject' in list-of-namespaces navigation
not (
e.Symbol.Namespace = Some "Microsoft.FSharp.Linq.RuntimeHelpers"
&& e.Symbol.DisplayName = "AnonymousObject"
))
// Don't show 'FSharp.Linq.QueryRunExtensions' in list-of-namespaces navigation
|> List.filter (fun e ->
)

&&

// Don't show 'FSharp.Linq.QueryRunExtensions' in list-of-namespaces navigation
not (
e.Symbol.Namespace = Some "Microsoft.FSharp.Linq.QueryRunExtensions"
&& e.Symbol.DisplayName = "LowPriority"
))
|> List.filter (fun e ->
)

&&

not (
e.Symbol.Namespace = Some "Microsoft.FSharp.Linq.QueryRunExtensions"
&& e.Symbol.DisplayName = "HighPriority"
Expand Down
4 changes: 2 additions & 2 deletions src/FSharp.Formatting.ApiDocs/GenerateModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)

let tryGetTypeFromMemberName (memberName: string) =
let sub = removeParen memberName
let lastPeriod = sub.LastIndexOf(".")
let lastPeriod = sub.LastIndexOf('.')

if lastPeriod > 0 then
Some(memberName.Substring(0, lastPeriod))
Expand All @@ -879,7 +879,7 @@ type internal CrossReferenceResolver(root, collectionName, qualify, extensions)

let tryGetShortMemberNameFromMemberName (memberName: string) =
let sub = removeParen memberName
let lastPeriod = sub.LastIndexOf(".")
let lastPeriod = sub.LastIndexOf('.')

if lastPeriod > 0 then
Some(memberName.Substring(lastPeriod + 1))
Expand Down
21 changes: 12 additions & 9 deletions src/FSharp.Formatting.Common/YaafFSharpScripting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,18 @@ module internal CompilerServiceExtensions =
|> Seq.filter (fun file ->
let fileName = Path.GetFullPath file |> Path.GetFileName

dllFiles
|> List.exists (fun (dllFile: string) -> Path.GetFileName dllFile =? fileName)
|> not)
|> Seq.filter (fun file ->
if Path.GetFileName file =? "FSharp.Core.dll" then
FSharpAssemblyHelper.tryCheckFsCore file |> Option.isSome
else
true)
let dllNotAlreadyReferenced =
dllFiles
|> List.exists (fun (dllFile: string) -> Path.GetFileName dllFile =? fileName)
|> not

let checkFSharpCore =
if Path.GetFileName file =? "FSharp.Core.dll" then
FSharpAssemblyHelper.tryCheckFsCore file |> Option.isSome
else
true

dllNotAlreadyReferenced && checkFSharpCore)
|> Seq.toList

// See https://github.com/tpetricek/FSharp.Formatting/commit/5d14f45cd7e70c2164a7448ea50a6b9995166489
Expand Down Expand Up @@ -350,7 +354,6 @@ type internal FsiEvaluationException
(Log.formatArgs args)
(base.ToString())


/// Exception for invalid expression types
type internal FsiExpressionTypeException =
val private value: obj option
Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Formatting.Literate/ParseScript.fs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module internal CodeBlockUtils =
let rec private collectComment (comment: string) lines =
seq {
let findCommentEnd (comment: string) =
let cend = comment.LastIndexOf("*)")
let cend = comment.LastIndexOf("*)", StringComparison.OrdinalIgnoreCase)

if cend = -1 then
failwith "A (* comment was not closed"
Expand Down
Loading