Skip to content

Commit

Permalink
Custom commit types (#29)
Browse files Browse the repository at this point in the history
* feat: basic support for custom type of commit

* test: custom commit-types

* build: cleanup warnings

* revert c# 7.1 features

* feat(UI): Add commands to access configuration files

* use system.runtime.caching

* docs(customizations): update readme

* test: more test about caching

closes #23
  • Loading branch information
MrLuje authored May 2, 2020
1 parent f835244 commit 8ab8432
Show file tree
Hide file tree
Showing 50 changed files with 2,130 additions and 427 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
# Controls when the action will run. Triggers the workflow when a release is published
on:
release:
types: [published]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
publish:
# The type of runner that the job will run on
runs-on: windows-latest

# Steps represent a sequence of tasks that will be executed as part of the job
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,39 @@ This extension adds [commitizen](https://github.com/commitizen/) support to Visu
- Nice page to format your comment using commitizen fashion.

![vs-commitizen_-_commitizen_view.png](images/commitizen-view.png)

## Customizations

The list of "Type of changes" can be customized, globally or per repository.

The configuration is stored in a *.commitizen.json* file ([schema](./config-schema.json))

You can access the configuration file directly from VisualStudio menu (files will be generated if not existing yet) :


![menu.png](images/menu.png)

#### Sample configuration

```json
{
"$schema": "https://github.com/MrLuje/vs-commitizen/config-schema.json",
"types": [
{
"type": "feat",
"description": "A new feature"
},
{
"type": "fix",
"description": "A bug fix"
},
{
"type": "docs",
"description": "Documentation only changes"
},
{
"type": "test",
"description": "Adding missing tests or correcting existing tests"
}
}
```
12 changes: 1 addition & 11 deletions ViewTest/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory.Platform" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.19.1.3001" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Azure.Services.AppAuthentication" publicKeyToken="31bf3856ad364e35" culture="neutral" />
Expand Down Expand Up @@ -257,18 +252,13 @@
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.1.3" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.1.1" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
Expand Down
18 changes: 17 additions & 1 deletion ViewTest/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Windows;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows;
using vs_commitizen.Settings;
using vs_commitizen.vs.Settings;

Expand All @@ -12,6 +14,7 @@ public partial class MainWindow : Window
public MainWindow()
{
IoC.Container.Inject<IUserSettings>(new DummyUserSettings());
IoC.Container.Inject<IConfigFileProvider>(new DummyConfigFileProvider());

InitializeComponent();
}
Expand All @@ -20,5 +23,18 @@ public class DummyUserSettings : IUserSettings
{
public int MaxLineLength { get; set; } = 80;
}

internal class DummyConfigFileProvider : IConfigFileProvider
{
public Task<IList<T>> GetCommitTypesAsync<T>() where T : class
{
throw new System.NotImplementedException();
}

public Task<string> TryGetLocalConfigAsync()
{
throw new System.NotImplementedException();
}
}
}
}
29 changes: 29 additions & 0 deletions config-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/MrLuje/vs-commitizen/config-schema.json",
"title": "Configuration",
"description": "Configuration file for vs-commitizen",
"type": "object",
"properties": {
"types": {
"description": "List of 'type of commit' available",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the commit type"
},
"description": {
"type": "string",
"description": "Optional description for the commit type"
}
},
"required": [
"name"
]
}
}
}
}
Binary file added images/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ framework: auto-detect

nuget Microsoft.AspNet.WebApi.Core 5.2.2
nuget Microsoft.VisualStudio.SDK.Analyzers 15.8.36
nuget Microsoft.VisualStudio.Services.InteractiveClient 15.112.1
#nuget Microsoft.VSSDK.BuildTools ~> 14.3 #to debug 2015 exp
# nuget Microsoft.VisualStudio.Services.InteractiveClient 15.112.1
# nuget Microsoft.VSSDK.BuildTools ~> 14.3 #to debug 2015 exp
nuget Microsoft.VSSDK.BuildTools ~> 16.5.2044 #to debug 2017 exp
nuget Newtonsoft.Json 11.0.1
nuget Microsoft.VisualStudio.Shell.Interop.12.0 ~> 12.0
nuget Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime
nuget Microsoft.VisualStudio.Threading == 15.8.192 redirects: force, copy_local: false
nuget Newtonsoft.Json 12.0.3
nuget StructureMap 4.6.1
# nuget System.Runtime 4.3.1 redirects: on

