mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +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
@@ -4865,12 +4865,16 @@ XML:
|
||||
- ".ant"
|
||||
- ".axml"
|
||||
- ".builds"
|
||||
- ".ccproj"
|
||||
- ".ccxml"
|
||||
- ".clixml"
|
||||
- ".cproject"
|
||||
- ".cscfg"
|
||||
- ".csdef"
|
||||
- ".csl"
|
||||
- ".csproj"
|
||||
- ".ct"
|
||||
- ".depproj"
|
||||
- ".dita"
|
||||
- ".ditamap"
|
||||
- ".ditaval"
|
||||
@@ -4893,6 +4897,7 @@ XML:
|
||||
- ".mm"
|
||||
- ".mod"
|
||||
- ".mxml"
|
||||
- ".ndproj"
|
||||
- ".nproj"
|
||||
- ".nuspec"
|
||||
- ".odd"
|
||||
@@ -4900,6 +4905,7 @@ XML:
|
||||
- ".pkgproj"
|
||||
- ".plist"
|
||||
- ".pluginspec"
|
||||
- ".proj"
|
||||
- ".props"
|
||||
- ".ps1xml"
|
||||
- ".psc1"
|
||||
@@ -4910,6 +4916,7 @@ XML:
|
||||
- ".sch"
|
||||
- ".scxml"
|
||||
- ".sfproj"
|
||||
- ".shproj"
|
||||
- ".srdf"
|
||||
- ".storyboard"
|
||||
- ".stTheme"
|
||||
|
||||
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>
|
||||
9
samples/XML/cloudconfig.cscfg
Normal file
9
samples/XML/cloudconfig.cscfg
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<ServiceConfiguration serviceName="MyDef" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
|
||||
<Role name="My.Web">
|
||||
<Instances count="1" />
|
||||
<ConfigurationSettings>
|
||||
<Setting name="DiagnosticsConnectionString" value="UseDevelopmentStorage=true" />
|
||||
</ConfigurationSettings>
|
||||
</Role>
|
||||
</ServiceConfiguration>
|
||||
11
samples/XML/clouddef.csdef
Normal file
11
samples/XML/clouddef.csdef
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ServiceDefinition name="MyDef" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
|
||||
<WebRole name="My.Web">
|
||||
<InputEndpoints>
|
||||
<InputEndpoint name="HttpIn" protocol="http" port="80" />
|
||||
</InputEndpoints>
|
||||
<ConfigurationSettings>
|
||||
<Setting name="DiagnosticsConnectionString" />
|
||||
</ConfigurationSettings>
|
||||
</WebRole>
|
||||
</ServiceDefinition>
|
||||
9
samples/XML/configdef.cscfg
Normal file
9
samples/XML/configdef.cscfg
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<ServiceConfiguration serviceName="MyDef" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
|
||||
<Role name="My.Web">
|
||||
<Instances count="1" />
|
||||
<ConfigurationSettings>
|
||||
<Setting name="DiagnosticsConnectionString" value="UseDevelopmentStorage=true" />
|
||||
</ConfigurationSettings>
|
||||
</Role>
|
||||
</ServiceConfiguration>
|
||||
14
samples/XML/dependency-example.depproj
Normal file
14
samples/XML/dependency-example.depproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>3.9.0.0</AssemblyVersion>
|
||||
<OutputType>Library</OutputType>
|
||||
<PackageTargetFramework>dotnet5.1</PackageTargetFramework>
|
||||
<NuGetTargetMoniker>.NETPlatform,Version=v5.1</NuGetTargetMoniker>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
11
samples/XML/example-sharedproj.shproj
Normal file
11
samples/XML/example-sharedproj.shproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{86244B26-C4AE-4F69-9315-B6148C0FE270}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<Import Project="SharedProject.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
||||
38
samples/XML/example.ccproj
Normal file
38
samples/XML/example.ccproj
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>1.0.0</ProductVersion>
|
||||
<ProjectGuid>{0beae469-c1c6-4648-a2e5-0ae0ea9efffa}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyDef</RootNamespace>
|
||||
<AssemblyName>MyDef</AssemblyName>
|
||||
<StartDevelopmentStorage>True</StartDevelopmentStorage>
|
||||
<Name>My</Name>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<!-- Items for the project -->
|
||||
<ItemGroup>
|
||||
<ServiceDefinition Include="ServiceDefinition.csdef" />
|
||||
<ServiceConfiguration Include="ServiceConfiguration.cscfg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\My.Web\My.Web.csproj">
|
||||
<Name>My.Web</Name>
|
||||
<Project>{1515c2c3-0b57-422c-a6f9-0891b86fb7d3}</Project>
|
||||
<Private>True</Private>
|
||||
<RoleType>Web</RoleType>
|
||||
<RoleName>My.Web</RoleName>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
85
samples/XML/msbuild-example.proj
Normal file
85
samples/XML/msbuild-example.proj
Normal file
@@ -0,0 +1,85 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
|
||||
<UsingTask TaskName="Microsoft.Build.Tasks.XmlPeek" AssemblyName="Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
|
||||
<UsingTask TaskName="Microsoft.Build.Tasks.XmlPoke" AssemblyName="Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
|
||||
<PropertyGroup>
|
||||
<SolutionRoot>$(MSBuildProjectDirectory)\..</SolutionRoot>
|
||||
<ProjectRoot>$(SolutionRoot)\Src\Bowerbird.Website</ProjectRoot>
|
||||
<ArtifactsDir>$(SolutionRoot)\Release</ArtifactsDir>
|
||||
<CurrentBuildDateStamp>$([System.DateTime]::Now.ToString("yyyyMMdd"))</CurrentBuildDateStamp>
|
||||
<CurrentBuildTimeStamp>$([System.DateTime]::Now.ToString("hhmm"))</CurrentBuildTimeStamp>
|
||||
<CurrentBuildDir>$(ArtifactsDir)\$(CurrentBuildDateStamp)-$(Configuration)</CurrentBuildDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VersionMajor>0</VersionMajor>
|
||||
<VersionMinor>1</VersionMinor>
|
||||
<VersionPatch>0</VersionPatch>
|
||||
<VersionPreRelease></VersionPreRelease>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<WebConfig>$(CurrentBuildDir)\Web.config</WebConfig>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageFiles Include="$(ProjectRoot)\**\*.*"
|
||||
Exclude="$(ProjectRoot)\bin\*.pdb;
|
||||
$(ProjectRoot)\bin\*.xml;
|
||||
$(ProjectRoot)\Logs\**\*.*;
|
||||
$(ProjectRoot)\obj\**\*.*;
|
||||
$(ProjectRoot)\test\**\*.*;
|
||||
$(ProjectRoot)\media\**\*.*;
|
||||
$(ProjectRoot)\**\*.orig;
|
||||
$(ProjectRoot)\*.config;
|
||||
$(ProjectRoot)\*.xml;
|
||||
$(ProjectRoot)\**\*.csproj;
|
||||
$(ProjectRoot)\*.csproj.user;">
|
||||
</PackageFiles>
|
||||
<ConfigFiles Include="$(ProjectRoot)\Web.config" >
|
||||
</ConfigFiles>
|
||||
</ItemGroup>
|
||||
<Target Name="UpdateWebConfig" Condition=" '$(CurrentBuildDateStamp)' != '' ">
|
||||
<XmlPoke Namespaces="<Namespace Prefix='msb' Uri='http://schemas.microsoft.com/developer/msbuild/2003'/>"
|
||||
XmlInputPath="$(WebConfig)"
|
||||
Query="//add[@key='staticContentIncrement']/@value"
|
||||
Value="$(CurrentBuildDateStamp)-$(CurrentBuildTimeStamp)" />
|
||||
</Target>
|
||||
<Target Name="CreateOutputDir">
|
||||
<Message Text="Creating Directory $(CurrentBuildDir)" />
|
||||
<RemoveDir Directories="$(CurrentBuildDir)" />
|
||||
<Delete Files="$(CurrentBuildDir)" />
|
||||
<MakeDir Directories="$(CurrentBuildDir)" />
|
||||
</Target>
|
||||
<Target Name="BuildMediaDirectories">
|
||||
<MakeDir Directories="$(CurrentBuildDir)\media" />
|
||||
</Target>
|
||||
<Target Name="ConfigSettingsMessages">
|
||||
<Message Text="Configuration is $(Configuration)" />
|
||||
<Message Text="BuildNumber is $(BuildNumber)" />
|
||||
<Message Text="ProjectRoot is $(ProjectRoot)" />
|
||||
<Message Text="CurrentBuildDir is $(CurrentBuildDir)" />
|
||||
</Target>
|
||||
<Target Name="BuildSolution">
|
||||
<MSBuild Projects="$(SolutionRoot)\Bowerbird.sln" Targets="Build" Properties="Configuration=$(Configuration)" />
|
||||
</Target>
|
||||
<Target Name="CopyFilesToReleaseDir">
|
||||
<Copy SourceFiles="@(PackageFiles)" DestinationFiles="@(PackageFiles->'$(CurrentBuildDir)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<Copy SourceFiles="@(ConfigFiles)" DestinationFiles="$(CurrentBuildDir)\web.config" />
|
||||
</Target>
|
||||
<Target Name="ZipUpReleaseFiles">
|
||||
<ItemGroup>
|
||||
<ZipFiles Include="$(CurrentBuildDir)\**\*.*" Exclude="*.zip" />
|
||||
</ItemGroup>
|
||||
<Zip Files="@(ZipFiles)" WorkingDirectory="$(CurrentBuildDir)\$(Configuration)\" ZipFileName="$(CurrentBuildDateStamp)-$(Configuration).zip" ZipLevel="9" />
|
||||
</Target>
|
||||
<Target Name="CopyZipToReleaseDir" DependsOnTargets="ZipUpReleaseFiles">
|
||||
<Copy SourceFiles="$(MSBuildProjectDirectory)\$(CurrentBuildDateStamp)-$(Configuration).zip" DestinationFiles="$(ArtifactsDir)\$(CurrentBuildDateStamp)-$(Configuration).zip" />
|
||||
<Delete Files="$(MSBuildProjectDirectory)\$(CurrentBuildDateStamp)-$(Configuration).zip" />
|
||||
</Target>
|
||||
<Target Name="Build" DependsOnTargets="CreateOutputDir">
|
||||
<CallTarget Targets="BuildMediaDirectories"/>
|
||||
<CallTarget Targets="ConfigSettingsMessages"/>
|
||||
<CallTarget Targets="BuildSolution"/>
|
||||
<CallTarget Targets="CopyFilesToReleaseDir"/>
|
||||
<CallTarget Targets="UpdateWebConfig" />
|
||||
<CallTarget Targets="CopyZipToReleaseDir"/>
|
||||
</Target>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user