This is an automated email from the ASF dual-hosted git repository. kezhenxu94 pushed a commit to branch header/rst in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git
commit 2aeae025a4f68bb4c8ac1cac463ecd47b60f946c Author: kezhenxu94 <[email protected]> AuthorDate: Tue Mar 23 10:47:29 2021 +0800 feature: support .rst files and allow fixing header of a single file --- assets/languages.yaml | 1 + assets/styles.yaml | 5 +++++ commands/header_fix.go | 11 ++++++++--- pkg/license/norm.go | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/assets/languages.yaml b/assets/languages.yaml index 8099dce..505e95f 100644 --- a/assets/languages.yaml +++ b/assets/languages.yaml @@ -6660,6 +6660,7 @@ reStructuredText: codemirror_mode: rst codemirror_mime_type: text/x-rst language_id: 419 + comment_style_id: DoubleDot sed: type: programming color: "#64b970" diff --git a/assets/styles.yaml b/assets/styles.yaml index a79eb6c..08e3fed 100644 --- a/assets/styles.yaml +++ b/assets/styles.yaml @@ -64,3 +64,8 @@ start: ';' middle: ';' end: ';' + +- id: DoubleDot + start: '..' + middle: '..' + end: '..' diff --git a/commands/header_fix.go b/commands/header_fix.go index a022636..f437c02 100644 --- a/commands/header_fix.go +++ b/commands/header_fix.go @@ -34,13 +34,18 @@ var FixCommand = &cobra.Command{ Long: "fix command walks the specified paths recursively and fix the license header if the specified files don't have the license header.", RunE: func(cmd *cobra.Command, args []string) error { var result header.Result + var errors []string + var files []string - if err := header.Check(&Config.Header, &result); err != nil { + if len(args) > 0 { + files = args + } else if err := header.Check(&Config.Header, &result); err != nil { return err + } else { + files = result.Failure } - var errors []string - for _, file := range result.Failure { + for _, file := range files { if err := header.Fix(file, &Config.Header, &result); err != nil { errors = append(errors, err.Error()) } diff --git a/pkg/license/norm.go b/pkg/license/norm.go index cc21552..f18daa1 100644 --- a/pkg/license/norm.go +++ b/pkg/license/norm.go @@ -60,6 +60,7 @@ var ( regexp.MustCompile(`(?m)^\s*-}+`), // -} regexp.MustCompile(`(?m)^\s*::`), // :: + regexp.MustCompile(`(?m)^\s*\.\.`), // .. regexp.MustCompile(`(?mi)^\s*@?REM`), // @REM }
