Skip to content

Commit 9c76e89

Browse files
authored
Sample Linter (#48)
* Initial linter rules * Cleanup * Add settings to the linter for default ungrouped allowance. * Linter sample ready for review. * Fix view extension folder * Remove reference to the sample view extension that I used as a baseline. See: #48 (comment) * update gitignore * Add linter packages to gitignore * Retarget to .NET 4.8 * Migrate solution to new style .csproj sdk * Fix sample view extension indentation * Remove packages * Remove extra files to resolve comments from @BogdanZavu * add comments to the linter rules * add localization options for the linter descriptions and call to action
1 parent 7667b5c commit 9c76e89

19 files changed

+1345
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinterSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3+
<AllowedUngroupedNodes>5</AllowedUngroupedNodes>
4+
</LinterSettings>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<ExtensionDefinition>
2+
<AssemblyPath>..\bin\SampleLinter.dll</AssemblyPath>
3+
<TypeName>SampleLinter.SampleLinter</TypeName>
4+
</ExtensionDefinition>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"file_hash":null,
3+
"name":"Sample Linter Extension",
4+
"version":"2.0.1",
5+
"description":"Dynamo sample linter extension.",
6+
"group":"",
7+
"keywords":["dynamo","samples, view, extension, linter"],
8+
"dependencies":[],
9+
"license":"MIT",
10+
"contents":"",
11+
"engine_version":"2.0.1",
12+
"engine_metadata":"",
13+
"engine":"dynamo",
14+
"site_url": "http://dynamobim.org/",
15+
"repository_url": "https://github.com/DynamoDS/DynamoSamples",
16+
"node_libraries": [ ]
17+
}

src/DynamoSamples.sln

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25123.0
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.6.33815.320
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleLibraryTests", "SampleLibraryTests\SampleLibraryTests.csproj", "{933B8108-4E74-470A-86C7-4B7F633115B9}"
77
EndProject
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleViewExtension", "Samp
1313
EndProject
1414
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleExtension", "SampleExtension\SampleExtension.csproj", "{8B27B070-8434-49C8-8D43-41A4AE53BC36}"
1515
EndProject
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleLinter", "SampleLinter\SampleLinter.csproj", "{5F559FDB-99B9-4F4A-9A91-C9EC94C771D8}"
17+
EndProject
1618
Global
1719
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1820
Debug|Any CPU = Debug|Any CPU
@@ -39,6 +41,10 @@ Global
3941
{8B27B070-8434-49C8-8D43-41A4AE53BC36}.Debug|Any CPU.Build.0 = Debug|Any CPU
4042
{8B27B070-8434-49C8-8D43-41A4AE53BC36}.Release|Any CPU.ActiveCfg = Release|Any CPU
4143
{8B27B070-8434-49C8-8D43-41A4AE53BC36}.Release|Any CPU.Build.0 = Release|Any CPU
44+
{5F559FDB-99B9-4F4A-9A91-C9EC94C771D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45+
{5F559FDB-99B9-4F4A-9A91-C9EC94C771D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
46+
{5F559FDB-99B9-4F4A-9A91-C9EC94C771D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
47+
{5F559FDB-99B9-4F4A-9A91-C9EC94C771D8}.Release|Any CPU.Build.0 = Release|Any CPU
4248
EndGlobalSection
4349
GlobalSection(SolutionProperties) = preSolution
4450
HideSolutionNode = FALSE

src/SampleLinter/LinterSettings.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Xml.Serialization;
8+
9+
namespace SampleLinter
10+
{
11+
public class LinterSettings
12+
{
13+
[XmlElement("AllowedUngroupedNodes")]
14+
public int AllowedUngroupedNodes { get; set; } = 5;
15+
16+
public static void SerializeModels(string filename, LinterSettings settings)
17+
{
18+
var xmls = new XmlSerializer(settings.GetType());
19+
var writer = new StreamWriter(filename);
20+
xmls.Serialize(writer, settings);
21+
writer.Close();
22+
}
23+
public static LinterSettings DeserializeModels(string filename)
24+
{
25+
var fs = new FileStream(filename, FileMode.Open);
26+
var xmls = new XmlSerializer(typeof(LinterSettings));
27+
return (LinterSettings)xmls.Deserialize(fs);
28+
}
29+
}
30+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// Setting ComVisible to false makes the types in this assembly not visible
6+
// to COM components. If you need to access a type in this assembly from
7+
// COM, set the ComVisible attribute to true on that type.
8+
[assembly: ComVisible(false)]
9+
10+
// The following GUID is for the ID of the typelib if this project is exposed to COM
11+
[assembly: Guid("2EBDA9A0-722E-4C88-826C-62111D4C2C60")]

src/SampleLinter/Properties/Resources.Designer.cs

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/SampleLinter/Properties/Resources.en-US.Designer.cs

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)