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

ReportGenerator documentation example does work #2535

Closed
AtwoodTM opened this issue Jul 13, 2020 · 2 comments
Closed

ReportGenerator documentation example does work #2535

AtwoodTM opened this issue Jul 13, 2020 · 2 comments

Comments

@AtwoodTM
Copy link

AtwoodTM commented Jul 13, 2020

Description

The ReportGenerator documentation example does not work. Using the exact example provided, FAKE replies with:

Script is not valid:
/mnt/c/users/ThomasMAtwood/repos/test-project/build.fsx (282,34)-(282,43): Error FS0039: The record label 'TargetDir' is not defined. Maybe you want one of the following:
Targets
Target
TargetInfo
/mnt/c/users/[UserProfile]/repos/test-project/build.fsx (284,9)-(284,51): Error FS0001: Type mismatch. Expecting a
'IGlobbingPattern -> unit'
but given a
'string list -> unit'
The type 'IGlobbingPattern' does not match the type 'string list'
/mnt/c/users/[UserProfile]/repos/test-project/build.fsx (284,9)-(284,51): Error FS0001: Type mismatch. Expecting a
'IGlobbingPattern -> unit'
but given a
'string list -> unit'
The type 'IGlobbingPattern' does not match the type 'string list'

where lines 273-288 are:

273 Target.create "GenerateReports" ( fun _ ->
274
275     Trace.log("******************************************")
276     Trace.log("*** Running target: GenerateReports'   ***")
277     Trace.log("******************************************")
278
279     //Shell.Exec ("reportgenerator \"-reports:./test/coverage.cobertura.xml\" \"-targetdir:report/codecoverage\" \"-sourcedirs:test\"", "" ,"./") |> ignore
280
281     Target.create "Generate Reports" (fun _ ->
282         let parameters p = { p with TargetDir = "c:/reports/" }
283         !! "**/opencover.xml"
284         |> ReportGenerator.generateReports parameters
285     )
286
287     Trace.log "Completed reports."
288 )

Repro steps

To reproduce, try the example code.

Expected behavior

The expected code would allow for the ReportGenerator to work.

Actual behavior

Please provide a description of the actual behavior you observe.

Known workarounds

There are no known workarounds

Related information

  • Windows 10 PowerShell and WSL 2.0 with Ubuntu 20.04
  • .NET Core 3.1
  • Fake 5.20.2
@github-actions
Copy link
Contributor

Welcome to the FAKE community! Thank you so much for creating your first issue and therefore improving the project!

@matthid
Copy link
Member

matthid commented Sep 3, 2020

Hey @AtwoodTM I know it took a while, but thanks for reporting this. Yes indeed the correct code is:

Target.create "Generate Reports" (fun _ ->
  !! "**/opencover.xml"
  |> Seq.toList
  |> ReportGenerator.generateReports (fun p -> { p with TargetDir = "c:/reports/" })
)

For some reason that module takes a list and inference in F# is not strong enough to figure out the types when defining the function as in the docs (a type hint would be required) :(
In any chase I changed it to a sequence in the next version and changed the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants