-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[config]Support config license header comment style. #97
Conversation
Hi skywalking-eyes community, I don't understand why the project CI failure, who can help me, Thanks. |
pkg/config/config.go
Outdated
@@ -18,6 +18,7 @@ | |||
package config | |||
|
|||
import ( | |||
"github.com/apache/skywalking-eyes/pkg/comments" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongzl Please move this to line 25 and this should fix your lint, try run gofmt -s -w pkg/config/config.go
to fix it automatically. Just a formatting issue compaint by the CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongzl Please move this to line 25 and this should fix your lint, try run
gofmt -s -w pkg/config/config.go
to fix it automatically. Just a formatting issue compaint by the CI.
@Superskyyy It's OK, Thanks very much.
@kezhenxu94 Please take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IT's better to merge the user-configured settings with the default ones (
skywalking-eyes/pkg/comments/config.go
Line 55 in eb0e0b0
var commentStyles = make(map[string]CommentStyle) |
fix
logic.
pkg/config/config.go
Outdated
Deps deps.ConfigDeps `yaml:"dependency"` | ||
Header header.ConfigHeader `yaml:"header"` | ||
Deps deps.ConfigDeps `yaml:"dependency"` | ||
Languages map[string]comments.Language `yaml:"language"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config should be under Header
.licenserc.yaml
Outdated
type: programming | ||
color: "#00ADD8" | ||
aliases: | ||
- golang | ||
extensions: | ||
- ".go" | ||
tm_scope: source.go | ||
ace_mode: golang | ||
codemirror_mode: go | ||
codemirror_mime_type: text/x-go | ||
language_id: 132 | ||
comment_style_id: SlashAsterisk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please minimize the configs, we only need some of the fields, like comment_style_id
and extensions
,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please minimize the configs, we only need some of the fields, like
comment_style_id
andextensions
,
Hi @kezhenxu94 , Thanks for reply, I will fix it.
Hi @kezhenxu94 , I considered about this way, but read code, |
Hi @dongzl , the way I proposed needs some other changes for sure, you can
|
Hi @kezhenxu94 , OK I understand, I will try it. |
@@ -104,6 +106,8 @@ func (config *ConfigHeader) Finalize() error { | |||
config.Paths = []string{"**"} | |||
} | |||
|
|||
comments.OverrideLanguageCommentStyle(config.Languages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@dongzl nice done! Can you open another pull request to add the usage into the documentation as well? |
Hi @kezhenxu94 , Thanks for your code review, I will finish documentation. |
Recently, I use this project to fix myself project license header, It is a GoLand project.
I find that the header comment style config at the
languages.yaml
andstyles.yaml
, and it doesn't support config.The
Go
file license header comment style is//
, like:But I want the license header comment style is
*
, like:So, I fix code and submit this PR.
I add the config
languages
at the.licenserc.yaml
, and the license header comment style use this file config preferentially, if this file doesn't have this config, it use the default config at thelanguages.yaml
.