Skip to content

Commit bea5b50

Browse files
committed
Merge remote-tracking branch 'pdelvo-status/master' into merge-status-site
2 parents 9296fa2 + 711a24c commit bea5b50

66 files changed

Lines changed: 40744 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
5+
</startup>
6+
</configuration>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) Dennis Fischer. All Rights Reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
4+
namespace StyleCop.Analyzers.Status.Generator
5+
{
6+
/// <summary>
7+
/// This enum is used to indicate whether or not a code fix is implemented
8+
/// </summary>
9+
public enum CodeFixStatus
10+
{
11+
/// <summary>
12+
/// This value indicates, that a code fix is implemented
13+
/// </summary>
14+
Implemented,
15+
16+
/// <summary>
17+
/// This value indicates, that a code fix is not implemented and
18+
/// will not be implemented because it either can't be implemented
19+
/// or a code fix would not be able to fix it rationally.
20+
/// </summary>
21+
NotImplemented,
22+
23+
/// <summary>
24+
/// This value indicates, that a code fix is not implemented because
25+
/// no one implemented it yet, or it is not yet decided if a code fix
26+
/// is going to be implemented in the future.
27+
/// </summary>
28+
NotYetImplemented
29+
}
30+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright (c) Dennis Fischer. All Rights Reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
4+
namespace StyleCop.Analyzers.Status.Generator
5+
{
6+
using System;
7+
8+
/// <summary>
9+
/// An exception that gets thrown if the compilation failed.
10+
/// </summary>
11+
[Serializable]
12+
public class CompilationFailedException : Exception
13+
{
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="CompilationFailedException"/> class.
16+
/// </summary>
17+
public CompilationFailedException()
18+
{
19+
}
20+
21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="CompilationFailedException"/> class.
23+
/// </summary>
24+
/// <param name="message">The message that should be reported</param>
25+
public CompilationFailedException(string message)
26+
: base(message)
27+
{
28+
}
29+
30+
/// <summary>
31+
/// Initializes a new instance of the <see cref="CompilationFailedException"/> class.
32+
/// </summary>
33+
/// <param name="message">The message that should be reported</param>
34+
/// <param name="inner">The exception that caused this exception to be thrown</param>
35+
public CompilationFailedException(string message, Exception inner)
36+
: base(message, inner)
37+
{
38+
}
39+
}
40+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright (c) Dennis Fischer. All Rights Reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
4+
namespace StyleCop.Analyzers.Status.Generator
5+
{
6+
using System;
7+
using System.IO;
8+
using System.Linq;
9+
using LibGit2Sharp;
10+
using Newtonsoft.Json;
11+
12+
/// <summary>
13+
/// The starting point of this application.
14+
/// </summary>
15+
internal class Program
16+
{
17+
/// <summary>
18+
/// The starting point of this application.
19+
/// </summary>
20+
/// <param name="args">The command line parameters.</param>
21+
internal static void Main(string[] args)
22+
{
23+
if (args.Length < 1)
24+
{
25+
Console.WriteLine("Path to sln file required.");
26+
return;
27+
}
28+
29+
SolutionReader reader = SolutionReader.CreateAsync(args[0]).Result;
30+
31+
var diagnostics = reader.GetDiagnosticsAsync().Result;
32+
33+
diagnostics = diagnostics.Sort((a, b) => a.Id.CompareTo(b.Id));
34+
35+
Commit commit;
36+
string commitId;
37+
38+
using (Repository repository = new Repository(Path.GetDirectoryName(args[0])))
39+
{
40+
commitId = repository.Head.Tip.Sha;
41+
commit = repository.Head.Tip;
42+
43+
var output = new
44+
{
45+
diagnostics,
46+
git = new
47+
{
48+
commit.Sha,
49+
commit.Message,
50+
commit.Author,
51+
commit.Committer,
52+
Parents = commit.Parents.Select(x => x.Sha)
53+
}
54+
};
55+
56+
Console.WriteLine(JsonConvert.SerializeObject(output));
57+
}
58+
}
59+
}
60+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (c) Dennis Fischer. All Rights Reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
4+
using System.Reflection;
5+
using System.Runtime.CompilerServices;
6+
using System.Runtime.InteropServices;
7+
8+
// General Information about an assembly is controlled through the following
9+
// set of attributes. Change these attribute values to modify the information
10+
// associated with an assembly.
11+
[assembly: AssemblyTitle("StyleCop.Analyzers.Status.Generator")]
12+
[assembly: AssemblyDescription("")]
13+
[assembly: AssemblyConfiguration("")]
14+
[assembly: AssemblyCompany("")]
15+
[assembly: AssemblyProduct("StyleCop.Analyzers.Status.Generator")]
16+
[assembly: AssemblyCopyright("Copyright © 2015")]
17+
[assembly: AssemblyTrademark("")]
18+
[assembly: AssemblyCulture("")]
19+
20+
// Setting ComVisible to false makes the types in this assembly not visible
21+
// to COM components. If you need to access a type in this assembly from
22+
// COM, set the ComVisible attribute to true on that type.
23+
[assembly: ComVisible(false)]
24+
25+
// The following GUID is for the ID of the typelib if this project is exposed to COM
26+
[assembly: Guid("9bf22a9e-9708-4ae4-a5c7-7a00ae4c8885")]
27+
28+
// Version information for an assembly consists of the following four values:
29+
//
30+
// Major Version
31+
// Minor Version
32+
// Build Number
33+
// Revision
34+
//
35+
// You can specify all the values or you can default the Build and Revision Numbers
36+
// by using the '*' as shown below:
37+
// [assembly: AssemblyVersion("1.0.*")]
38+
[assembly: AssemblyVersion("1.0.0.0")]
39+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright (c) Dennis Fischer. All Rights Reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
4+
namespace StyleCop.Analyzers.Status.Generator
5+
{
6+
using System.Collections;
7+
using System.Collections.Generic;
8+
using System.Collections.Immutable;
9+
using System.IO;
10+
using System.Resources;
11+
using Microsoft.CodeAnalysis;
12+
13+
/// <summary>
14+
/// Provides a method that creates binary resources in memory
15+
/// </summary>
16+
internal class ResourceReader
17+
{
18+
/// <summary>
19+
/// Creates a <see cref="ResourceDescription"/> from a resx file im memory.
20+
/// </summary>
21+
/// <param name="name">The name of the resource.</param>
22+
/// <param name="path">The path to the resource</param>
23+
/// <returns>A resource description for the resx file</returns>
24+
internal static ResourceDescription ReadResource(string name, string path)
25+
{
26+
return new ResourceDescription(
27+
name,
28+
() =>
29+
{
30+
using (ResXResourceReader reader = new ResXResourceReader(path))
31+
{
32+
IDictionaryEnumerator enumerator = reader.GetEnumerator();
33+
MemoryStream memStream = new MemoryStream();
34+
using (IResourceWriter writer = new ResourceWriter(memStream))
35+
{
36+
while (enumerator.MoveNext())
37+
{
38+
writer.AddResource(enumerator.Key.ToString(), enumerator.Value);
39+
}
40+
}
41+
return new MemoryStream(memStream.ToArray());
42+
}
43+
},
44+
false);
45+
}
46+
47+
/// <summary>
48+
/// Gets a list that contains a <see cref="ResourceDescription"/> for each resx
49+
/// file in the directory and it's subdirectories.
50+
/// </summary>
51+
/// <param name="root">
52+
/// The path of the root directory.
53+
/// </param>
54+
/// <returns>
55+
/// A <see cref="ImmutableArray{ResourceDescription}"/> that contains a <see cref="ResourceDescription"/> for each resx
56+
/// file in the directory and it's subdirectories.
57+
/// </returns>
58+
internal static ImmutableArray<ResourceDescription> GetResourcesRecursive(string root)
59+
{
60+
root = Path.GetFullPath(root);
61+
List<ResourceDescription> descriptions = new List<ResourceDescription>();
62+
63+
foreach (var path in Directory.EnumerateFiles(root, "*.resx", SearchOption.AllDirectories))
64+
{
65+
string relativePath = Path.ChangeExtension(
66+
Path.GetFullPath(path)
67+
.Substring(root.Length)
68+
.Replace(Path.DirectorySeparatorChar, '.')
69+
.Replace(Path.AltDirectorySeparatorChar, '.'), "resources")
70+
.TrimStart('.');
71+
72+
descriptions.Add(ReadResource(relativePath, path));
73+
}
74+
75+
return ImmutableArray.CreateRange(descriptions);
76+
}
77+
}
78+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RuleSet Name="Rules" Description=" " ToolsVersion="14.0">
3+
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
4+
<Rule Id="IDE0001" Action="Warning" />
5+
<Rule Id="IDE0003" Action="None" />
6+
</Rules>
7+
</RuleSet>

0 commit comments

Comments
 (0)