From 85860a826ad5409a23ba510980a14260fc1fcf63 Mon Sep 17 00:00:00 2001 From: Alberto Moreno Date: Tue, 30 Jun 2020 22:03:03 +0200 Subject: [PATCH] [#22] Introduce SingleQuote comment style --- docs/schema.json | 3 ++- go.sum | 1 + internal/pkg/core/comment_style.go | 1 + internal/pkg/core/comment_style_test.go | 2 ++ .../pkg/core/comment_styles/single_quote.go | 17 +++++++++++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 internal/pkg/core/comment_styles/single_quote.go diff --git a/docs/schema.json b/docs/schema.json index 52d00f6..ac7656e 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -21,7 +21,8 @@ "semicolon", "rem", "slashstarstar", - "xml" + "xml", + "singlequote" ] }, "includes": { diff --git a/go.sum b/go.sum index 0f0e5ee..314190d 100644 --- a/go.sum +++ b/go.sum @@ -96,6 +96,7 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7 golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181112210238-4b1f3b6b1646 h1:JEEoTsNEpPwxsebhPLC6P2jNr+6RFZLY4elUBVcMb+I= diff --git a/internal/pkg/core/comment_style.go b/internal/pkg/core/comment_style.go index 30afc35..c5ee2b3 100644 --- a/internal/pkg/core/comment_style.go +++ b/internal/pkg/core/comment_style.go @@ -55,6 +55,7 @@ func SupportedStyles() []CommentStyle { styles.Rem{}, styles.SlashStarStar{}, styles.Xml{}, + styles.SingleQuote{}, } } diff --git a/internal/pkg/core/comment_style_test.go b/internal/pkg/core/comment_style_test.go index 382aad7..c7f9289 100644 --- a/internal/pkg/core/comment_style_test.go +++ b/internal/pkg/core/comment_style_test.go @@ -47,6 +47,7 @@ var _ = Describe("Comment styles", func() { Entry("matches REM comment style", "REM", "", "", "REM "), Entry("matches SlashStarStar comment style", "SlashStarStar", "/**", " */", " * "), Entry("matches XML comment style", "XML", "", ""), + Entry("matches SingleQuote comment style", "SingleQuote", "", "", "' "), ) It("include only the following", func() { @@ -57,6 +58,7 @@ var _ = Describe("Comment styles", func() { "Hash", "REM", "SemiColon", + "SingleQuote", "SlashSlash", "SlashStar", "SlashStarStar", diff --git a/internal/pkg/core/comment_styles/single_quote.go b/internal/pkg/core/comment_styles/single_quote.go new file mode 100644 index 0000000..77f8cc3 --- /dev/null +++ b/internal/pkg/core/comment_styles/single_quote.go @@ -0,0 +1,17 @@ +package styles + +type SingleQuote struct { +} + +func (SingleQuote) GetName() string { + return "SingleQuote" +} +func (SingleQuote) GetOpeningString() string { + return "" +} +func (SingleQuote) GetString() string { + return "' " +} +func (SingleQuote) GetClosingString() string { + return "" +}