diff --git a/.asf.yaml b/.asf.yaml index 98f624ad..0e43aed5 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -# https://cwiki.apache.org/confluence/display/INFRA/.asf.yaml+features+for+git+repositories +# https://cwiki.apache.org/confluence/display/INFRA/git+-+.asf.yaml+features --- github: description: "Apache Kibble - a tool to collect, aggregate and visualize data about any software project" diff --git a/.github/ISSUE_TEMPLATE/config.ymal b/.github/ISSUE_TEMPLATE/config.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/config.ymal rename to .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 753f97da..bf1a4b79 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,6 +1,6 @@ --- name: Feature request -about: Idea or feature request +about: Idea or feature request title: '' labels: 'kind:feature' assignees: '' diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..299dda74 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,23 @@ +area:api: + - 'kibble/api/*' + +area:cli: + - 'kibble/cli/*' + +area:scanners: + - 'kibble/scanners/*' + +area:ui: + - 'ui/*' + +area:docs: + - 'docs/*' + - '*.md' + +area:dev: + - '.github/*' + - '.pre-commit.config.yaml' + - 'asf.yaml' + - 'Dockerfile*' + - 'docker*' + - 'setup.*' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..7880c5e8 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,56 @@ +# Licensed to the 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. The 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. +--- +name: CI +on: + - push + - pull_request + +jobs: + statics: + name: Static checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.8' + - run: pip install '.[devel]' + - uses: pre-commit/action@v1.0.1 + with: + extra_args: --show-diff-on-failure + build-docker: + name: Build kibble dev image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build docker image + run: docker-compose -f docker-compose-dev.yaml build setup + - name: Run kibble command + run: docker run apache/kibble kibble --help + - name: Check dependencies + run: docker run apache/kibble pip check + run-tests: + name: Run Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.8' + - run: pip install '.[devel]' + - run: pytest tests --color=yes diff --git a/.github/workflows/labeler.yaml b/.github/workflows/labeler.yaml new file mode 100644 index 00000000..103e3e44 --- /dev/null +++ b/.github/workflows/labeler.yaml @@ -0,0 +1,12 @@ +name: "PR labeler" +on: + - pull_request_target + +jobs: + triage: + name: Label + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@main + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.gitignore b/.gitignore index d562a27b..b12fa18f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Apache Kibble files -api/yaml/kibble.yaml +api/yaml/kibble.yaml* +kibble/api/yaml/kibble.yaml* # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07fae567..30f7f15a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,8 +24,67 @@ minimum_pre_commit_version: "1.20.0" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v3.3.0 hooks: - id: check-yaml - id: end-of-file-fixer + exclude: ^ui/vendors/.*$ - id: trailing-whitespace + exclude: ^ui/vendors/.*$ + - id: fix-encoding-pragma + args: + - --remove + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.1.9 + hooks: + - id: insert-license + name: Add license for all other files + exclude: ^\.github/.*$ + args: + - --comment-style + - "|#|" + - --license-filepath + - license-templates/LICENSE.txt + - --fuzzy-match-generates-todo + files: > + \.cfg$|^Dockerfile.*$|\.sh$|\.bash$|\.py$|\.yml$|\.yaml$ + - id: insert-license + name: Add license for all rst files + exclude: ^\.github/.*$ + args: + - --comment-style + - "||" + - --license-filepath + - license-templates/LICENSE.rst + - --fuzzy-match-generates-todo + files: \.rst$ + - id: insert-license + name: Add license for all md and html files + files: \.md$|\.html$ + exclude: ^\.github/.*$| + args: + - --comment-style + - "" + - --license-filepath + - license-templates/LICENSE.txt + - --fuzzy-match-generates-todo + - repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + name: Black + types: [python] + - repo: https://github.com/timothycrosley/isort + rev: 5.6.4 + hooks: + - id: isort + name: Run isort to sort imports + args: ['--multi-line', '3', '--trailing-comma'] + files: \.py$ + - repo: local + hooks: + - id: pylint + name: Pylint on all sources + entry: pylint + language: system + types: [ python ] diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 5fd7277c..d5c66bb2 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,7 +1,7 @@ # Code of Conduct -The Apache Kibble project follows the +The Apache Kibble project follows the [Apache Software Foundation code of conduct](https://www.apache.org/foundation/policies/conduct.html). -If you observe behavior that violates those rules please follow the +If you observe behavior that violates those rules please follow the [ASF reporting guidelines](https://www.apache.org/foundation/policies/conduct#reporting-guidelines). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 86ec40be..d420751e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing to Kibble # -## Community +## Community The main development and design discussion happens on our mailing lists. We have a list specifically for development, and one for future user questions and feedback. @@ -15,5 +15,57 @@ We also have: ## Development installation -This project requires Python in higher version than 3.3. -More information will come soon! +You should be able to install Apache Kibble by simply doing: +``` +pip install -e ."[devel]" +``` + +The easiest option to spin up a development environment is to use our development docker-compose. +The development image has mounted all Kibble sources so all your local code changes will be automatically +reflected in the running app. + +First you need to configure the Elasticsearch node: +``` +docker-compose -f docker-compose-dev.yaml up setup +``` +Once you see the +``` +setup_1 | All done, Kibble should...work now :) +``` +Now you can can launch Apache Kibble ui: +``` +docker-compose -f docker-compose-dev.yaml up ui +``` +The ui should be available under `http://0.0.0.0:8000` or `http://localhost:8000`. To log in you can use +the dummy admin account `admin@kibble` and password `kibbleAdmin`. + +You can also start only the API server: +``` +docker-compose -f docker-compose-dev.yaml up kibble +``` + +## Code Quality + +Apache Kibble project is using [pre-commits](https://pre-commit.com) to ensure the quality of the code. +We encourage you to use pre-commits, but it's not required in order to contribute. Every change is checked +on CI and if it does not pass the tests it cannot be accepted. If you want to check locally then +you should install Python3.6 or newer together and run: +```bash +pip install pre-commit +# or +brew install pre-commit +``` +For more installation options visit the [pre-commits](https://pre-commit.com). + +To turn on pre-commit checks for commit operations in git, run: +```bash +pre-commit install +``` +To run all checks on your staged files, run: +```bash +pre-commit run +``` +To run all checks on all files, run: +```bash +pre-commit run --all-files +``` diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 00000000..78500b60 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,29 @@ +# Licensed to the 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. The 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. + +FROM python:3.8-slim + +USER root +RUN apt-get update +RUN apt-get install -y gcc git unzip cloc + +COPY . /kibble/ + +WORKDIR /kibble + +RUN pip install --upgrade pip +RUN pip install -e . diff --git a/NOTICE b/NOTICE index 790683a8..66e7dc12 100644 --- a/NOTICE +++ b/NOTICE @@ -119,7 +119,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Metis Dashboard (MIT License) ------------------------------------------------------------------------ -Copyright (c) 2015 onokumus +Copyright (c) 2015 onokumus Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to @@ -186,4 +186,3 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/README.md b/README.md index 7efe0455..3d9f3728 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@
%s:\n%s\n
\n%s:\n%s
%s\n
%s-
%s:\n%s\n
\n%s:\n%s
%s\n
%s+
application/json: { @@ -141,14 +141,14 @@Response examples:
- +- +- +PATCH- + /api/account@@ -190,14 +190,14 @@Response examples:
- +- +PUT- + /api/account@@ -235,23 +235,23 @@Response examples:
- +- +GET- + /api/bio/bioShows some facts about a contributorResponse examples:
@@ -268,14 +268,14 @@Response examples:
- +- +POST- + /api/bio/bio@@ -334,23 +334,23 @@Response examples:
- +- +GET- + /api/bio/trendsShows a quick trend summary of the past 6 months for a contributorResponse examples:
@@ -367,14 +367,14 @@Response examples:
- +- +POST- + /api/bio/trends@@ -433,23 +433,23 @@Response examples:
- +- +GET- + /api/code/changesShow insertions/deletions as a timeseriesResponse examples:
@@ -474,14 +474,14 @@Response examples:
- +- +POST- + /api/code/changes@@ -548,23 +548,23 @@Response examples:
- +- +GET- + /api/code/commitsShow commits as a timeseriesResponse examples:
@@ -589,14 +589,14 @@Response examples:
- +- +POST- + /api/code/commits@@ -663,23 +663,23 @@Response examples:
- +- +GET- + /api/code/committersShows the top N of committersResponse examples:
@@ -696,14 +696,14 @@Response examples:
- +- +POST- + /api/code/committers@@ -762,23 +762,23 @@Response examples:
- +- +GET- + /api/code/evolutionShow code evolution as a timeseriesResponse examples:
@@ -803,14 +803,14 @@Response examples:
- +- +POST- + /api/code/evolution@@ -877,23 +877,23 @@Response examples:
- +- +GET- + /api/code/ponyShows pony factor data for a set of repos over a given period of timeResponse examples:
@@ -914,14 +914,14 @@Response examples:
- +- +POST- + /api/code/pony@@ -984,23 +984,23 @@Response examples:
- +- +GET- + /api/code/pony-timeseriesShows timeseries of Pony Factor over timeResponse examples:
@@ -1025,14 +1025,14 @@Response examples:
- +- +POST- + /api/code/pony-timeseries@@ -1099,23 +1099,23 @@Response examples:
- +- +GET- + /api/code/relationshipsShows a breakdown of contributor relationships between repositoriesResponse examples:
@@ -1132,14 +1132,14 @@Response examples:
- +- +POST- + /api/code/relationships@@ -1198,23 +1198,23 @@Response examples:
- +- +GET- + /api/code/retentionShows retention metrics for a set of repos over a given period of timeResponse examples:
@@ -1235,14 +1235,14 @@Response examples:
- +- +POST- + /api/code/retention@@ -1305,23 +1305,23 @@Response examples:
- +- +GET- + /api/code/slocShows a breakdown of lines of code for one or more sourcesResponse examples:
@@ -1338,14 +1338,14 @@Response examples:
- +- +POST- + /api/code/sloc@@ -1404,23 +1404,23 @@Response examples:
- +- +GET- + /api/code/top-commitsShows top 25 repos by commit volumeResponse examples:
@@ -1445,14 +1445,14 @@Response examples:
- +- +POST- + /api/code/top-commits@@ -1519,23 +1519,23 @@Response examples:
- +- +GET- + /api/code/top-slocShows top 25 repos by lines of codeResponse examples:
@@ -1560,14 +1560,14 @@Response examples:
- +- +POST- + /api/code/top-sloc@@ -1634,23 +1634,23 @@Response examples:
- +- +GET- + /api/code/trendsShows trend data for a set of repos over a given period of timeResponse examples:
@@ -1667,14 +1667,14 @@Response examples:
- +- +POST- + /api/code/trends@@ -1733,23 +1733,23 @@Response examples:
- +- +GET- + /api/issue/actorsShows timeseries of no. of people opening/closing issues over timeResponse examples:
@@ -1774,14 +1774,14 @@Response examples:
- +- +POST- + /api/issue/actors@@ -1848,23 +1848,23 @@Response examples:
- +- +GET- + /api/issue/ageShows timeseries of no. of open tickets by ageResponse examples:
@@ -1889,14 +1889,14 @@Response examples:
- +- +POST- + /api/issue/age@@ -1963,23 +1963,23 @@Response examples:
- +- +GET- + /api/issue/closersShows the top N of issue closersResponse examples:
@@ -1996,14 +1996,14 @@Response examples:
- +- +POST- + /api/issue/closers@@ -2062,23 +2062,23 @@Response examples:
- +- +GET- + /api/issue/issuesShows timeseries of issues opened/closed over timeResponse examples:
@@ -2103,14 +2103,14 @@Response examples:
- +- +POST- + /api/issue/issues@@ -2177,23 +2177,23 @@Response examples:
- +- +GET- + /api/issue/openersShows the top N of issue openersResponse examples:
@@ -2210,14 +2210,14 @@Response examples:
- +- +POST- + /api/issue/openers@@ -2276,23 +2276,23 @@Response examples:
- +- +GET- + /api/issue/pony-timeseriesShows timeseries of Pony Factor over timeResponse examples:
@@ -2317,14 +2317,14 @@Response examples:
- +- +POST- + /api/issue/pony-timeseries@@ -2391,23 +2391,23 @@Response examples:
- +- +GET- + /api/issue/relationshipsShows a breakdown of contributor relationships between issue trackersResponse examples:
@@ -2424,14 +2424,14 @@Response examples:
- +- +POST- + /api/issue/relationships@@ -2490,23 +2490,23 @@Response examples:
- +- +GET- + /api/issue/retentionShows retention metrics for a set of issue trackers over a given period of timeResponse examples:
@@ -2527,14 +2527,14 @@Response examples:
- +- +POST- + /api/issue/retention@@ -2597,23 +2597,23 @@Response examples:
- +- +GET- + /api/issue/topShows the top N issues by interactionsResponse examples:
@@ -2634,14 +2634,14 @@Response examples:
- +- +POST- + /api/issue/top@@ -2704,23 +2704,23 @@Response examples:
- +- +GET- + /api/issue/top-countShows top 25 issue trackers by issuesResponse examples:
@@ -2745,14 +2745,14 @@Response examples:
- +- +POST- + /api/issue/top-count@@ -2819,23 +2819,23 @@Response examples:
- +- +GET- + /api/issue/trendsShows trend data for a set of issue trackers over a given period of timeResponse examples:
@@ -2852,14 +2852,14 @@Response examples:
- +- +POST- + /api/issue/trends@@ -2918,23 +2918,23 @@Response examples:
- +- +GET- + /api/mail/mapShows a breakdown of email author reply mappingsResponse examples:
@@ -2951,14 +2951,14 @@Response examples:
- +- +POST- + /api/mail/map@@ -3017,23 +3017,23 @@Response examples:
- +- +GET- + /api/mail/pony-timeseriesShows timeseries of Pony Factor over timeResponse examples:
@@ -3058,14 +3058,14 @@Response examples:
- +- +POST- + /api/mail/pony-timeseries@@ -3132,23 +3132,23 @@Response examples:
- +- +GET- + /api/mail/relationshipsShows a breakdown of contributor relationships between mailing listsResponse examples:
@@ -3165,14 +3165,14 @@Response examples:
- +- +POST- + /api/mail/relationships@@ -3231,23 +3231,23 @@Response examples:
- +- +GET- + /api/mail/retentionShows retention metrics for a set of mailing lists over a given period of timeResponse examples:
@@ -3268,14 +3268,14 @@Response examples:
- +- +POST- + /api/mail/retention@@ -3338,23 +3338,23 @@Response examples:
- +- +GET- + /api/mail/timeseriesShows email sent over timeResponse examples:
@@ -3379,14 +3379,14 @@Response examples:
- +- +POST- + /api/mail/timeseries@@ -3453,23 +3453,23 @@Response examples:
- +- +GET- + /api/mail/timeseries-singleShows email sent over timeResponse examples:
@@ -3494,14 +3494,14 @@Response examples:
- + - + - +- +POST- + /api/mail/timeseries-single@@ -3568,23 +3568,23 @@Response examples:
- +- +GET- + /api/mail/top-topicsShows the top N of email authorsResponse examples:
@@ -3700,14 +3700,14 @@Response examples:
- +- +POST- + /api/mail/top-topics@@ -3766,23 +3766,23 @@Response examples:
- +- +GET- + /api/mail/trendsShows a quick email trend summary of the past 6 months for your orgResponse examples:
@@ -3799,14 +3799,14 @@Response examples:
- +- +POST- + /api/mail/trends@@ -3865,23 +3865,23 @@Response examples:
- +- +GET- + /api/org/listLists the organisations you belong to (or all, if admin)Response examples:
@@ -3898,14 +3898,14 @@Response examples:
- +- +POST- + /api/org/list@@ -3972,14 +3972,14 @@Response examples:
- +- +PUT- + /api/org/list@@ -4017,14 +4017,14 @@Response examples:
- +- +DELETE- + /api/org/members@@ -4066,23 +4066,23 @@Response examples:
- +- +GET- + /api/org/membersLists the members of an organisationResponse examples:
@@ -4099,14 +4099,14 @@Response examples:
- +- +POST- + /api/org/members@@ -4167,14 +4167,14 @@Response examples:
- +- +PUT- + /api/org/members@@ -4216,23 +4216,23 @@Response examples:
- +- +GET- + /api/org/sourcetypesLists the available source types supported by KibbleResponse examples:
@@ -4249,14 +4249,14 @@Response examples:
- +- +POST- + /api/org/sourcetypes@@ -4315,23 +4315,23 @@Response examples:
- +- +GET- + /api/org/trendsShows a quick trend summary of the past 6 months for your orgResponse examples:
@@ -4348,14 +4348,14 @@Response examples:
- +- +POST- + /api/org/trends@@ -4414,14 +4414,14 @@Response examples:
- +- +DELETE- + /api/session@@ -4454,23 +4454,23 @@Response examples:
- +- +GET- + /api/sessionDisplay your login detailsResponse examples:
@@ -4496,14 +4496,14 @@Response examples:
- +- +PUT- + /api/session@@ -4539,14 +4539,14 @@Response examples:
- +- +DELETE- + /api/sources@@ -4567,23 +4567,23 @@Response examples:
- +- +GET- + /api/sourcesFetches a list of all sources for this organisationResponse examples:
@@ -4604,14 +4604,14 @@Response examples:
- +- +PATCH- + /api/sources@@ -4649,14 +4649,14 @@Response examples:
- +- +POST- + /api/sources@@ -4719,14 +4719,14 @@Response examples:
- +- +PUT- + /api/sources@@ -4763,23 +4763,23 @@Response examples:
- +- +GET- + /api/verify/{email}/{vcode}Verify an accountResponse examples:
@@ -4798,21 +4798,21 @@Response examples:
- +- +DELETE- + /api/viewsDelete a new viewJSON parameters:
- +
Input examples:
@@ -4835,23 +4835,23 @@application/json: {}Response examples:
- +- +GET- + /api/viewsFetches a list of all views (filters) for this userResponse examples:
@@ -4883,21 +4883,21 @@Response examples:
- +- +PATCH- + /api/viewsEdit an existing sourceJSON parameters:
- +
Input examples:
@@ -4920,14 +4920,14 @@application/json: {}Response examples:
- +- +POST- + /api/views@@ -5001,21 +5001,21 @@Response examples:
- +- +PUT- + /api/viewsAdd a new viewJSON parameters:
- +
Input examples:
@@ -5038,23 +5038,23 @@application/json: {}Response examples:
- +- +GET- + /api/widgets/{pageid}Shows the widget layout for a specific pageResponse examples:
@@ -5086,5 +5086,5 @@Response examples: