ADD SonarQube
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-08-31 14:57:21 +02:00
parent b6ab8dfd5a
commit 7834952385
21 changed files with 3257 additions and 0 deletions

View File

View File

@@ -0,0 +1,6 @@
projectKey=my-weather-app
serverUrl=https://sonarqube.devops.cargostart.tech
serverVersion=9.9.1.69595
dashboardUrl=https://sonarqube.devops.cargostart.tech/dashboard?id=my-weather-app
ceTaskId=AYpLqvIyx7FALQtc-lUC
ceTaskUrl=https://sonarqube.devops.cargostart.tech/api/ce/task?id=AYpLqvIyx7FALQtc-lUC

View File

@@ -0,0 +1,58 @@
{
"$schema": "http://json.schemastore.org/sarif-1.0.0",
"version": "1.0.0",
"runs": [
{
"tool": {
"name": "Microsoft (R) Visual C# Compiler",
"version": "4.7.0.0",
"fileVersion": "4.7.0-3.23366.1 (dad7898a)",
"semanticVersion": "4.7.0",
"language": "en-GB"
},
"results": [
{
"ruleId": "S4487",
"level": "warning",
"message": "Remove this unread private field '_logger' or refactor the code to use its value.",
"locations": [
{
"resultFile": {
"uri": "file:///D:/Projects/Test/my-weather-api/Controllers/WeatherForecastController.cs",
"region": {
"startLine": 14,
"startColumn": 57,
"endLine": 14,
"endColumn": 64
}
}
}
],
"properties": {
"warningLevel": 1
}
}
],
"rules": {
"S4487": {
"id": "S4487",
"shortDescription": "Unread \"private\" fields should be removed",
"fullDescription": "Private fields only used to store values without reading them later is a case of dead store. So changing the value of such field is useless and most probably indicates a serious error in the code.",
"defaultLevel": "note",
"helpUri": "https://rules.sonarsource.com/csharp/RSPEC-4487",
"properties": {
"category": "Critical Code Smell",
"isEnabledByDefault": true,
"tags": [
"C#",
"MainSourceScope",
"TestSourceScope",
"SonarWay",
"Unnecessary"
]
}
}
}
}
]
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<ProjectInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
<ProjectName>my-weather-api</ProjectName>
<ProjectLanguage>C#</ProjectLanguage>
<ProjectType>Product</ProjectType>
<ProjectGuid>b05abbad-4eec-453e-a3cb-cf5bef6dbeee</ProjectGuid>
<FullPath>D:\Projects\Test\my-weather-api\my-weather-api.csproj</FullPath>
<IsExcluded>false</IsExcluded>
<AnalysisResults>
<AnalysisResult Id="FilesToAnalyze" Location="D:\Projects\Test\my-weather-api\.sonarqube\conf\0\FilesToAnalyze.txt" />
</AnalysisResults>
<AnalysisSettings>
<Property Name="sonar.cs.roslyn.reportFilePaths">D:\Projects\Test\my-weather-api\.sonarqube\out\0\Issues.json</Property>
<Property Name="sonar.cs.analyzer.projectOutPaths">D:\Projects\Test\my-weather-api\.sonarqube\out\0</Property>
</AnalysisSettings>
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
<TargetFramework>net7.0</TargetFramework>
</ProjectInfo>

View File

@@ -0,0 +1,8 @@
Q
HD:\Projects\Test\my-weather-api\Controllers\WeatherForecastController.csutf-83
*D:\Projects\Test\my-weather-api\Program.csutf-8;
2D:\Projects\Test\my-weather-api\WeatherForecast.csutf-8\
QD:\Projects\Test\my-weather-api\obj\Debug\net7.0\my-weather-api.GlobalUsings.g.csutf-8j
_D:\Projects\Test\my-weather-api\obj\Debug\net7.0\.NETCoreApp,Version=v7.0.AssemblyAttributes.csutf-8Z
OD:\Projects\Test\my-weather-api\obj\Debug\net7.0\my-weather-api.AssemblyInfo.csutf-8m
bD:\Projects\Test\my-weather-api\obj\Debug\net7.0\my-weather-api.MvcApplicationPartsAssemblyInfo.csutf-8

View File

@@ -0,0 +1 @@
Roslyn version: 4.7.0.0Language version: CSharp11!Concurrent execution: enabledxtFile 'D:\Projects\Test\my-weather-api\obj\Debug\net7.0\my-weather-api.GlobalUsings.g.cs' was recognized as generated<65><12>File 'D:\Projects\Test\my-weather-api\obj\Debug\net7.0\.NETCoreApp,Version=v7.0.AssemblyAttributes.cs' was recognized as generatedvrFile 'D:\Projects\Test\my-weather-api\obj\Debug\net7.0\my-weather-api.AssemblyInfo.cs' was recognized as generated<65><12>File 'D:\Projects\Test\my-weather-api\obj\Debug\net7.0\my-weather-api.MvcApplicationPartsAssemblyInfo.cs' was recognized as generated

View File

@@ -0,0 +1,8 @@
x
HD:\Projects\Test\my-weather-api\Controllers\WeatherForecastController.cs 8r
 <20>
T
*D:\Projects\Test\my-weather-api\Program.cs8j r

x<02> 

View File

@@ -0,0 +1,27 @@
<EFBFBD>
HD:\Projects\Test\my-weather-api\Controllers\WeatherForecastController.cs

& 6- F
  % . 3 <
8 ? 
H N 
( +
- 2> C<>
*D:\Projects\Test\my-weather-api\Program.cs,
    


@


 

      z
2D:\Projects\Test\my-weather-api\WeatherForecast.cs


 
   * 6

View File

@@ -0,0 +1,337 @@
<EFBFBD>
HD:\Projects\Test\my-weather-api\Controllers\WeatherForecastController.cs
namespace 
my_weather_api

. 
Controllers $
;$ %
[ 
ApiController 
] 
[ 
Route 
( 
$str 
) 
] 
public 
class %
WeatherForecastController
&
:' (
ControllerBase) 7
{ 
private   
static   
readonly   
string   "
[  " #
]  # $
Summaries  % .
=  / 0
new  1 4
[  4 5
]  5 6
{

 
$str   
,   
$str   
,   
$str   '
,  ' (
$str  ) /
,  / 0
$str  1 7
,  7 8
$str  9 ?
,  ? @
$str  A H
,  H I
$str  J O
,  O P
$str  Q ]
,  ] ^
$str  _ j
}   
;   
private 
readonly 
ILogger 
< %
WeatherForecastController 6
>6 7
_logger8 ?
;? @
public
%
WeatherForecastController $
($ %
ILogger% ,
<, -%
WeatherForecastController- F
>F G
loggerH N
)N O
{ 
_logger 
= 
logger 
; 
} 
[ 
HttpGet 
(

Name

= 
$str (
)( )
]) *
public

