forked from EvilBeaver/OneScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeStyleGuide: Настройки ReSharper для анализа кода. Скрипт для запу…
…ска анализа через ReSharper Command Line Tools.
- Loading branch information
Showing
3 changed files
with
273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeMemberModifiers/@EntryIndexedValue">WARNING</s:String> | ||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeModifiers/@EntryIndexedValue">SUGGESTION</s:String> | ||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FBuiltInTypes/@EntryIndexedValue">SUGGESTION</s:String> | ||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FElsewhere/@EntryIndexedValue">SUGGESTION</s:String> | ||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FSimpleTypes/@EntryIndexedValue">SUGGESTION</s:String> | ||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BUILTIN_TYPE_REFERENCE_STYLE/@EntryValue">UseKeyword</s:String> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_LINQ_QUERY/@EntryValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARGUMENT/@EntryValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_FOR_STMT/@EntryValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_PARAMETER/@EntryValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS/@EntryValue">True</s:Boolean> | ||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AFTER_CONTROL_TRANSFER_STATEMENTS/@EntryValue">1</s:Int64> | ||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_AUTO_PROPERTY/@EntryValue">1</s:Int64> | ||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_FIELD/@EntryValue">1</s:Int64> | ||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_INVOCABLE/@EntryValue">1</s:Int64> | ||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_PROPERTY/@EntryValue">1</s:Int64> | ||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_BEFORE_SINGLE_LINE_COMMENT/@EntryValue">1</s:Int64> | ||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_BETWEEN_USING_GROUPS/@EntryValue">1</s:Int64> | ||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64> | ||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean> | ||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARRAY_INITIALIZER_STYLE/@EntryValue">CHOP_ALWAYS</s:String> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean> | ||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_OBJECT_AND_COLLECTION_INITIALIZER_STYLE/@EntryValue">CHOP_ALWAYS</s:String> | ||
<s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue"><?xml version="1.0" encoding="utf-16"?>
 | ||
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
 | ||
<TypePattern DisplayName="COM interfaces or structs">
 | ||
<TypePattern.Match>
 | ||
<Or>
 | ||
<And>
 | ||
<Kind Is="Interface" />
 | ||
<Or>
 | ||
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
 | ||
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
 | ||
</Or>
 | ||
</And>
 | ||
<Kind Is="Struct" />
 | ||
</Or>
 | ||
</TypePattern.Match>
 | ||
</TypePattern>
 | ||
<TypePattern DisplayName="xUnit.net Test Classes" RemoveRegions="All">
 | ||
<TypePattern.Match>
 | ||
<And>
 | ||
<Kind Is="Class" />
 | ||
<HasMember>
 | ||
<And>
 | ||
<Kind Is="Method" />
 | ||
<HasAttribute Name="Xunit.FactAttribute" Inherited="True" />
 | ||
</And>
 | ||
</HasMember>
 | ||
</And>
 | ||
</TypePattern.Match>
 | ||
<Entry DisplayName="Setup/Teardown Methods">
 | ||
<Entry.Match>
 | ||
<Or>
 | ||
<Kind Is="Constructor" />
 | ||
<And>
 | ||
<Kind Is="Method" />
 | ||
<ImplementsInterface Name="System.IDisposable" />
 | ||
</And>
 | ||
</Or>
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<Kind Order="Constructor" />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
<Entry DisplayName="All other members" />
 | ||
<Entry Priority="100" DisplayName="Test Methods">
 | ||
<Entry.Match>
 | ||
<And>
 | ||
<Kind Is="Method" />
 | ||
<HasAttribute Name="Xunit.FactAttribute" />
 | ||
</And>
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<Name />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
</TypePattern>
 | ||
<TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All">
 | ||
<TypePattern.Match>
 | ||
<And>
 | ||
<Kind Is="Class" />
 | ||
<HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="True" />
 | ||
</And>
 | ||
</TypePattern.Match>
 | ||
<Entry DisplayName="Setup/Teardown Methods">
 | ||
<Entry.Match>
 | ||
<And>
 | ||
<Kind Is="Method" />
 | ||
<Or>
 | ||
<HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="True" />
 | ||
<HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="True" />
 | ||
<HasAttribute Name="NUnit.Framework.FixtureSetUpAttribute" Inherited="True" />
 | ||
<HasAttribute Name="NUnit.Framework.FixtureTearDownAttribute" Inherited="True" />
 | ||
</Or>
 | ||
</And>
 | ||
</Entry.Match>
 | ||
</Entry>
 | ||
<Entry DisplayName="All other members" />
 | ||
<Entry Priority="100" DisplayName="Test Methods">
 | ||
<Entry.Match>
 | ||
<And>
 | ||
<Kind Is="Method" />
 | ||
