I have installed SonarQube successfully and executed command $sonar-runner on sample project provided in sonar-examples-master folder. But when I am trying to see report on browser it shows me everything 0 and The project has passed the quality gate. in the status.
I tried with my project also. Can anybody help me? Is there anything I am missing with?
You also appear to have 0 lines of code. Double-check your configuration and make sure you properly specified sonar.sources. Your analysis log should also give you some hints about how many source files were found during analysis.
Related
I'd like to ask for some help about setting up the DotTrace plugin for one of our TeamCity builds - so far I've followed the instructions here, and got a build that sometimes works:
https://blog.jetbrains.com/dotnet/2016/02/16/performance-profiling-in-continuous-integration-an-updated-dottrace-plugin-to-teamcity/
However, this is sometimes failing because the build produces two snapshots (snapshot.dtp and snapshot-2.dtp).
After much trial-and-error I've found out that sometimes the reason this fails is because my tests sometimes appear in the first .dtp file (which is the one used by DotTrace's Reporter.exe), and sometimes in the second file.
The other .dtp file appears to be associated with the nunit3-console.exe program, and so should be excluded, since I've added this program to "Process Filters" in the TeamCity build setup:
*nunit3-console.exe
(I've tried every combination here, including entering the fully qualified file path)
This has the effect of adding the following line to the dotTrace.project.xml file when the profiler is run:
<ProcessNameFilter>*nunit3-console.exe</ProcessNameFilter>
My understanding is that this should stop the named process from being profiled (so that the extra .dtp file isn't produced. However when the build is running, I see the following lines in the log file:
[16:01:04][Step 12/14] dotTrace Console Profiler 2018.3.2 build 777.0.20190124.112417. Copyright (C) 2019 JetBrains s.r.o.
[16:01:10][Step 12/14] Profiling in progress...
[16:01:10][Step 12/14] Executable='[file path]\nunit3-console.exe' (non-child) is being passed for filtering
[16:01:10][Step 12/14] Passed filter executable='[file path]\nunit3-console.exe'
This is showing that the nunit3-console.exe is not being excluded, as the filter would suggest.
The closest advice I can find is here, which appears to suggest what I'm doing, but is only for NUnit 2:
https://www.jetbrains.com/help/profiler/Profiling_Guidelines__Profiling_Unit_Tests.html
Does anyone know of a way to ensure nunit3-console.exe is excluded, so that it does not produce a snapshot file?
This plugin produces several snapshots by design and generates report based on all snapshots so filtering is not needed here.
I've created the issue
I have just upgraded to SonarQube 6.4 and at the same time moved to mysql. Whenever I try to parse a particular solution I get the message:
can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
I am running the scanner through VSTS using the new SonarQube tasks. I have also tried to pass the -X flag to SQ but it is not getting through the VSTS task. I have also upped the mysql max packet to 512M and restarted both mysql and Sonar servers. I'm at a loss
Have a look at the post here:
https://github.com/SonarSource/sonar-csharp/issues/958
and follow the advice in the bottom:
The problem it's caused by /d:sonar.source="Project" or /d:sonar.tests="Project.Tests", just remove and works.
It works for me.
In my case, along with the exclusions, I had written
sonar.sources=.
Once I removed this, it started working.
"sonar.tests.inclusions=src/**/*.spec.ts" and "sonar.tests=src" are in conflict, take just only one
Access the Sonar, Enter your project screen in the master branch followed:
Click Administration> Analysis Scope> In *Code coverage options *Duplications
*Source File Exclusions
insert the folder that may be being counted twice when reading the code, in my case it was the src folder so I put it in one of the ** /src/ **(no spaces) fields and the problem was solved
If you have mentioned exclusion property in the test command and also in the sonar-project.properties file.
Remove it from either of those.
Check all properties, remove any duplicates.
I am fairly new to TeamCity and have recently been tasked with creating various builds, which I have done with no real issues.
What I am trying to do now though is include an external text file into the build output.
The external text file will be received from a service call made during the build.
These are my intended build steps:
Check out solution.
Restore packages.
Run tests.
Call web service with a configurable parameter and receive text file back.
Include text file in build.
Deploy.
Steps 1,2,3 and 6 are covered.
What are my options here? I must confess I do not really know where to begin.
I've spent some time today googling but it has been tricky getting the correct search term to return information on what I am trying to achieve.
I've seen some confusing articles on a 'meta runner'.
Any pointers to get me started in the right direction would be much appreciated.
Thanks.
Use a TeamCity command line build step - https://confluence.jetbrains.com/display/TCD9/Command+Line
I assume you are using build steps for all the other steps you listed so this is simply another of those.
The command line process would run somewhere under your checkout folder and thus anything it downloads would be made available as an artifact for your build
So our TFS 2013 builds do everything correctly except report code coverage. I've seen similar questions here, e.g. TFS 2013 - No Code Coverage Results, but we've already tried the suggested fixes with no results.
UPDATE 1 — we've taken more steps to try to resolve this; here's the complete list:
Ensured Visual Studio Ultimate was installed on the build server
Tried setting the build definition's "CodeCoverageEnabled" to true as well as the "Code coverage is enabled" setting
Ensured the build was using the Debug configuration and that PDBs were being generated for the DLLs to be tested
Added a .runsettings file with the correct ModulePath included under <CodeCoverage> (verified in build log that the module path was being interpreted correctly; it would produce errors if we intentionally malformed it)
Checked in .runsettings file
Set build definition to "Custom" and pointed to .runsettings file
The build process itself works fine. We can get code coverage results when we build the project locally in the IDE. On the build server, both MSTest and NUnit test projects run fine, and we see pass/fail results as expected. The "No Code Coverage Results" message still plagues us though.
Update 2 -
Here is what we see in the run log:
Somebody suggested homegrown code-coverage calculator in https://stackoverflow.com/a/16198120/141508, but it'd be a crime to spend $150 bazillion-thousand dollars on TFS 2013 & VS Ultimate 2013 with MSDN and still not have this one basic function working.
Add a run settings file to source control. Set the tests to custom and point to the run settings file. More info on using the .runsettings file can be found on msdn: http://msdn.microsoft.com/en-us/library/jj159530.aspx
I was experiencing the same problem. My issue was with the ModulePath. The MSDN examples suggest you can just use the name of a target binary. That was not working for me. However, when I made the name a regular expression, it worked. I am also dumping build output into one folder so that pdb and other reference files are found. Hope that helps.
<ModulePath>.*Administration\.dll.*</ModulePath>
I am using local build server with Visual Studio online with a .runsettings file and I had exactly the same issue.
None of the trickery above helped, so I tested the build script on the hosted build controller and it worked fine, so I decided the problem must be the build server itself.
I changed the Build Service account from "Network Service" to a regular windows user account in the TFS Configuration Tool and now code coverage is collected. Note that this user will need access to the TFS build directories.
I found this question because I saw something peculiar on this article. (Look for the "Delay" setting that defaults to 60).
d. Add a new argument ‘Delay’, enter details as mentioned below
Name – Delay, Direction – In, ArgumentType-Int32, Default Value – 60
This argument is required to delay coverage check, so that required build details are filled up by the build agent, this delay varies from
system to system, in some cases this might not be required at all.
http://www.prowareness.com/blog/failing-build-on-insufficient-code-coverageblock-coverage-part-3/
Maybe try putting in a "delay" work-flow item in the template you are using.......
I am running NCover 3, with TeamCity 7. TeamCity is kicking off the cover process and I can find the fullcoveragereport.html in my file directory for the build, however TeamCity is not creating a tab for the coverage.
I cant view this Ncover fullcoveragereport.html inside of TeamCity. I think it has to do with my report tab settings, under the start page section, it says
"Relative path from the root of build's artifacts to a start page of the generated report.
To reference a file from an archive, use the [path-to-archive]![relative-path] syntax." Is this in reference to the build server machine, that is, I want to point it from the .buildserver folder to the coverage.zip folder?
I now get a "This is an autogenerated index file (there was no index.html found in the generated report)." in the coverage tab, I think I am getting close...
Any ideas, or things I might have missed?
So it seems as though using many missread the documentation and put in //
as the parameter . They also put in FullCoverageReport:Html:{teamcity.report.path}.
In actuality it should be one entire string with the or in there which throws some people off.
//or FullCoverageReport:Html:{teamcity.report.path}
In this scenario (im not 100% sure why), this still didnt work. I was pleased to find out that
//or Summary:Html:{teamcity.report.path}
Will work. Its not as verbose as the full NCover report but it beats an empty index.html file.
it turns out there is an issue with the FullReport with NCover 3 and TeamCity 7 , read more about it below.
http://youtrack.jetbrains.com/issue/TW-20635
I'm going to try some of the other reporting commands (see below) and see if i can make an ad-hoc FullCoverageReport to suffice.
http://docs.ncover.com/kb/reports-available-in-ncover-classic-and-ncover-complete/