项目作者: fabric8-analytics

项目描述 :
高级语言: Python
项目地址: git://github.com/fabric8-analytics/fabric8-gemini-server.git
创建时间: 2018-02-23T17:56:49Z
项目社区:https://github.com/fabric8-analytics/fabric8-gemini-server

开源协议:GNU General Public License v3.0

下载


fabric8-gemini-server

Build Status

Fabric8-server analytics powered services to initiate and report the readiness of
all registered services

ENDPOINTS

POST: /api/v1/register

  1. {
  2. "git_url" : <some_url>,
  3. "git_sha" : <some_sha>,
  4. "email_ids" : <some_email>
  5. }
Result :

Status: 200 OK

  1. {
  2. "data": {
  3. "email_ids": <some_email>,
  4. "git_sha": <some_sha>,
  5. "git_url": <some_url>,
  6. "last_scanned_at": "Mon, 05 Mar 2018 00:00:00 GMT"
  7. },
  8. "success": true,
  9. "summary": "<some_url> successfully registered"
  10. }

Footnotes

Check for all possible issues

The script named check-all.sh is to be used to check the sources for all detectable errors and issues. This script can be run w/o any arguments:

  1. ./check-all.sh

Expected script output:

  1. Running all tests and checkers
  2. Check all BASH scripts
  3. OK
  4. Check documentation strings in all Python source file
  5. OK
  6. Detect common errors in all Python source file
  7. OK
  8. Detect dead code in all Python source file
  9. OK
  10. Run Python linter for Python source file
  11. OK
  12. Unit tests for this project
  13. OK
  14. Done
  15. Overal result
  16. OK

An example of script output when one error is detected:

  1. Running all tests and checkers
  2. Check all BASH scripts
  3. Error: please look into files check-bashscripts.log and check-bashscripts.err for possible causes
  4. Check documentation strings in all Python source file
  5. OK
  6. Detect common errors in all Python source file
  7. OK
  8. Detect dead code in all Python source file
  9. OK
  10. Run Python linter for Python source file
  11. OK
  12. Unit tests for this project
  13. OK
  14. Done
  15. Overal result
  16. One error detected!

Please note that the script creates bunch of *.log and *.err files that are temporary and won’t be commited into the project repository.

Coding standards

  • You can use scripts run-linter.sh and check-docstyle.sh to check if the code follows PEP 8 and PEP 257 coding standards. These scripts can be run w/o any arguments:
  1. ./run-linter.sh
  2. ./check-docstyle.sh

The first script checks the indentation, line lengths, variable names, white space around operators etc. The second
script checks all documentation strings - its presence and format. Please fix any warnings and errors reported by these
scripts.

List of directories containing source code, that needs to be checked, are stored in a file directories.txt

Code complexity measurement

The scripts measure-cyclomatic-complexity.sh and measure-maintainability-index.sh are used to measure code complexity. These scripts can be run w/o any arguments:

  1. ./measure-cyclomatic-complexity.sh
  2. ./measure-maintainability-index.sh

The first script measures cyclomatic complexity of all Python sources found in the repository. Please see this table for further explanation how to comprehend the results.

The second script measures maintainability index of all Python sources found in the repository. Please see the following link with explanation of this measurement.

You can specify command line option --fail-on-error if you need to check and use the exit code in your workflow. In this case the script returns 0 when no failures has been found and non zero value instead.

Dead code detection

The script detect-dead-code.sh can be used to detect dead code in the repository. This script can be run w/o any arguments:

  1. ./detect-dead-code.sh

Please note that due to Python’s dynamic nature, static code analyzers are likely to miss some dead code. Also, code that is only called implicitly may be reported as unused.

Because of this potential problems, only code detected with more than 90% of confidence is reported.

List of directories containing source code, that needs to be checked, are stored in a file directories.txt

Common issues detection

The script detect-common-errors.sh can be used to detect common errors in the repository. This script can be run w/o any arguments:

  1. ./detect-common-errors.sh

Please note that only semantical problems are reported.

List of directories containing source code, that needs to be checked, are stored in a file directories.txt

Check for scripts written in BASH

The script named check-bashscripts.sh can be used to check all BASH scripts (in fact: all files with the .sh extension) for various possible issues, incompatibilities, and caveats. This script can be run w/o any arguments:

  1. ./check-bashscripts.sh

Please see the following link for further explanation, how the ShellCheck works and which issues can be detected.

Code coverage report

Code coverage is reported via the codecov.io. The results can be seen on the following address:

code coverage report