<HasAttribute Name="NUnit.Framework.TestAttribute" />
 | ||
</And>
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<Name />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
</TypePattern>
 | ||
<TypePattern DisplayName="Default Pattern">
 | ||
<Entry Priority="100" DisplayName="Public Delegates">
 | ||
<Entry.Match>
 | ||
<And>
 | ||
<Access Is="Public" />
 | ||
<Kind Is="Delegate" />
 | ||
</And>
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<Name />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
<Entry Priority="100" DisplayName="Public Enums">
 | ||
<Entry.Match>
 | ||
<And>
 | ||
<Access Is="Public" />
 | ||
<Kind Is="Enum" />
 | ||
</And>
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<Name />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
<Entry DisplayName="Nested Types">
 | ||
<Entry.Match>
 | ||
<Kind Is="Type" />
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<Access />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
<Entry DisplayName="Static Fields and Constants">
 | ||
<Entry.Match>
 | ||
<Or>
 | ||
<Kind Is="Constant" />
 | ||
<And>
 | ||
<Kind Is="Field" />
 | ||
<Static />
 | ||
</And>
 | ||
</Or>
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<Kind Order="Constant Field" />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
<Entry DisplayName="Fields">
 | ||
<Entry.Match>
 | ||
<And>
 | ||
<Kind Is="Field" />
 | ||
<Not>
 | ||
<Static />
 | ||
</Not>
 | ||
</And>
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<Readonly />
 | ||
<Name />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
<Entry DisplayName="Constructors">
 | ||
<Entry.Match>
 | ||
<Kind Is="Constructor" />
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<Static />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
<Entry DisplayName="Properties, Indexers">
 | ||
<Entry.Match>
 | ||
<Or>
 | ||
<Kind Is="Property" />
 | ||
<Kind Is="Indexer" />
 | ||
</Or>
 | ||
</Entry.Match>
 | ||
</Entry>
 | ||
<Entry DisplayName="All other members" />
 | ||
<Entry Priority="100" DisplayName="Interface Implementations">
 | ||
<Entry.Match>
 | ||
<And>
 | ||
<Kind Is="Member" />
 | ||
<ImplementsInterface />
 | ||
</And>
 | ||
</Entry.Match>
 | ||
<Entry.SortBy>
 | ||
<ImplementsInterface Immediate="True" />
 | ||
</Entry.SortBy>
 | ||
</Entry>
 | ||
</TypePattern>
 | ||
</Patterns></s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></s:String> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
Param( | ||
[int] $level = 1, | ||
[string] $output, | ||
[string] $projects = "ScriptEngine;oscript;ScriptEngine.HostedScript;TestApp" | ||
) | ||
|
||
$InspectCodeToolPath = "JetBrains.ReSharper.CommandLineTools\inspectcode.exe" | ||
$categories = @("CodeStyleIssues", "ConstraintViolation") | ||
$levels = @{ | ||
"SUGGESTION" = 1; | ||
"WARNING" = 2; | ||
"ERROR" = 3; | ||
} | ||
$logFile = "codestyle.log" | ||
|
||
& "$($InspectCodeToolPath)" --toolset=12.0 --output=$logFile --project="$($projects)" src\1Script.sln | Out-Null | ||
|
||
Write-Host "Analysis Completed" -Foreground Green | ||
|
||
# Parse report | ||
[xml] $reportXml = Get-Content $logFile | ||
$report = $reportXml.Report | ||
|
||
$codeStyleIssueTypes = @{} | ||
foreach ($issueType in $report.IssueTypes.IssueType) { | ||
if (-not ($categories -contains $issueType.CategoryId)) { | ||
continue | ||
} | ||
|
||
$codeStyleIssueTypes.Add($issueType.Id, $issueType) | ||
} | ||
|
||
foreach ($project in $report.Issues.Project) { | ||
foreach ($issue in $project.Issue) { | ||
if (-not $codeStyleIssueTypes.ContainsKey($issue.TypeId)) { | ||
continue | ||
} | ||
|
||
$type = $codeStyleIssueTypes[$issue.TypeId] | ||
if ($levels[$type.Severity] -lt $level) { | ||
continue | ||
} | ||
|
||
$message = "[$($type.Severity)] $($issue.File):$($issue.Line) `"$($issue.Message)`"" | ||
|
||
$color = "White" | ||
switch ($levels[$type.Severity]) { | ||
1 { $color = "Green" } | ||
2 { $color = "Yellow" } | ||
3 { $color = "Red" } | ||
} | ||
|
||
if (-not [string]::IsNullOrEmpty($output)) { | ||
$message | Out-File $output -Append | ||
} | ||
else { | ||
Write-Host $message -Foreground $color | ||
} | ||
} | ||
} |