nuget AutoFixture.Xunit2 ~> 4.1
nuget AutoFixture.AutoNSubstitute ~> 4.2
nuget NSubstitute ~> 3.1
nuget NSubstitute ~> 4.2
nuget Shouldly ~> 3.0
nuget xunit ~> 2.3.1
nuget xunit.runner.visualstudio ~> 2.3.1 version_in_path: true
Expand Down
115 changes: 50 additions & 65 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,49 @@ NUGET
Newtonsoft.Json (>= 6.0.4)
Microsoft.AspNet.WebApi.Core (5.2.2)
Microsoft.AspNet.WebApi.Client (>= 5.2.2)
Microsoft.Azure.Services.AppAuthentication (1.4)
Microsoft.IdentityModel.Clients.ActiveDirectory (>= 5.2)
Microsoft.IdentityModel.Clients.ActiveDirectory (5.2.7)
System.Net.Http (>= 4.3.4)
Microsoft.IdentityModel.JsonWebTokens (6.5)
Microsoft.IdentityModel.Tokens (>= 6.5)
Microsoft.IdentityModel.Logging (6.5)
Microsoft.IdentityModel.Tokens (6.5)
Microsoft.IdentityModel.Logging (>= 6.5)
Microsoft.Rest.ClientRuntime (2.3.21)
Newtonsoft.Json (>= 10.0.3)
Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime (14.3.26930)
Microsoft.VisualStudio.SDK.EmbedInteropTypes (>= 15.0.16)
Microsoft.VisualStudio.OLE.Interop (7.10.6071)
Microsoft.VisualStudio.SDK.Analyzers (15.8.36)
Microsoft.VisualStudio.Threading.Analyzers (>= 15.8.168)
Microsoft.VisualStudio.Services.Client (15.112.1)
Microsoft.AspNet.WebApi.Client (>= 5.2.2)
Newtonsoft.Json (>= 8.0.3)
Microsoft.VisualStudio.Services.InteractiveClient (15.112.1)
Microsoft.AspNet.WebApi.Client (>= 5.2.2)
Microsoft.IdentityModel.Clients.ActiveDirectory (>= 3.13.5)
Microsoft.VisualStudio.Services.Client (15.112.1)
Newtonsoft.Json (>= 8.0.3)
System.IdentityModel.Tokens.Jwt (>= 4.0.2.206221351)
WindowsAzure.ServiceBus (>= 3.3.2)
Microsoft.VisualStudio.Threading.Analyzers (16.6.13)
Microsoft.VisualStudio.SDK.EmbedInteropTypes (15.0.30)
Microsoft.VisualStudio.Shell.Interop (7.10.6072)
Microsoft.VisualStudio.TextManager.Interop (>= 7.10.6071)
Microsoft.VisualStudio.Shell.Interop.10.0 (10.0.30320)
Microsoft.VisualStudio.Shell.Interop.8.0 (>= 8.0.50728)
Microsoft.VisualStudio.Shell.Interop.11.0 (11.0.61031)
Microsoft.VisualStudio.Shell.Interop.10.0 (>= 10.0.30320)
Microsoft.VisualStudio.Shell.Interop.12.0 (12.0.30111)
Microsoft.VisualStudio.Shell.Interop.11.0 (>= 11.0.61031)
Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime (14.3.26929)
Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime (>= 14.3.26930)
Microsoft.VisualStudio.SDK.EmbedInteropTypes (>= 15.0.16)
Microsoft.VisualStudio.Shell.Interop.12.0 (>= 12.0.30111)
Microsoft.VisualStudio.Shell.Interop.8.0 (8.0.50728)
Microsoft.VisualStudio.Shell.Interop (>= 7.10.6072)
Microsoft.VisualStudio.TextManager.Interop.8.0 (>= 8.0.50728)
Microsoft.VisualStudio.TextManager.Interop (7.10.6071)
Microsoft.VisualStudio.OLE.Interop (>= 7.10.6071)
Microsoft.VisualStudio.TextManager.Interop.8.0 (8.0.50728)
Microsoft.VisualStudio.Shell.Interop (>= 7.10.6072)
Microsoft.VisualStudio.Threading (15.8.192) - copy_local: false, redirects: force
Microsoft.VisualStudio.Threading.Analyzers (>= 15.8.192)
Microsoft.VisualStudio.Validation (>= 15.3.15)
Microsoft.VisualStudio.Threading.Analyzers (16.6.13) - copy_local: false, redirects: force
Microsoft.VisualStudio.Validation (15.5.31) - copy_local: false, redirects: force
Microsoft.VSSDK.BuildTools (16.5.2044)
Microsoft.VisualStudio.SDK.Analyzers (>= 15.8.33)
Newtonsoft.Json (11.0.1)
NSubstitute (3.1)
Castle.Core (>= 4.2)
Newtonsoft.Json (12.0.3)
NSubstitute (4.2.1)
Castle.Core (>= 4.4)
System.Threading.Tasks.Extensions (>= 4.3)
Shouldly (3.0.2)
StructureMap (4.6.1)
System.Reflection.Emit.Lightweight (>= 4.3)
System.IdentityModel.Tokens.Jwt (6.5)
Microsoft.IdentityModel.JsonWebTokens (>= 6.5)
Microsoft.IdentityModel.Tokens (>= 6.5)
System.IO (4.3)
System.Net.Http (4.3.4)
System.Security.Cryptography.X509Certificates (>= 4.3)
System.Reflection.Emit.Lightweight (4.7)
System.Runtime (4.3.1)
System.Runtime.CompilerServices.Unsafe (4.7.1)
System.Security.Cryptography.Algorithms (4.3.1)
System.IO (>= 4.3)
System.Runtime (>= 4.3)
System.Security.Cryptography.Encoding (>= 4.3)
System.Security.Cryptography.Primitives (>= 4.3)
System.Security.Cryptography.Encoding (4.3)
System.Security.Cryptography.Primitives (4.3)
System.Security.Cryptography.X509Certificates (4.3.2)
System.Security.Cryptography.Algorithms (>= 4.3)
System.Security.Cryptography.Encoding (>= 4.3)
System.Threading.Tasks.Extensions (4.5.4)
System.Runtime.CompilerServices.Unsafe (>= 4.5.3)
WindowsAzure.ServiceBus (6.0.1)
Microsoft.Azure.Services.AppAuthentication (>= 1.0.3)
Microsoft.Rest.ClientRuntime (>= 2.3.20)
System.IdentityModel.Tokens.Jwt (>= 4.0.4.403061554)
xunit (2.3.1)
xunit.analyzers (>= 0.7)
xunit.assert (2.3.1)
Expand Down Expand Up @@ -262,12 +247,12 @@ NUGET
Microsoft.VisualStudio.OLE.Interop (>= 7.10.6071)
Microsoft.VisualStudio.TextManager.Interop.8.0 (8.0.50728) - copy_local: false
Microsoft.VisualStudio.Shell.Interop (>= 7.10.6072)
Microsoft.VisualStudio.Threading (15.8.192) - redirects: force
Microsoft.VisualStudio.Threading (15.8.192) - copy_local: false, redirects: force
Microsoft.VisualStudio.Threading.Analyzers (>= 15.8.192)
Microsoft.VisualStudio.Validation (>= 15.3.15)
Microsoft.VisualStudio.Threading.Analyzers (16.6.13) - redirects: force
Microsoft.VisualStudio.Threading.Analyzers (16.6.13) - copy_local: false, redirects: force
Microsoft.VisualStudio.Utilities (15.0.26607)
Microsoft.VisualStudio.Validation (15.5.31) - redirects: force
Microsoft.VisualStudio.Validation (15.5.31) - copy_local: false, redirects: force
Newtonsoft.Json (12.0.3) - copy_local: false, redirects: force
System.IdentityModel.Tokens.Jwt (6.5) - copy_local: false, redirects: force
Microsoft.IdentityModel.JsonWebTokens (>= 6.5)
Expand Down Expand Up @@ -427,15 +412,15 @@ NUGET
Microsoft.VisualStudio.OLE.Interop (>= 7.10.6071)
Microsoft.VisualStudio.TextManager.Interop.8.0 (8.0.50728) - copy_local: false
Microsoft.VisualStudio.Shell.Interop (>= 7.10.6072)
Microsoft.VisualStudio.Threading (15.8.192) - redirects: force
Microsoft.VisualStudio.Threading (15.8.192) - copy_local: false, redirects: force
Microsoft.VisualStudio.Threading.Analyzers (>= 15.8.192)
Microsoft.VisualStudio.Validation (>= 15.3.15)
Microsoft.VisualStudio.Threading.Analyzers (16.6.13) - redirects: force
Microsoft.VisualStudio.Threading.Analyzers (16.6.13) - copy_local: false, redirects: force
Microsoft.VisualStudio.Utilities (15.9.28307)
Microsoft.VisualStudio.Threading (>= 15.6.31)
StreamJsonRpc (>= 1.3.23)
Microsoft.VisualStudio.Validation (15.5.31) - redirects: force
Nerdbank.Streams (2.4.67)
Microsoft.VisualStudio.Validation (15.5.31) - copy_local: false, redirects: force
Nerdbank.Streams (2.4.73)
Microsoft.VisualStudio.Threading (>= 16.4.33)
Microsoft.VisualStudio.Validation (>= 15.5.31)
System.Buffers (>= 4.5)
Expand All @@ -444,14 +429,14 @@ NUGET
System.Runtime.CompilerServices.Unsafe (>= 4.6)
System.ValueTuple (>= 4.5)
Newtonsoft.Json (12.0.3) - copy_local: false, redirects: force
StreamJsonRpc (2.3.103)
StreamJsonRpc (2.4.48)
MessagePack (>= 2.1.90)
Microsoft.Bcl.AsyncInterfaces (>= 1.0)
Microsoft.VisualStudio.Threading (>= 16.4.45)
Nerdbank.Streams (>= 2.4.60)
Microsoft.VisualStudio.Threading (>= 16.6.13)
Nerdbank.Streams (>= 2.4.73)
Newtonsoft.Json (>= 12.0.2)
System.Collections.Immutable (>= 1.5)
System.IO.Pipelines (>= 4.6)
System.IO.Pipelines (>= 4.7)
System.Memory (>= 4.5.3)
System.Net.Http (>= 4.3.4)
System.Net.WebSockets (>= 4.3)
Expand Down Expand Up @@ -637,17 +622,17 @@ NUGET
Microsoft.VisualStudio.OLE.Interop (>= 7.10.6071)
Microsoft.VisualStudio.TextManager.Interop.8.0 (8.0.50728) - copy_local: false
Microsoft.VisualStudio.Shell.Interop (>= 7.10.6072)
Microsoft.VisualStudio.Threading (15.8.192) - redirects: force
Microsoft.VisualStudio.Threading (15.8.192) - copy_local: false, redirects: force
Microsoft.VisualStudio.Threading.Analyzers (>= 15.8.192)
Microsoft.VisualStudio.Validation (>= 15.3.15)
Microsoft.VisualStudio.Threading.Analyzers (16.6.13) - redirects: force
Microsoft.VisualStudio.Threading.Analyzers (16.6.13) - copy_local: false, redirects: force
Microsoft.VisualStudio.Utilities (16.5.29903.186) - copy_local: false
Microsoft.VisualStudio.Threading (>= 16.5.132)
Newtonsoft.Json (>= 12.0.2)
StreamJsonRpc (>= 2.3.99)
System.Threading.Tasks.Dataflow (>= 4.9)
Microsoft.VisualStudio.Validation (15.5.31) - redirects: force
Nerdbank.Streams (2.4.67) - copy_local: false
Microsoft.VisualStudio.Validation (15.5.31) - copy_local: false, redirects: force
Nerdbank.Streams (2.4.73) - copy_local: false
Microsoft.VisualStudio.Threading (>= 16.4.33)
Microsoft.VisualStudio.Validation (>= 15.5.31)
System.Buffers (>= 4.5)
Expand All @@ -656,14 +641,14 @@ NUGET
System.Runtime.CompilerServices.Unsafe (>= 4.6)
System.ValueTuple (>= 4.5)
Newtonsoft.Json (12.0.3) - copy_local: false, redirects: force
StreamJsonRpc (2.3.103) - copy_local: false
StreamJsonRpc (2.4.48) - copy_local: false
MessagePack (>= 2.1.90)
Microsoft.Bcl.AsyncInterfaces (>= 1.0)
Microsoft.VisualStudio.Threading (>= 16.4.45)
Nerdbank.Streams (>= 2.4.60)
Microsoft.VisualStudio.Threading (>= 16.6.13)
Nerdbank.Streams (>= 2.4.73)
Newtonsoft.Json (>= 12.0.2)
System.Collections.Immutable (>= 1.5)
System.IO.Pipelines (>= 4.6)
System.IO.Pipelines (>= 4.7)
System.Memory (>= 4.5.3)
System.Net.Http (>= 4.3.4)
System.Net.WebSockets (>= 4.3)
Expand Down
4 changes: 4 additions & 0 deletions vs-commitizen.Settings/ExtensionRegistry.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Microsoft.VisualStudio.Shell;
using StructureMap;
using System;
using System.IO;
using System.Reflection;
using vs_commitizen.vs.Settings;

namespace vs_commitizen.Settings
Expand All @@ -12,7 +14,9 @@ public ExtensionRegistry()
this.Scan(i =>
{
i.TheCallingAssembly();
i.AssembliesFromPath(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location));
i.WithDefaultConventions();
i.LookForRegistries();
});

this.For<IUserSettings>().Use<UserSettings>();
Expand Down
Loading

0 comments on commit 8ab8432

Please sign in to comment.