IEnumerable 
< 
WeatherForecast &
>& '
Get( +
(+ ,
), -
{ 
return 
Enumerable 
. 
Range 
( 
$num !
,! "
$num# $
)$ %
.% &
Select& ,
(, -
index- 2
=>3 5
new6 9
WeatherForecast: I
{ 
Date 
= 
DateOnly 
. 
FromDateTime (
(( )
DateTime) 1
.1 2
Now2 5
.5 6
AddDays6 =
(= >
index> C
)C D
)D E
,E F
TemperatureC 
= 
Random !
.! "
Shared" (
.( )
Next) -
(- .
-. /
$num/ 1
,1 2
$num3 5
)5 6
,6 7
Summary 
= 
Summaries 
[ 
Random &
.& '
Shared' -
.- .
Next. 2
(2 3
Summaries3 <
.< =
Length= C
)C D
]D E
} 
)

. 
ToArray 
( 
) 
; 
} 
}  <01>
*D:\Projects\Test\my-weather-api\Program.cs
var 
builder 
=

WebApplication 
. 
CreateBuilder *
(* +
args+ /
)/ 0
;0 1
builder 
. 
Services 
. 
AddControllers 
( 
) !
;! "
builder 
. 
Services 
. #
AddEndpointsApiExplorer (
(( )
)) *
;* +
builder 
. 
Services 
. 
AddSwaggerGen 
( 
) 
; !
var


app

 
=

 
builder



.

 
Build

 
(

 
)

 
;

 
if


(

 
app

 
.

 
Environment

 
.

 
IsDevelopment

 !
(

! "
)

" #
)

# $
{ 
app 
. 
UseSwagger 
( 
) 
; 
app 
. 
UseSwaggerUI 
( 
) 
; 
} 
app 
. 
UseAuthorization 
( 
) 
; 
app 
. 
MapControllers 
( 
) 
; 
app 
. 
Run 
( 
) 
;
<EFBFBD>
2D:\Projects\Test\my-weather-api\WeatherForecast.cs
namespace 
my_weather_api

