mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Merge pull request #13030 from hvitved/csharp/warn-as-error
C#: Never treat warnings as error in the extractor
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.commons.Diagnostics
|
||||
|
||||
from Diagnostic d
|
||||
where d.getSeverity() >= 3
|
||||
select d
|
||||
@@ -0,0 +1,4 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
||||
|
||||
var x = "unused";
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
7
csharp/ql/integration-tests/posix-only/warn_as_error/build.sh
Executable file
7
csharp/ql/integration-tests/posix-only/warn_as_error/build.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Will fail because of a warning
|
||||
dotnet build
|
||||
|
||||
# Pretend it didn't fail, so extraction succeeds (which doesn't treat warnings as errors)
|
||||
exit 0
|
||||
@@ -0,0 +1,7 @@
|
||||
import os
|
||||
from create_database_utils import *
|
||||
from diagnostics_test_utils import *
|
||||
|
||||
run_codeql_database_create(["./build.sh"], lang="csharp", extra_args=["--extractor-option=cil=false"])
|
||||
|
||||
check_diagnostics()
|
||||
Reference in New Issue
Block a user