| // |
| // Licensed to Apache Software Foundation (ASF) under one or more contributor |
| // license agreements. See the NOTICE file distributed with |
| // this work for additional information regarding copyright |
| // ownership. Apache Software Foundation (ASF) licenses this file to you under |
| // the Apache License, Version 2.0 (the "License"); you may |
| // not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| // |
| = License-Eye |
| :repo: https://github.com/apache/skywalking-eyes |
| |
| A full-featured license guard to check and fix license headers and dependencies' licenses. |
| |
| == Install |
| |
| [subs="attributes",source,bash] |
| ---- |
| git clone {repo} |
| cd skywalking-eyes/license-eye |
| make |
| ---- |
| |
| == Usage |
| |
| [source,bash] |
| ---- |
| $ license-eye -c ./licenserc.yaml header check |
| $ license-eye -c ./licenserc.yaml header fix |
| ---- |
| |
| == Configuration |
| |
| [source,yaml] |
| .link:../.licenserc.yaml[.licenserc.yaml] |
| ---- |
| include::../.licenserc.yaml[] |
| ---- |
| |
| == Check License Header |
| |
| [source,bash] |
| ---- |
| $ bin/license-eye -c test/testdata/.licenserc_for_test_fix.yaml header check |
| |
| INFO Loading configuration from file: test/testdata/.licenserc_for_test.yaml serc_for_test.yaml |
| INFO Totally checked 23 files, valid: 8, invalid: 8, ignored: 7, fixed: 0 |
| ERROR The following files don't have a valid license header: |
| test/testdata/include_test/without_license/testcase.go |
| test/testdata/include_test/without_license/testcase.graphql |
| test/testdata/include_test/without_license/testcase.java |
| test/testdata/include_test/without_license/testcase.md |
| test/testdata/include_test/without_license/testcase.py |
| test/testdata/include_test/without_license/testcase.sh |
| test/testdata/include_test/without_license/testcase.yaml |
| test/testdata/include_test/without_license/testcase.yml |
| exit status 1 |
| ---- |
| |
| == Fix License Header |
| |
| [source,bash] |
| ---- |
| $ bin/license-eye -c test/testdata/.licenserc_for_test_fix.yaml header fix |
| |
| INFO Loading configuration from file: test/testdata/.licenserc_for_test_fix.yaml |
| INFO Totally checked 16 files, valid: 7, invalid: 8, ignored: 1, fixed: 8 |
| ---- |
| |
| == Supported File Types |
| |
| The `check` command theoretically supports all kinds of file types, while the supported file types of `fix` command can be found link:assets/languages.yaml[in this YAML file]. |
| In the YAML file, if the language has a non-empty property `comment_style_id`, and the comment style id is declared in link:assets/styles.yaml[the comment styles file], then the language is supported by `fix` command. |
| |
| [source,yaml] |
| .link:assets/languages.yaml[tags=java] |
| ---- |
| include::assets/languages.yaml[tags=java] |
| ---- |
| |
| [source,yaml] |
| .link:assets/styles.yaml[tags=SlashAsterisk] |
| ---- |
| include::assets/styles.yaml[tags=SlashAsterisk] |
| ---- |
| <1> The leading characters of the starting of a block comment. |
| <2> The leading characters of the middle lines of a block comment. |
| <3> The leading characters of the ending line of a block comment. |
| |
| == Contribution |
| |
| If you found any file type is supported by the aforementioned configurations, feel free to link:https://github.com/apache/skywalking-eyes/pulls[open a pull request] to add the configuration into the 2 files. |
| |
| == License |
| |
| link:https://github.com/apache/skywalking/blob/master/LICENSE[Apache License 2.0] |