SonarSource / sonar-dotnet

Code analyzer for C# and VB.NET projects
https://redirect.sonarsource.com/plugins/csharp.html
Other
798 stars 229 forks source link

This project is Empty #2171

Closed drashnane closed 5 years ago

drashnane commented 5 years ago

Description

OS: Mac OS 10.13.6 SonarQube:7.4.0.18908 with builtin database SonarC#:7.9.1 SonarScanner:3.2.0.1227

sonarqube page always shows "This Project Is Empty"

Repro steps

Command:

sonar-scanner -X -Dsonar.language=cs -Dsonar.projectName=console1 -Dsonar.projectVersion=1.0 -Dsonar.visualstudio.solution=console1/console1.sln -Dsonar.sourceEncoding=UTF-8 -Dsonar.projectKey=cf:console1 -Dsonar.sources=console1/console1 -Dsonar.visualstudio.enable=true -Dsonar.projectBaseDir=/ssd/apache/Build/builder/worksapce/sonartest

Logs:

10:28:00.436 INFO: Project root configuration file: NONE 10:28:00.451 INFO: SonarQube Scanner 3.2.0.1227 10:28:00.451 INFO: Java 1.8.0_181 Oracle Corporation (64-bit) 10:28:00.451 INFO: Mac OS X 10.13.6 x86_64 10:28:00.547 DEBUG: keyStore is : 10:28:00.548 DEBUG: keyStore type is : jks 10:28:00.548 DEBUG: keyStore provider is : 10:28:00.548 DEBUG: init keystore 10:28:00.548 DEBUG: init keymanager of type SunX509 10:28:00.624 DEBUG: Create: /Users/tao/.sonar/cache 10:28:00.625 INFO: User cache: /Users/tao/.sonar/cache 10:28:00.625 DEBUG: Create: /Users/tao/.sonar/cache/_tmp 10:28:00.627 DEBUG: Extract sonar-scanner-api-batch in temp... 10:28:00.633 DEBUG: Get bootstrap index... 10:28:00.633 DEBUG: Download: http://localhost:9000/batch/index 10:28:00.671 DEBUG: Get bootstrap completed 10:28:00.677 DEBUG: Create isolated classloader... 10:28:00.682 DEBUG: Start temp cleaning... 10:28:00.688 DEBUG: Temp cleaning done 10:28:00.688 DEBUG: Execution getVersion 10:28:00.690 INFO: SonarQube server 7.4.0 10:28:00.690 INFO: Default locale: "zh_CN", source code encoding: "UTF-8" 10:28:00.691 DEBUG: Work directory: /ssd/apache/Build/builder/worksapce/sonartest/.scannerwork 10:28:00.692 DEBUG: Execution execute 10:28:00.805 INFO: Publish mode 10:28:00.887 INFO: Load global settings 10:28:00.918 DEBUG: GET 200 http://localhost:9000/api/settings/values.protobuf | time=26ms 10:28:00.934 INFO: Load global settings (done) | time=47ms 10:28:00.939 INFO: Server id: BF41A1F2-AWe6G2aAuRvRAwqSZSgH 10:28:00.946 INFO: User cache: /Users/tao/.sonar/cache 10:28:01.117 INFO: Load/download plugins 10:28:01.117 INFO: Load plugins index 10:28:01.122 DEBUG: GET 200 http://localhost:9000/api/plugins/installed | time=5ms 10:28:01.144 INFO: Load plugins index (done) | time=27ms 10:28:01.148 INFO: Plugin [l10nzh] defines 'l10nen' as base plugin. This metadata can be removed from manifest of l10n plugins since version 5.2. 10:28:01.161 INFO: Load/download plugins (done) | time=44ms 10:28:01.195 DEBUG: Plugins: 10:28:01.196 DEBUG: SonarPython 1.10.0.2131 (python) 10:28:01.196 DEBUG: Chinese Pack 1.24 (l10nzh) 10:28:01.196 DEBUG: Code Smells 4.0.0 (smells) 10:28:01.196 DEBUG: SonarCSS 1.0.2.611 (cssfamily) 10:28:01.196 DEBUG: JaCoCo 1.0.1.143 (jacoco) 10:28:01.196 DEBUG: SonarGo 1.1.0.1612 (go) 10:28:01.196 DEBUG: SonarKotlin 1.2.1.2009 (kotlin) 10:28:01.196 DEBUG: Svn 1.9.0.1295 (scmsvn) 10:28:01.196 DEBUG: SonarJS 5.0.0.6962 (javascript) 10:28:01.196 DEBUG: GitLab Auth 1.3.2 (authgitlab) 10:28:01.196 DEBUG: SonarRuby 1.2.1.2009 (ruby) 10:28:01.197 DEBUG: SonarC# 7.9.1.7622 (csharp) 10:28:01.197 DEBUG: SonarJava 5.9.2.16552 (java) 10:28:01.197 DEBUG: LDAP 2.2.0.608 (ldap) 10:28:01.197 DEBUG: Git 1.6.0.1349 (scmgit) 10:28:01.197 DEBUG: SonarFlex 2.4.0.1222 (flex) 10:28:01.197 DEBUG: SonarXML 1.5.1.1452 (xml) 10:28:01.197 DEBUG: SonarPHP 2.14.0.3569 (php) 10:28:01.197 DEBUG: GitLab 4.0.0 (gitlab) 10:28:01.197 DEBUG: SonarTS 1.8.0.3332 (typescript) 10:28:01.197 DEBUG: SonarVB 7.7.0.7192 (vbnet) 10:28:01.212 INFO: Loaded core extensions: 10:28:01.536 INFO: Process project properties 10:28:01.541 DEBUG: Process project properties (done) | time=5ms 10:28:01.542 INFO: Execute project builders 10:28:01.543 INFO: Execute project builders (done) | time=1ms 10:28:01.567 INFO: Load project repositories 10:28:01.577 DEBUG: GET 200 http://localhost:9000/batch/project.protobuf?key=cf%3Aconsole1 | time=10ms 10:28:01.612 INFO: Load project repositories (done) | time=44ms 10:28:01.692 DEBUG: Available languages: 10:28:01.692 DEBUG: Python => "py" 10:28:01.692 DEBUG: CSS => "css" 10:28:01.693 DEBUG: Go => "go" 10:28:01.693 DEBUG: Kotlin => "kotlin" 10:28:01.693 DEBUG: JavaScript => "js" 10:28:01.693 DEBUG: Ruby => "ruby" 10:28:01.693 DEBUG: C# => "cs" 10:28:01.693 DEBUG: Java => "java" 10:28:01.693 DEBUG: Flex => "flex" 10:28:01.693 DEBUG: XML => "xml" 10:28:01.693 DEBUG: PHP => "php" 10:28:01.693 DEBUG: TypeScript => "ts" 10:28:01.693 DEBUG: Visual Basic .NET => "vbnet" 10:28:01.699 INFO: Load quality profiles 10:28:01.738 DEBUG: GET 200 http://localhost:9000/api/qualityprofiles/search.protobuf?projectKey=cf%3Aconsole1 | time=38ms 10:28:01.743 INFO: Load quality profiles (done) | time=44ms 10:28:01.753 INFO: Load active rules 10:28:01.789 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5D-uRvRAwqSZTvp&p=1&ps=500 | time=35ms 10:28:01.859 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5GFuRvRAwqSZTxg&p=1&ps=500 | time=48ms 10:28:01.899 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5FPuRvRAwqSZTwi&p=1&ps=500 | time=37ms 10:28:01.956 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5IMuRvRAwqSZT3e&p=1&ps=500 | time=55ms 10:28:02.004 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5JguRvRAwqSZT5Z&p=1&ps=500 | time=41ms 10:28:02.058 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5KYuRvRAwqSZT6Z&p=1&ps=500 | time=51ms 10:28:02.159 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5L7uRvRAwqSZT-R&p=1&ps=500 | time=99ms 10:28:02.304 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5OxuRvRAwqSZUG8&p=1&ps=500 | time=135ms 10:28:02.364 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5Q8uRvRAwqSZUM9&p=1&ps=500 | time=43ms 10:28:02.373 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5S6uRvRAwqSZUNu&p=1&ps=500 | time=8ms 10:28:02.433 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5WTuRvRAwqSZUQc&p=1&ps=500 | time=59ms 10:28:02.484 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5YruRvRAwqSZUS8&p=1&ps=500 | time=49ms 10:28:02.530 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWe6G5aKuRvRAwqSZUU7&p=1&ps=500 | time=43ms 10:28:02.540 INFO: Load active rules (done) | time=787ms 10:28:02.542 INFO: Load metrics repository 10:28:02.550 DEBUG: GET 200 http://localhost:9000/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=1 | time=7ms 10:28:02.558 INFO: Load metrics repository (done) | time=16ms 10:28:02.577 INFO: Project key: cf:console1 10:28:02.577 INFO: Project base dir: /ssd/apache/Build/builder/worksapce/sonartest 10:28:02.578 DEBUG: Start recursive analysis of project modules 10:28:02.578 INFO: ------------- Scan console1 10:28:02.666 INFO: Base dir: /ssd/apache/Build/builder/worksapce/sonartest 10:28:02.666 INFO: Working dir: /ssd/apache/Build/builder/worksapce/sonartest/.scannerwork 10:28:02.667 INFO: Source paths: console1/console1 10:28:02.667 INFO: Source encoding: UTF-8, default locale: zh_CN 10:28:02.670 INFO: Load server rules 10:28:02.882 DEBUG: GET 200 http://localhost:9000/api/rules/list.protobuf | time=210ms 10:28:02.896 INFO: Load server rules (done) | time=226ms 10:28:02.992 DEBUG: Declared extensions of language Python were converted to sonar.lang.patterns.py : /*.py 10:28:02.992 DEBUG: Declared extensions of language CSS were converted to sonar.lang.patterns.css : */.css,/*.less,/*.scss 10:28:02.992 DEBUG: Declared extensions of language Go were converted to sonar.lang.patterns.go : */.go 10:28:02.992 DEBUG: Declared extensions of language Kotlin were converted to sonar.lang.patterns.kotlin : /*.kt 10:28:02.992 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : /*.js,*/.jsx,/*.vue 10:28:02.992 DEBUG: Declared extensions of language Ruby were converted to sonar.lang.patterns.ruby : /*.rb 10:28:02.993 DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : */.cs 10:28:02.993 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : /*.java,/*.jav 10:28:02.993 DEBUG: Declared extensions of language Flex were converted to sonar.lang.patterns.flex : */.as 10:28:02.993 DEBUG: Declared extensions of language XML were converted to sonar.lang.patterns.xml : /*.xml,/*.xsd,*/.xsl 10:28:02.993 DEBUG: Declared extensions of language PHP were converted to sonar.lang.patterns.php : /*.php,/*.php3,*/.php4,/*.php5,/*.phtml,*/.inc 10:28:02.993 DEBUG: Declared extensions of language TypeScript were converted to sonar.lang.patterns.ts : /*.ts,*/.tsx 10:28:02.993 DEBUG: Declared extensions of language Visual Basic .NET were converted to sonar.lang.patterns.vbnet : */.vb 10:28:02.993 INFO: Language is forced to cs 10:28:03.001 INFO: Index files 10:28:03.005 WARN: File '/ssd/apache/Build/builder/worksapce/sonartest/console1/console1/console1.csproj' is ignored because it doesn't belong to the forced language 'cs' 10:28:03.012 DEBUG: 'console1/console1/Program.cs' indexed with language 'cs' 10:28:03.012 INFO: 1 file indexed 10:28:03.013 INFO: Quality profile for cs: Sonar way 10:28:03.756 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project 10:28:03.757 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing 10:28:03.757 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing 10:28:03.757 DEBUG: 'Import external issues report' skipped because one of the required properties is missing 10:28:03.758 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project 10:28:03.758 DEBUG: 'PylintSensor' skipped because there is no related file in current project 10:28:03.758 DEBUG: 'PylintImportSensor' skipped because there is no related file in current project 10:28:03.758 DEBUG: 'PythonXUnitSensor' skipped because there is no related file in current project 10:28:03.758 DEBUG: 'SmellMeasuresSensor' skipped because there is no related file in current project 10:28:03.758 DEBUG: 'SonarCSS Metrics' skipped because there is no related file in current project 10:28:03.758 DEBUG: 'SonarCSS Rules' skipped because there is no related file in current project 10:28:03.759 DEBUG: 'Import of stylelint issues' skipped because there is no related file in current project 10:28:03.759 DEBUG: 'SonarGo' skipped because there is no related file in current project 10:28:03.759 DEBUG: 'Go Unit Test Report' skipped because there is no related file in current project 10:28:03.759 DEBUG: 'Import of go vet issues' skipped because there is no related file in current project 10:28:03.760 DEBUG: 'Import of Golint issues' skipped because there is no related file in current project 10:28:03.760 DEBUG: 'Import of GoMetaLinter issues' skipped because there is no related file in current project 10:28:03.760 DEBUG: 'Kotlin Sensor' skipped because there is no related file in current project 10:28:03.760 DEBUG: 'Import of detekt issues' skipped because there is no related file in current project 10:28:03.760 DEBUG: 'Import of Android Lint issues' skipped because one of the required properties is missing 10:28:03.760 DEBUG: 'SonarJS' skipped because there is no related file in current project 10:28:03.761 DEBUG: 'SonarJS Coverage' skipped because there is no related file in current project 10:28:03.761 DEBUG: 'Import of ESLint issues' skipped because one of the required properties is missing 10:28:03.761 DEBUG: 'ESLint-based SonarJS' skipped because there is no related file in current project 10:28:03.761 DEBUG: 'Ruby Sensor' skipped because there is no related file in current project 10:28:03.761 DEBUG: 'Import of RuboCop issues' skipped because one of the required properties is missing 10:28:03.761 DEBUG: 'SimpleCov Sensor for Ruby coverage' skipped because there is no related file in current project 10:28:03.762 DEBUG: 'Import of Checkstyle issues' skipped because there is no related file in current project 10:28:03.762 DEBUG: 'Import of PMD issues' skipped because one of the required properties is missing 10:28:03.763 DEBUG: 'Import of SpotBugs issues' skipped because there is no related file in current project 10:28:03.763 DEBUG: 'SurefireSensor' skipped because there is no related file in current project 10:28:03.763 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project 10:28:03.763 DEBUG: 'Flex' skipped because there is no related file in current project 10:28:03.763 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project 10:28:03.763 DEBUG: 'XML Sensor' skipped because there is no related file in current project 10:28:03.763 DEBUG: 'PHP sensor' skipped because there is no related file in current project 10:28:03.763 DEBUG: 'Analyzer for "php.ini" files' skipped because there is no related file in current project 10:28:03.763 DEBUG: 'SonarTS' skipped because there is no related file in current project 10:28:03.764 DEBUG: 'SonarTS Coverage' skipped because there is no related file in current project 10:28:03.764 DEBUG: 'Import of TSLint issues' skipped because one of the required properties is missing 10:28:03.764 DEBUG: 'VB.NET Properties' skipped because there is no related file in current project 10:28:03.767 DEBUG: 'C# Tests Coverage Report Import' skipped because one of the required properties is missing 10:28:03.767 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because one of the required properties is missing 10:28:03.768 DEBUG: 'C# Unit Test Results Import' skipped because one of the required properties is missing 10:28:03.768 DEBUG: 'VB.NET' skipped because there is no related file in current project 10:28:03.768 DEBUG: 'Visual Basic .NET Tests Coverage Report Import' skipped because there is no related file in current project 10:28:03.768 DEBUG: '[Deprecated] Visual Basic .NET Integration Tests Coverage Report Import' skipped because there is no related file in current project 10:28:03.768 DEBUG: 'Visual Basic .NET Unit Test Results Import' skipped because there is no related file in current project 10:28:03.768 DEBUG: 'Java CPD Block Indexer' skipped because there is no related file in current project 10:28:03.769 DEBUG: Sensors : JaCoCo XML Report Importer -> C# Properties -> SonarJavaXmlFileSensor -> C# -> Zero Coverage Sensor 10:28:03.769 INFO: Sensor JaCoCo XML Report Importer [jacoco] 10:28:03.771 DEBUG: No reports found 10:28:03.771 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms 10:28:03.771 INFO: Sensor C# Properties [csharp] 10:28:03.771 WARN: Property missing: 'sonar.cs.analyzer.projectOutPaths'. No protobuf files will be loaded for this project. 10:28:03.771 WARN: No Roslyn issues report found for this project. 10:28:03.771 INFO: Sensor C# Properties [csharp] (done) | time=0ms 10:28:03.771 INFO: Sensor SonarJavaXmlFileSensor [java] 10:28:03.772 INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms 10:28:03.772 INFO: Sensor C# [csharp] 10:28:03.773 INFO: Sensor C# [csharp] (done) | time=1ms 10:28:03.773 INFO: Sensor Zero Coverage Sensor 10:28:03.777 INFO: Sensor Zero Coverage Sensor (done) | time=4ms 10:28:03.783 DEBUG: 'console1/console1/Program.cs' generated metadata with charset 'UTF-8' 10:28:03.789 INFO: Calculating CPD for 0 files 10:28:03.790 INFO: CPD calculation finished 10:28:03.806 DEBUG: readpipe [git, --version],/usr/bin 10:28:03.815 DEBUG: readpipe may return 'git version 2.17.2 (Apple Git-113)' 10:28:03.815 DEBUG: remaining output: 10:28:03.815 DEBUG: readpipe [git, config, --system, --edit],/usr/bin 10:28:03.825 DEBUG: readpipe may return '/private/etc/gitconfig' 10:28:03.825 DEBUG: remaining output: 10:28:03.885 INFO: Analysis report generated in 94ms, dir size=39 KB 10:28:03.894 INFO: Analysis reports compressed in 9ms, zip size=10 KB 10:28:03.894 INFO: Analysis report generated in /ssd/apache/Build/builder/worksapce/sonartest/.scannerwork/scanner-report 10:28:03.894 DEBUG: Upload report 10:28:03.909 DEBUG: POST 200 http://localhost:9000/api/ce/submit?projectKey=cf:console1&projectName=console1 | time=14ms 10:28:03.910 INFO: Analysis report uploaded in 16ms 10:28:03.911 INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=cf%3Aconsole1 10:28:03.911 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report 10:28:03.911 INFO: More about the report processing at http://localhost:9000/api/ce/task?id=AWfESp7C_9IurTg-mtil 10:28:03.912 DEBUG: Report metadata written to /ssd/apache/Build/builder/worksapce/sonartest/.scannerwork/report-task.txt 10:28:03.969 DEBUG: 'GitLab Commit Issue Publisher' skipped because one of the required properties is missing 10:28:03.970 DEBUG: Post-jobs : 10:28:03.973 INFO: Task total time: 2.761 s 10:28:04.012 INFO: ------------------------------------------------------------------------ 10:28:04.012 INFO: EXECUTION SUCCESS 10:28:04.013 INFO: ------------------------------------------------------------------------ 10:28:04.013 INFO: Total time: 3.595s 10:28:04.066 INFO: Final Memory: 21M/410M 10:28:04.066 INFO: ------------------------------------------------------------------------

drashnane commented 5 years ago

the code I tried to analyze :


using System;

namespace console1
{
    class Program
    {
        static void Main(string[] args)
        {
            bool a = false;
            bool b = true;
            GC.Collect();
            Console.WriteLine("Hello World!");
            if(a =! b)
            {
                Console.WriteLine("hahaha");
            }
        }
    }
}
valhristov commented 5 years ago

Hi @drashnane, thanks for the detailed information. I am afraid that the Scanner CLI cannot be used to analyze .NET source code. Please, refer to this article for instructions how to use Scanner for MSBuild (and the corresponding dotnet commands) to analyze projects on Linux or OSX: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild

Update: also please make sure that you are analyzing a solution or you have <ProjectGuid>unique guid here</ProjectGuid> in your project. This is mentioned in the article above.

kaleemasadmughal commented 5 years ago

Facing same issue tried with new project from scratch but it always goes without any error and shows “This project is empty”. I am trying to run with Xcode project. And using Community edition.

kaleemasadmughal commented 5 years ago

this issue is still not fixed and needs to be open again. https://community.sonarsource.com/t/this-project-is-empty/7961