mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Classify some project files as XML (#3696)
Also added disambiguation rule for `.proj` and `.user`. ##### CSCFG https://github.com/search?utf8=%E2%9C%93&q=extension%3Acscfg+NOT+nothack&type=Code (16.7K hits) ##### CSDEF https://github.com/search?utf8=%E2%9C%93&q=extension%3Acsdef+NOT+nothack&type=Code (12.7K hits) ##### CCPROJ https://github.com/search?utf8=%E2%9C%93&q=extension%3Accproj+NOT+nothack&type=Code (5K hits) ##### DEPPROJ https://github.com/search?utf8=%E2%9C%93&q=extension%3Adepproj+NOT+nothack&type=Code (505 hits) ##### NDPROJ https://github.com/search?utf8=%E2%9C%93&q=extension%3Andproj+NOT+nothack&type=Code (194 hits) ##### PROJ https://github.com/search?utf8=%E2%9C%93&q=extension%3Aproj+%28project+OR+Property+OR+Import+OR+xml+OR+xmlns%29&type=Code (35K hits) ##### SHPROJ https://github.com/search?utf8=%E2%9C%93&q=extension%3Ashproj+NOT+nothack&type=Code (13K hits)
This commit is contained in:
committed by
Colin Seymour
parent
3530a18e46
commit
5d48ccd757
77
samples/XML/NDepends_Example.ndproj
Normal file
77
samples/XML/NDepends_Example.ndproj
Normal file
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<NDepend AppName="ExampleNDApp" Platform="DotNet">
|
||||
<OutputDir KeepHistoric="True" KeepXmlFiles="True">c:\temp</OutputDir>
|
||||
<Assemblies />
|
||||
<FrameworkAssemblies />
|
||||
<Dirs>
|
||||
<Dir>C:\Windows\Microsoft.NET\Framework\v4.0.30319</Dir>
|
||||
<Dir>C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF</Dir>
|
||||
</Dirs>
|
||||
<Report Kind="0" SectionsEnabled="12287" XslPath="" Flags="64512">
|
||||
<Section Enabled="True">Application Metrics</Section>
|
||||
<Section Enabled="True">.NET Assemblies Metrics</Section>
|
||||
<Section Enabled="True">Treemap Metric View</Section>
|
||||
<Section Enabled="True">.NET Assemblies Abstractness vs. Instability</Section>
|
||||
<Section Enabled="True">.NET Assemblies Dependencies</Section>
|
||||
<Section Enabled="True">.NET Assemblies Dependency Graph</Section>
|
||||
<Section Enabled="True">.NET Assemblies Build Order</Section>
|
||||
<Section Enabled="True">Analysis Log</Section>
|
||||
<Section Enabled="True">CQL Rules Violated</Section>
|
||||
<Section Enabled="True">Types Metrics</Section>
|
||||
<Section Enabled="False">Types Dependencies</Section>
|
||||
</Report>
|
||||
<BuildComparisonSetting ProjectMode="DontCompare" BuildMode="MostRecentAnalysisResultAvailable" ProjectFileToCompareWith="" BuildFileToCompareWith="" NDaysAgo="1" />
|
||||
<BaselineInUISetting ProjectMode="DontCompare" BuildMode="MostRecentAnalysisResultAvailable" ProjectFileToCompareWith="" BuildFileToCompareWith="" NDaysAgo="1" />
|
||||
<CoverageFiles UncoverableAttribute="" />
|
||||
<SourceFileRebasing FromPath="" ToPath="" />
|
||||
<Queries>
|
||||
<Group Name="Code Quality" Active="True" ShownInReport="False">
|
||||
<Query Active="True" DisplayList="True" DisplayStat="True" DisplaySelectionView="False" IsCriticalRule="False"><![CDATA[// <Name>Discard generated and designer Methods from JustMyCode</Name>
|
||||
// --- Make sure to make this query richer to discard generated methods from NDepend rules results ---
|
||||
notmycode
|
||||
|
||||
//
|
||||
// First define source files paths to discard
|
||||
//
|
||||
from a in Application.Assemblies
|
||||
where a.SourceFileDeclAvailable
|
||||
let asmSourceFilesPaths = a.SourceDecls.Select(s => s.SourceFile.FilePath)
|
||||
|
||||
let sourceFilesPathsToDiscard = (
|
||||
from filePath in asmSourceFilesPaths
|
||||
let filePathLower= filePath.ToString().ToLower()
|
||||
where
|
||||
filePathLower.EndsWithAny(
|
||||
".g.cs", // Popular pattern to name generated files.
|
||||
".g.vb",
|
||||
".xaml", // notmycode WPF xaml code
|
||||
".designer.cs", // notmycode C# Windows Forms designer code
|
||||
".designer.vb") // notmycode VB.NET Windows Forms designer code
|
||||
||
|
||||
// notmycode methods in source files in a directory containing generated
|
||||
filePathLower.Contains("generated")
|
||||
select filePath
|
||||
).ToHashSet()
|
||||
|
||||
//
|
||||
// Second: discard methods in sourceFilesPathsToDiscard
|
||||
//
|
||||
from m in a.ChildMethods
|
||||
where (m.SourceFileDeclAvailable &&
|
||||
sourceFilesPathsToDiscard.Contains(m.SourceDecls.First().SourceFile.FilePath)) ||
|
||||
// Generated methods might be tagged with this attribute
|
||||
m.HasAttribute ("System.CodeDom.Compiler.GeneratedCodeAttribute".AllowNoMatch())
|
||||
select new { m, m.NbLinesOfCode }]]></Query>
|
||||
<Query Active="True" DisplayList="True" DisplayStat="True" DisplaySelectionView="False" IsCriticalRule="False"><![CDATA[// <Name>Discard generated Fields from JustMyCode</Name>
|
||||
// --- Make sure to make this query richer to discard generated fields from NDepend rules results ---
|
||||
notmycode
|
||||
from f in Application.Fields where
|
||||
f.HasAttribute ("System.CodeDom.Compiler.GeneratedCodeAttribute".AllowNoMatch()) ||
|
||||
|
||||
// Eliminate "components" generated in Windows Form Conrol context
|
||||
f.Name == "components" && f.ParentType.DeriveFrom("System.Windows.Forms.Control".AllowNoMatch())
|
||||
select f]]></Query>
|
||||
</Group>
|
||||
</Queries>
|
||||
<WarnFilter />
|
||||
</NDepend>
|
||||
Reference in New Issue
Block a user