This is an automated email from the ASF dual-hosted git repository. hoshea pushed a commit to branch dev in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git
commit 0af8fe25fa4bcd6a0272b1f53dc45d4e0f410cda Author: Hoshea <[email protected]> AuthorDate: Sat Dec 26 15:49:45 2020 +0800 init the structure of quality-eye --- .golangci.yml | 2 +- README.md | 5 +- license-eye/README.adoc | 202 ------------------------------ license-eye/README.md | 189 ++++++++++++++++++++++++++++ license-eye/commands/header/fix.go | 3 +- license-eye/go.sum | 1 - license-eye/pkg/comments/config.go | 3 +- license-eye/pkg/review/header.go | 5 +- quality-eye/LICENSE | 210 ++++++++++++++++++++++++++++++++ quality-eye/Makefile | 98 +++++++++++++++ quality-eye/cmd/quality-eye/main.go | 32 +++++ quality-eye/commands/cleanup/cleanup.go | 32 +++++ quality-eye/commands/root.go | 47 +++++++ quality-eye/commands/run/run.go | 32 +++++ quality-eye/commands/setup/setup.go | 32 +++++ quality-eye/commands/trigger/trigger.go | 32 +++++ quality-eye/commands/verify/verify.go | 32 +++++ quality-eye/commands/version.go | 20 +++ quality-eye/go.mod | 9 ++ {license-eye => quality-eye}/go.sum | 17 +-- quality-eye/internal/logger/log.go | 39 ++++++ 21 files changed, 821 insertions(+), 221 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f4a6fee..fc7e1c0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -75,7 +75,7 @@ linters-settings: lll: line-length: 150 goimports: - local-prefixes: github.com/apache/skywalking-cli + local-prefixes: github.com/apache/skywalking-eyes gocritic: enabled-tags: - diagnostic diff --git a/README.md b/README.md index 8f94610..4e7daa9 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Infra tools that are created and used by the SkyWalking Team. [](https://twitter.com/AsfSkyWalking) ## Contact Us + * Submit [an issue](https://github.com/apache/skywalking/issues/new) by using [INFRA] as title prefix. * Mail list: **[email protected]**. Mail to `[email protected]`, follow the reply to subscribe the mail list. * Join `skywalking` channel at [Apache Slack](http://s.apache.org/slack-invite). If the link is not working, find the latest one at [Apache INFRA WIKI](https://cwiki.apache.org/confluence/display/INFRA/Slack+Guest+Invites). @@ -14,9 +15,9 @@ Infra tools that are created and used by the SkyWalking Team. ## License Eye -A full-featured license guard to check and fix license headers and dependencies' licenses. +A full-featured license tool to check and fix license headers and dependencies' licenses. -Read [the doc](license-eye/README.adoc) on how to use license-eye. +Read [the doc](license-eye/README.md) on how to use license-eye. ## Quality Eye diff --git a/license-eye/README.adoc b/license-eye/README.adoc deleted file mode 100644 index d22ade3..0000000 --- a/license-eye/README.adoc +++ /dev/null @@ -1,202 +0,0 @@ -// -// 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 -:name: License-Eye - -A full-featured license guard to check and fix license headers and dependencies' licenses. - -== Usage - -You can use {name} in GitHub Actions or in your local machine. - -=== GitHub Actions - -To use {name} in GitHub Actions, add a step in your GitHub workflow. - -[source,yaml] ----- -- name: Check License Header - uses: apache/skywalking-eyes@main # always prefer to use a revision instead of `main`. - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # needed only when you want License-Eye to comment on the pull request. ----- - -Add a `.licenserc.yaml` in the root of your project, for Apache Software Foundation projects, the following configuration should be enough. - -[source,yaml] ----- -header: - license: - spdx-id: Apache-2.0 - copyright-owner: Apache Software Foundation - - paths-ignore: - - 'dist' - - 'licenses' - - '**/*.md' - - 'LICENSE' - - 'NOTICE' - - comment: on-failure ----- - -NOTE: The full configurations can be found in <<Configurations,the configuration section>>. - -=== Use as a Binary - -==== Install - -[subs="attributes",source,bash] ----- -$ git clone {repo} -$ cd skywalking-eyes/license-eye -$ make build ----- - -===== Check License Header - -[source,bash] ----- -$ bin/darwin/license-eye -c test/testdata/.licenserc_for_test_fix.yaml header check - -INFO Loading configuration from file: test/testdata/.licenserc_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/darwin/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 ----- - -== Configurations - -[source,yaml] ----- -header: # <1> - license: - spdx-id: Apache-2.0 # <2> - copyright-owner: Apache Software Foundation # <3> - content: | # <4> - 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. - - pattern: | # <5> - Licensed to the Apache Software Foundation under one or more contributor - license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright - ownership. The Apache Software Foundation 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. - - paths: # <6> - - '**' - - paths-ignore: # <7> - - 'dist' - - 'licenses' - - '**/*.md' - - '**/testdata/**' - - '**/go.mod' - - '**/go.sum' - - 'LICENSE' - - 'NOTICE' - - '**/assets/languages.yaml' - - '**/assets/assets.gen.go' - - comment: on-failure # <8> ----- -<1> `header` section is configurations for source codes license header. -<2> The link:https://spdx.org/licenses/[SPDX ID] of the license, it's convenient when your license is standard SPDX license, so that you can simply specify this identifier without copying the whole license `content` or `pattern`. This will be used as the content when `fix` command needs to insert a license header. -<3> The copyright owner to replace the `[owner]` in the `SPDX-ID` license template. -<4> If you are not using the standard license text, you can paste your license text here, this will be used as the content when `fix` command needs to insert a license header, if both `license` and `SPDX-ID` are specified, `license` wins. -<5> `pattern` is an optional regexp. You don't need this if all the file headers are the same as `license` or the license of `SPDX-ID`, otherwise you need to compose a pattern that matches your license texts. -<6> `paths` are the path list that will be checked (and fixed) by license-eye, default is `['++**++']`. Formats like `++**/*.md++` and `++**/bin/**++` are supported. -<7> `paths-ignore` are the path list that will be ignored by license-eye. By default, `.git` and the content in `.gitignore` will be inflated into the `paths-ignore` list. -<8> On what condition {name} will comment the check results on the pull request, `on-failure`, `always`, `never`. Options other than `never` require the environment variable `GITHUB_TOKEN` to be set. - -NOTE: When the `SPDX-ID` is Apache-2.0 and the owner is Apache Software foundation, the content would be link:https://www.apache.org/legal/src-headers.html#headers[a dedicated license] link:https://www.apache.org/foundation/license-faq.html#Apply-My-Software[specified by the ASF], otherwise, the license would be link:https://www.apache.org/foundation/license-faq.html#Apply-My-Software[the standard one]. - -== 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 find any file type should be supported by the aforementioned configurations but is not listed there, feel free to link:https://github.com/apache/skywalking-eyes/pulls[open a pull request] to add the configuration into the 2 files. -- If you find the license template of an SPDX ID is not supported, feel free to link:https://github.com/apache/skywalking-eyes/pulls[open a pull request] to add it into link:assets/lcs-templates[the template folder]. - -== License - -link:https://github.com/apache/skywalking/blob/master/LICENSE[Apache License 2.0] diff --git a/license-eye/README.md b/license-eye/README.md new file mode 100644 index 0000000..3d77911 --- /dev/null +++ b/license-eye/README.md @@ -0,0 +1,189 @@ +# License-Eye + +A full-featured license tool to check and fix license headers and dependencies' licenses. + +## Usage + +You can use License-Eye in GitHub Actions or in your local machine. + +### GitHub Actions + +To use License-Eye in GitHub Actions, add a step in your GitHub workflow. + +```yaml +- name: Check License Header + uses: apache/skywalking-eyes@main # always prefer to use a revision instead of `main`. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # needed only when you want License-Eye to comment on the pull request. +``` + +Add a `.licenserc.yaml` in the root of your project, for Apache Software Foundation projects, the following configuration should be enough. + +```yaml +header: + license: + spdx-id: Apache-2.0 + copyright-owner: Apache Software Foundation + + paths-ignore: + - 'dist' + - 'licenses' + - '**/*.md' + - 'LICENSE' + - 'NOTICE' + + comment: on-failure +``` + +**NOTE**: The full configurations can be found in [the configuration section](#Configurations). + +### Use as a Binary + +#### Install + +```bash +git clone https://github.com/apache/skywalking-eyes +cd skywalking-eyes/license-eye +make build +``` + +#### Check License Header + +```bash +$ bin/darwin/license-eye -c test/testdata/.licenserc_for_test_fix.yaml header check + +INFO Loading configuration from file: test/testdata/.licenserc_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 + +```bash +$ bin/darwin/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 +``` + +## Configurations + +```yaml +header: # <1> + license: + spdx-id: Apache-2.0 # <2> + copyright-owner: Apache Software Foundation # <3> + content: | # <4> + 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. + + pattern: | # <5> + Licensed to the Apache Software Foundation under one or more contributor + license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright + ownership. The Apache Software Foundation 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. + + paths: # <6> + - '**' + + paths-ignore: # <7> + - 'dist' + - 'licenses' + - '**/*.md' + - '**/testdata/**' + - '**/go.mod' + - '**/go.sum' + - 'LICENSE' + - 'NOTICE' + - '**/assets/languages.yaml' + - '**/assets/assets.gen.go' + + comment: on-failure # <8> +``` + +1. The `header` section is configurations for source codes license header. +1. The [SPDX ID](https://spdx.org/licenses/) of the license, it’s convenient when your license is standard SPDX license, so that you can simply specify this identifier without copying the whole license `content` or `pattern`. This will be used as the content when `fix` command needs to insert a license header. +1. The copyright owner to replace the `[owner]` in the `SPDX-ID` license template. +1. If you are not using the standard license text, you can paste your license text here, this will be used as the content when `fix` command needs to insert a license header, if both `license` and `SPDX-ID` are specified, `license` wins. +1. The `pattern` is an optional regexp. You don’t need this if all the file headers are the same as `license` or the license of `SPDX-ID`, otherwise you need to compose a pattern that matches your license texts. +1. The `paths` are the path list that will be checked (and fixed) by license-eye, default is `['**']`. Formats like `**/*`.md and `**/bin/**` are supported. +1. The `paths-ignore` are the path list that will be ignored by license-eye. By default, `.git` and the content in `.gitignore` will be inflated into the `paths-ignore` list. +1. On what condition License-Eye will comment the check results on the pull request, `on-failure`, `always` or `never`. Options other than `never` require the environment variable `GITHUB_TOKEN` to be set. + +**NOTE**: When the `SPDX-ID` is Apache-2.0 and the owner is Apache Software foundation, the content would be [a dedicated license](https://www.apache.org/legal/src-headers.html#headers) specified by the ASF, otherwise, the license would be [the standard one](https://www.apache.org/foundation/license-faq.html#Apply-My-Software). + +## Supported File Types + +The `check` command theoretically supports all kinds of file types, while the supported file types of `fix` command can be found [in this YAML file](assets/languages.yaml). In the YAML file, if the language has a non-empty property `comment_style_id`, and the comment style id is declared in [the comment styles file](assets/styles.yaml), then the language is supported by `fix` command. + +- [assets/languages.yaml](assets/languages.yaml) + ```yaml + Java: + type: programming + tm_scope: source.java + ace_mode: java + codemirror_mode: clike + codemirror_mime_type: text/x-java + color: "#b07219" + extensions: + - ".java" + language_id: 181 + comment_style_id: SlashAsterisk + ``` + +- [assets/languages.yaml](assets/languages.yaml) + + ```yaml + - id: SlashAsterisk + start: '/*' # (1) + middle: ' *' # (2) + end: ' */' # (3) + ``` + + 1. The leading characters of the starting of a block comment. + 1. The leading characters of the middle lines of a block comment. + 1. The leading characters of the ending line of a block comment. + +## Contribution + +- If you find any file type should be supported by the aforementioned configurations, but it's not listed there, feel free to [open a pull request](https://github.com/apache/skywalking-eyes/pulls) to add the configuration into the two files. +- If you find the license template of an SPDX ID is not supported, feel free to [open a pull request](https://github.com/apache/skywalking-eyes/pulls) to add it into [the template folder](assets/lcs-templates). + +## License + +[Apache License 2.0](https://github.com/apache/skywalking/blob/master/LICENSE) \ No newline at end of file diff --git a/license-eye/commands/header/fix.go b/license-eye/commands/header/fix.go index 4fbba48..55c72e4 100644 --- a/license-eye/commands/header/fix.go +++ b/license-eye/commands/header/fix.go @@ -22,11 +22,12 @@ import ( "fmt" "strings" + "github.com/spf13/cobra" + "github.com/apache/skywalking-eyes/license-eye/internal/logger" "github.com/apache/skywalking-eyes/license-eye/pkg" "github.com/apache/skywalking-eyes/license-eye/pkg/config" "github.com/apache/skywalking-eyes/license-eye/pkg/header" - "github.com/spf13/cobra" ) var FixCommand = &cobra.Command{ diff --git a/license-eye/go.sum b/license-eye/go.sum index b1a492f..d9b8198 100644 --- a/license-eye/go.sum +++ b/license-eye/go.sum @@ -62,7 +62,6 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github/v33 v33.0.0 h1:qAf9yP0qc54ufQxzwv+u9H0tiVOnPJxo0lI/JXqw3ZM= github.com/google/go-github/v33 v33.0.0/go.mod h1:GMdDnVZY/2TsWgp/lkYnpSAh6TrzhANBBwm6k6TTEXg= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= diff --git a/license-eye/pkg/comments/config.go b/license-eye/pkg/comments/config.go index 28f4462..71586b3 100644 --- a/license-eye/pkg/comments/config.go +++ b/license-eye/pkg/comments/config.go @@ -21,8 +21,9 @@ import ( "fmt" "strings" - "github.com/apache/skywalking-eyes/license-eye/assets" "gopkg.in/yaml.v3" + + "github.com/apache/skywalking-eyes/license-eye/assets" ) type CommentStyle struct { diff --git a/license-eye/pkg/review/header.go b/license-eye/pkg/review/header.go index 4ad84e7..20e05d7 100644 --- a/license-eye/pkg/review/header.go +++ b/license-eye/pkg/review/header.go @@ -29,13 +29,14 @@ import ( "strconv" "strings" + "github.com/google/go-github/v33/github" + "golang.org/x/oauth2" + "github.com/apache/skywalking-eyes/license-eye/internal/logger" "github.com/apache/skywalking-eyes/license-eye/pkg" comments2 "github.com/apache/skywalking-eyes/license-eye/pkg/comments" config2 "github.com/apache/skywalking-eyes/license-eye/pkg/config" header2 "github.com/apache/skywalking-eyes/license-eye/pkg/header" - "github.com/google/go-github/v33/github" - "golang.org/x/oauth2" ) var ( diff --git a/quality-eye/LICENSE b/quality-eye/LICENSE new file mode 100644 index 0000000..67c185f --- /dev/null +++ b/quality-eye/LICENSE @@ -0,0 +1,210 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + + +======================================================================= +Apache SkyWalking Eyes Subcomponents: + +The Apache SkyWalking Eyes project contains subcomponents with separate copyright +notices and license terms. Your use of the source code for the these +subcomponents is subject to the terms and conditions of the following +licenses. diff --git a/quality-eye/Makefile b/quality-eye/Makefile new file mode 100644 index 0000000..9a2f41d --- /dev/null +++ b/quality-eye/Makefile @@ -0,0 +1,98 @@ +# 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. +# + +PROJECT = quality-eye +VERSION ?= latest +OUT_DIR = bin +ARCH := $(shell uname) +OSNAME := $(if $(findstring Darwin,$(ARCH)),darwin,linux) + +GO := GO111MODULE=on go +GO_PATH = $(shell $(GO) env GOPATH) +GO_BUILD = $(GO) build +GO_TEST = $(GO) test +GO_LINT = $(GO_PATH)/bin/golangci-lint +GO_BUILD_LDFLAGS = -X github.com/apache/skywalking-eyes/$(PROJECT)/commands.version=$(VERSION) + +PLATFORMS := windows linux darwin +os = $(word 1, $@) +ARCH = amd64 + +RELEASE_BIN = skywalking-$(PROJECT)-$(VERSION)-bin +RELEASE_SRC = skywalking-$(PROJECT)-$(VERSION)-src + +all: clean lint license test build + +.PHONY: lint +lint: + $(GO_LINT) version || curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin + $(GO_LINT) run -v ./... + +.PHONY: fix-lint +fix-lint: + $(GO_LINT) run -v --fix ./... + +#.PHONY: license +#license: clean +# $(GO) run ../license-eye/cmd/license-eye/main.go -c ../.licenserc.yaml header check + +.PHONY: test +test: clean + $(GO_TEST) ./... -coverprofile=coverage.txt -covermode=atomic + @>&2 echo "Great, all tests passed." + +.PHONY: $(PLATFORMS) +$(PLATFORMS): + mkdir -p $(OUT_DIR) + GOOS=$(os) GOARCH=$(ARCH) $(GO_BUILD) $(GO_BUILD_FLAGS) -ldflags "$(GO_BUILD_LDFLAGS)" -o $(OUT_DIR)/$(os)/$(PROJECT) cmd/$(PROJECT)/main.go + +.PHONY: build +build: windows linux darwin + +.PHONY: clean +clean: + -rm -rf bin + -rm -rf coverage.txt + -rm -rf "$(RELEASE_BIN)"* + -rm -rf "$(RELEASE_SRC)"* + +.PHONY: verify +verify: clean license lint test + +release-src: clean + -mkdir $(RELEASE_SRC) + -cp ../NOTICE $(RELEASE_SRC) + -rsync -av . $(RELEASE_SRC) --exclude $(RELEASE_SRC) --exclude .DS_Store + -tar -zcvf $(RELEASE_SRC).tgz $(RELEASE_SRC) + -rm -rf "$(RELEASE_SRC)" + +release-bin: build + -mkdir $(RELEASE_BIN) + -cp -R bin $(RELEASE_BIN) + -cp -R dist/* $(RELEASE_BIN) + -cp -R CHANGES.md $(RELEASE_BIN) + -cp -R README.adoc $(RELEASE_BIN) + -cp -R ../NOTICE $(RELEASE_BIN) + -tar -zcvf $(RELEASE_BIN).tgz $(RELEASE_BIN) + -rm -rf "$(RELEASE_BIN)" + +release: verify release-src release-bin + gpg --batch --yes --armor --detach-sig $(RELEASE_SRC).tgz + shasum -a 512 $(RELEASE_SRC).tgz > $(RELEASE_SRC).tgz.sha512 + gpg --batch --yes --armor --detach-sig $(RELEASE_BIN).tgz + shasum -a 512 $(RELEASE_BIN).tgz > $(RELEASE_BIN).tgz.sha512 diff --git a/quality-eye/cmd/quality-eye/main.go b/quality-eye/cmd/quality-eye/main.go new file mode 100644 index 0000000..e108487 --- /dev/null +++ b/quality-eye/cmd/quality-eye/main.go @@ -0,0 +1,32 @@ +// 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. +// +package main + +import ( + "os" + + "github.com/apache/skywalking-eyes/quality-eye/commands" + "github.com/apache/skywalking-eyes/quality-eye/internal/logger" +) + +func main() { + if err := commands.Execute(); err != nil { + logger.Log.Errorln(err) + os.Exit(1) + } +} diff --git a/quality-eye/commands/cleanup/cleanup.go b/quality-eye/commands/cleanup/cleanup.go new file mode 100644 index 0000000..67f48d3 --- /dev/null +++ b/quality-eye/commands/cleanup/cleanup.go @@ -0,0 +1,32 @@ +// +// 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. +package cleanup + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var Cleanup = &cobra.Command{ + Use: "cleanup", + Short: "", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Not implemented.") + }, +} diff --git a/quality-eye/commands/root.go b/quality-eye/commands/root.go new file mode 100644 index 0000000..714a5c6 --- /dev/null +++ b/quality-eye/commands/root.go @@ -0,0 +1,47 @@ +// 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. +// +package commands + +import ( + "github.com/spf13/cobra" + + "github.com/apache/skywalking-eyes/quality-eye/commands/cleanup" + "github.com/apache/skywalking-eyes/quality-eye/commands/run" + "github.com/apache/skywalking-eyes/quality-eye/commands/setup" + "github.com/apache/skywalking-eyes/quality-eye/commands/trigger" + "github.com/apache/skywalking-eyes/quality-eye/commands/verify" +) + +// Root represents the base command when called without any subcommands +var Root = &cobra.Command{ + Use: "quality-eye command [flags]", + Short: "The next generation End-to-End Testing framework", + Version: version, +} + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() error { + Root.AddCommand(run.Run) + Root.AddCommand(setup.Setup) + Root.AddCommand(trigger.Trigger) + Root.AddCommand(verify.Verify) + Root.AddCommand(cleanup.Cleanup) + + return Root.Execute() +} diff --git a/quality-eye/commands/run/run.go b/quality-eye/commands/run/run.go new file mode 100644 index 0000000..a1fa76a --- /dev/null +++ b/quality-eye/commands/run/run.go @@ -0,0 +1,32 @@ +// +// 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. +package run + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var Run = &cobra.Command{ + Use: "run", + Short: "", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Not implemented.") + }, +} diff --git a/quality-eye/commands/setup/setup.go b/quality-eye/commands/setup/setup.go new file mode 100644 index 0000000..4db194b --- /dev/null +++ b/quality-eye/commands/setup/setup.go @@ -0,0 +1,32 @@ +// +// 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. +package setup + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var Setup = &cobra.Command{ + Use: "setup", + Short: "", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Not implemented.") + }, +} diff --git a/quality-eye/commands/trigger/trigger.go b/quality-eye/commands/trigger/trigger.go new file mode 100644 index 0000000..faa5980 --- /dev/null +++ b/quality-eye/commands/trigger/trigger.go @@ -0,0 +1,32 @@ +// +// 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. +package trigger + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var Trigger = &cobra.Command{ + Use: "trigger", + Short: "", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Not implemented.") + }, +} diff --git a/quality-eye/commands/verify/verify.go b/quality-eye/commands/verify/verify.go new file mode 100644 index 0000000..082beff --- /dev/null +++ b/quality-eye/commands/verify/verify.go @@ -0,0 +1,32 @@ +// +// 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. +package verify + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var Verify = &cobra.Command{ + Use: "verify", + Short: "", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Not implemented.") + }, +} diff --git a/quality-eye/commands/version.go b/quality-eye/commands/version.go new file mode 100644 index 0000000..0b07316 --- /dev/null +++ b/quality-eye/commands/version.go @@ -0,0 +1,20 @@ +// 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. +// +package commands + +var version string diff --git a/quality-eye/go.mod b/quality-eye/go.mod new file mode 100644 index 0000000..3071105 --- /dev/null +++ b/quality-eye/go.mod @@ -0,0 +1,9 @@ +module github.com/apache/skywalking-eyes/quality-eye + +go 1.13 + +require ( + github.com/apache/skywalking-eyes/license-eye v0.0.0-20201226021955-d798d4f56aa5 // indirect + github.com/sirupsen/logrus v1.7.0 + github.com/spf13/cobra v1.1.1 +) diff --git a/license-eye/go.sum b/quality-eye/go.sum similarity index 97% copy from license-eye/go.sum copy to quality-eye/go.sum index b1a492f..9f3f798 100644 --- a/license-eye/go.sum +++ b/quality-eye/go.sum @@ -16,6 +16,9 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/apache/skywalking-eyes v0.0.0-20201226021955-d798d4f56aa5 h1:cMn7kz937Lz92NBpMXbawQlizM4qe3LYMil+DWQxznE= +github.com/apache/skywalking-eyes/license-eye v0.0.0-20201226021955-d798d4f56aa5 h1:t02DzatPmd8KY/RU7rK0U3hHIBuP19GEdVHtlN4AdT0= +github.com/apache/skywalking-eyes/license-eye v0.0.0-20201226021955-d798d4f56aa5/go.mod h1:bLODcmEKgxo/4NAtGC4gmPKojOASms555WUkGEc4g98= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= @@ -34,7 +37,6 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= @@ -56,13 +58,11 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= github.com/google/go-github/v33 v33.0.0 h1:qAf9yP0qc54ufQxzwv+u9H0tiVOnPJxo0lI/JXqw3ZM= github.com/google/go-github/v33 v33.0.0/go.mod h1:GMdDnVZY/2TsWgp/lkYnpSAh6TrzhANBBwm6k6TTEXg= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= @@ -110,10 +110,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -140,7 +138,6 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -158,6 +155,7 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -176,12 +174,12 @@ github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb6 github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -279,7 +277,6 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc h1:NCy3Ohtk6Iny5V/reW2Ktypo4zIpWBdRJ1uFMjBxdg8= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -290,7 +287,6 @@ google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsb google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -306,7 +302,6 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiq google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= diff --git a/quality-eye/internal/logger/log.go b/quality-eye/internal/logger/log.go new file mode 100644 index 0000000..7fc102e --- /dev/null +++ b/quality-eye/internal/logger/log.go @@ -0,0 +1,39 @@ +// 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. +// +package logger + +import ( + "os" + + "github.com/sirupsen/logrus" +) + +var Log *logrus.Logger + +func init() { + if Log == nil { + Log = logrus.New() + } + Log.Level = logrus.DebugLevel + Log.SetOutput(os.Stdout) + Log.SetFormatter(&logrus.TextFormatter{ + DisableTimestamp: true, + DisableLevelTruncation: true, + ForceColors: true, + }) +}