; 
public 
class 
WeatherForecast

{ 
public

DateOnly 
Date 
{ 
get 
; 
set #
;# $
}% &
public

int 
TemperatureC 
{ 
get !
;! "
set# &
;& '

View File

@@ -0,0 +1,23 @@
<EFBFBD>
HD:\Projects\Test\my-weather-api\Controllers\WeatherForecastController.cs
 
       
    
& ) 7                "   1 4            '   ) /   1 7   9 ?   A H   J O   Q ]   _ j        6 
  $ % , - F    ( 
    &      ! # $ 6 9 : I   ) 1  ! / 1 3 5  &<26>
*D:\Projects\Test\my-weather-api\Program.cs
   
 !
 X



  '


<02>
2D:\Projects\Test\my-weather-api\WeatherForecast.cs
 
    
 

View File

@@ -0,0 +1,43 @@
sonar.projectKey=my-weather-app
sonar.working.directory=D:\\Projects\\Test\\my-weather-api\\.sonarqube\\out\\.sonar
sonar.projectBaseDir=D:\\Projects\\Test\\my-weather-api
sonar.pullrequest.cache.basepath=D:\\Projects\\Test\\my-weather-api
B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE.sonar.projectKey=my-weather-app:B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE
B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE.sonar.projectName=my-weather-api
B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE.sonar.projectBaseDir=D:\\Projects\\Test\\my-weather-api
B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE.sonar.sourceEncoding=utf-8
B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE.sonar.sources=\
"D:\\Projects\\Test\\my-weather-api\\Controllers\\WeatherForecastController.cs",\
"D:\\Projects\\Test\\my-weather-api\\Program.cs",\
"D:\\Projects\\Test\\my-weather-api\\WeatherForecast.cs",\
"D:\\Projects\\Test\\my-weather-api\\obj\\Debug\\net7.0\\my-weather-api.GlobalUsings.g.cs",\
"D:\\Projects\\Test\\my-weather-api\\obj\\Debug\\net7.0\\.NETCoreApp,Version=v7.0.AssemblyAttributes.cs",\
"D:\\Projects\\Test\\my-weather-api\\obj\\Debug\\net7.0\\my-weather-api.AssemblyInfo.cs",\
"D:\\Projects\\Test\\my-weather-api\\obj\\Debug\\net7.0\\my-weather-api.MvcApplicationPartsAssemblyInfo.cs",\
"D:\\Projects\\Test\\my-weather-api\\publish\\web.config",\
"D:\\Projects\\Test\\my-weather-api\\appsettings.Development.json",\
"D:\\Projects\\Test\\my-weather-api\\appsettings.json",\
"D:\\Projects\\Test\\my-weather-api\\publish\\appsettings.Development.json",\
"D:\\Projects\\Test\\my-weather-api\\publish\\appsettings.json",\
"D:\\Projects\\Test\\my-weather-api\\publish\\my-weather-api.deps.json",\
"D:\\Projects\\Test\\my-weather-api\\publish\\my-weather-api.runtimeconfig.json",\
"D:\\Projects\\Test\\my-weather-api\\.dockerignore",\
"D:\\Projects\\Test\\my-weather-api\\.drone.yml",\
"D:\\Projects\\Test\\my-weather-api\\.gitignore",\
"D:\\Projects\\Test\\my-weather-api\\Dockerfile",\
"D:\\Projects\\Test\\my-weather-api\\publish\\my-weather-api.pdb",\
"D:\\Projects\\Test\\my-weather-api\\test.txt",\
"D:\\Projects\\Test\\my-weather-api\\Properties\\launchSettings.json"
B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE.sonar.cs.analyzer.projectOutPaths=\
"D:\\Projects\\Test\\my-weather-api\\.sonarqube\\out\\0"
B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE.sonar.cs.roslyn.reportFilePaths=\
"D:\\Projects\\Test\\my-weather-api\\.sonarqube\\out\\0\\Issues.json"
B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE.sonar.working.directory=D:\\Projects\\Test\\my-weather-api\\.sonarqube\\out\\.sonar\\mod0
sonar.host.url=https://sonarqube.devops.cargostart.tech
sonar.visualstudio.enable=false
sonar.modules=B05ABBAD-4EEC-453E-A3CB-CF5BEF6DBEEE