Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

small enhancement to make rules that don't match not appear#234

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
lcartey merged 8 commits intomainfromjsinglet/compiler-path-fix
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletionsscripts/PSCodingStandards/Get-RuleForPath.ps1
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,11 +41,12 @@ function Get-RuleForPath {
$allQueries=@()
$queriesToCheck=@()

# load all the queries

foreach ($sin$AVAILABLE_SUITES) {
$allQueries+=Get-RulesInSuite-Suite$s-Language$Language
}


$modifiedPathWithReplacement=Join-Path (Resolve-Path.-Relative)$Path
# replace "src" with "test" to make it match up
$sep= [IO.Path]::DirectorySeparatorChar
Expand All@@ -57,20 +58,18 @@ function Get-RuleForPath {

# for each query, create the test directory
foreach($qin$allQueries){

# get test directory
$testDirs= (Get-ATestDirectory-RuleObject$q-Language$Language)
foreach($testDirectoryin$testDirs){
# resolve path to be compatible
$testPath=Join-Path (Resolve-Path.-Relative)$testDirectory
$testPath=(Join-Path (Resolve-Path.-Relative)$testDirectory)

# see if the TEST directory is a substring of the full path
if($modifiedPath.StartsWith($testPath)){
if((Split-Path$modifiedPath-Parent)-eq$testPath){
$matchingRules+=$q
continue
}

if($modifiedPathWithReplacement.StartsWith($testPath)){
if((Split-Path$modifiedPathWithReplacement-Parent)-eq$testPath){
$matchingRules+=$q
continue
}
Expand Down
39 changes: 39 additions & 0 deletionsscripts/PSCodingStandards/Test-GetRuleForPath.ps1
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
functionTest-GetRuleForPath {
param(
[Parameter(Mandatory)]
[string]
$PR
)

$prData= (gh pr view-R github/codeql-coding-standards$PR--json headRefOid,headRepository,author,isCrossRepository,headRepositoryOwner,headRefName,files)|ConvertFrom-Json

foreach($fin$prData.files){
try {
Write-Host"[C] Scanning file for relationship$($f.path)..."
$rulesToTest=Get-RuleForPath-Language c-Path"$($f.path)"

Write-Host"[C] Got$($rulesToTest.Count) potential C rules..."

foreach($rin$rulesToTest){
$ruleNames+=$r.__memberof_rule
Write-Host"[C] Found rule$r"
}
}catch{
Write-Host"No$Language rules found for path:$($f.path)"
}


try {
Write-Host"[CPP] Scanning file for relationship$($f.path)..."
$rulesToTest=Get-RuleForPath-Language cpp-Path"$($f.path)"

Write-Host"[CPP] Got$($rulesToTest.Count) potential CPP rules..."

foreach($rin$rulesToTest){
Write-Host"[CPP] Found rule$r"
}
}catch{
Write-Host"No CPP rules found for path:$($f.path)"
}
}
}
2 changes: 1 addition & 1 deletionscripts/matrix_testing/CompileFixTool.ps1
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@ Write-Host -ForegroundColor ([ConsoleColor]2) "OK"
$CODEQL_VERSION= (codeql version--format json|ConvertFrom-Json).version

Write-Host"Checking 'codeql' version =$REQUIRED_CODEQL_VERSION...."-NoNewline
if (-Not$CODEQL_VERSION-eq$REQUIRED_CODEQL_VERSION) {
if (-Not($CODEQL_VERSION-eq$REQUIRED_CODEQL_VERSION)) {
throw"Invalid CodeQL version$CODEQL_VERSION. Please install$REQUIRED_CODEQL_VERSION."
}
Write-Host-ForegroundColor ([ConsoleColor]2)"OK"
Expand Down
4 changes: 3 additions & 1 deletionscripts/matrix_testing/Config.ps1
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
Import-Module-Name"$PSScriptRoot/../PSCodingStandards/CodingStandards"

$COMPILER_MAPPINGS=@{
"cpp"=@{
"clang"="clang++";
Expand DownExpand Up@@ -27,7 +29,7 @@ $COMPILER_ARGS = @{

}

$REQUIRED_CODEQL_VERSION="2.6.3"
$REQUIRED_CODEQL_VERSION=(Get-Content (Join-Path (Get-RepositoryRoot)"supported_codeql_configs.json")|ConvertFrom-Json).supported_environment.codeql_cli


$REPORT_QUERY=@"
Expand Down
2 changes: 1 addition & 1 deletionscripts/matrix_testing/CreateMatrixTestReport.ps1
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -262,7 +262,7 @@ Write-Host -ForegroundColor ([ConsoleColor]2) "OK"
$CODEQL_VERSION= (codeql version--format json|ConvertFrom-Json).version

Write-Host"Checking 'codeql' version =$REQUIRED_CODEQL_VERSION...."-NoNewline
if (-Not$CODEQL_VERSION-eq$REQUIRED_CODEQL_VERSION) {
if (-Not($CODEQL_VERSION-eq$REQUIRED_CODEQL_VERSION)) {
throw"Invalid CodeQL version$CODEQL_VERSION. Please install$REQUIRED_CODEQL_VERSION."
}
Write-Host-ForegroundColor ([ConsoleColor]2)"OK"
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp