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

Command-line parsing problem after 4.8.3. #403

Closed
yuichi-github opened this issue Dec 30, 2020 · 4 comments
Closed

Command-line parsing problem after 4.8.3. #403

yuichi-github opened this issue Dec 30, 2020 · 4 comments
Labels

Comments

@yuichi-github
Copy link

Describe the bug
It is likely that a command-line parsing problem has occurred after 4.8.3.
(4.8.2 is all fine.)

To Reproduce
Cobertura report will be expected by the command-line below:
(Under PowerShell)
. 'C:\work\ReportGenerator.4.8.3\tools\net47\ReportGenerator.exe' "-reports:C:\work\Coverages***.xml" "-targetdir:C:\work\output" "-reporttypes:Cobertura"

But HTML report will be generated.

@danielpalme
Copy link
Owner

In 4.8.3 I had to fix an issue regarding command line parsing (see #401).
This could be a not intended side effect.

However I'm not able to reproduce the issue. I'm also using Powershell.
Can you please execute again and check the log output in your console.

For me it's:

 . 'ReportGenerator.exe' "-reports:Coverage*.xml" "-targetdir:cobertura" "-reporttypes:Cobertura"


2020-12-30T09:49:56: Arguments
2020-12-30T09:49:56:  -reports:Coverage*.xml
2020-12-30T09:49:56:  -targetdir:cobertura
2020-12-30T09:49:56:  -reporttypes:Cobertura
2020-12-30T09:49:56: Writing report file 'cobertura\Cobertura.xml'
2020-12-30T09:49:56: Report generation took 0,2 seconds

@yuichi-github
Copy link
Author

Thank you for your trying.
And sorry, the procedure I wrote was not precise.

The complete script that can reproduce the problem is below:

$reportGeneratorPath = "D:\work\test\ReportGenerator.4.8.3\tools\net47\ReportGenerator.exe"
$reportsParam = "D:\work\test\input\*.xml"
$targetPath = "D:\work\test\output"
$typePart = ' "-reporttypes:Cobertura"'

# the problem will occur.
. $reportGeneratorPath "-reports:$($reportsParam)" "-targetdir:$($targetPath)"$typePart

# Workaround: using 'Invoke-Expression'
Invoke-Expression @"
. $reportGeneratorPath "-reports:$($reportsParam)" "-targetdir:$($targetPath)"$typePart
"@

@danielpalme
Copy link
Owner

Thanks. Now I was able to reproduce your issue.

The problem is your parameter $typePart = ' "-reporttypes:Cobertura"'. It contains a leading space.
If you remove the space and use the following command instead, it also works (I added a leading space before $typePart):

. $reportGeneratorPath "-reports:$($reportsParam)" "-targetdir:$($targetPath)" $typePart

I would recommend this solution, it's not "correct" to add spaces to command line parameters itself. Instead you should add the space between the parameters.

Nevertheless I made a change to ReportGenerator 4.8.4 which removes leading and trailing spaces from command line parameters. This also fixes your problem.

@yuichi-github
Copy link
Author

I've just made sure the problem was fixed in 4.8.4.
Thanks for your quick action !

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

No branches or pull requests

2 participants