You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ke...@apache.org on 2021/02/27 15:05:28 UTC
[skywalking-eyes] branch main updated: defect: avoid crash when no
comment style is found (#23)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git
The following commit(s) were added to refs/heads/main by this push:
new bc75689 defect: avoid crash when no comment style is found (#23)
bc75689 is described below
commit bc75689a2d8de27472cedf2bcec25edba2526104
Author: Zhenxu Ke <ke...@apache.org>
AuthorDate: Sat Feb 27 23:05:21 2021 +0800
defect: avoid crash when no comment style is found (#23)
---
.golangci.yml | 2 +-
pkg/review/header.go | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/.golangci.yml b/.golangci.yml
index 79ddd86..d96a69f 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -25,7 +25,7 @@ linters-settings:
golint:
min-confidence: 0
gocyclo:
- min-complexity: 15
+ min-complexity: 20
maligned:
suggest-new: true
dupl:
diff --git a/pkg/review/header.go b/pkg/review/header.go
index 8b96e26..b9cae79 100644
--- a/pkg/review/header.go
+++ b/pkg/review/header.go
@@ -144,7 +144,12 @@ func Header(result *header2.Result, config *config2.Config) error {
logger.Log.Warnln("Failed to get blob:", changedFile.GetFilename(), changedFile.GetSHA())
continue
}
- header, err := header2.GenerateLicenseHeader(comments2.FileCommentStyle(changedFile.GetFilename()), &config.Header)
+ style := comments2.FileCommentStyle(changedFile.GetFilename())
+ if style == nil {
+ logger.Log.Warnln("Failed to determine the comment style of file:", changedFile.GetFilename())
+ continue
+ }
+ header, err := header2.GenerateLicenseHeader(style, &config.Header)
if err != nil {
logger.Log.Warnln("Failed to generate comment header:", changedFile.GetFilename())
continue