Skip to content

Commit

Permalink
Merge pull request #128 from bcgov/development
Browse files Browse the repository at this point in the history
Merge development to master
  • Loading branch information
sumesh-aot authored Nov 12, 2019
2 parents 951f63c + dc4536c commit 06032d0
Show file tree
Hide file tree
Showing 84 changed files with 4,201 additions and 16 deletions.
1 change: 1 addition & 0 deletions bcol-api/.s2i/environment
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_CONFIG=gunicorn_config.py
13 changes: 13 additions & 0 deletions bcol-api/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright © 2018 Province of British Columbia

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.
6 changes: 6 additions & 0 deletions bcol-api/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include requirements/prod.txt
include config.py
include logging.conf
include LICENSE
include README.md
include src/bcol_api/schemas/schemas/*.json
155 changes: 155 additions & 0 deletions bcol-api/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
.PHONY: license
.PHONY: setup clean clean-build clean-pyc clean-test

.PHONY: docker-setup network build start qa style safety test test-travis flake8 \
isort isort-save stop docker-clean logs
.PHONY: mac-cov pylint flake8

SHELL:=/bin/bash
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
current_abs_dir := $(patsubst %/,%,$(dir $(mkfile_path)))

#################################################################################
# COMMANDS #
#################################################################################
clean: clean-build clean-pyc clean-test
rm -rf venv/

clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test:
find . -name '.pytest_cache' -exec rm -fr {} +
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/

setup: clean venv/bin/activate install-dev

venv/bin/activate: requirements/prod.txt requirements/dev.txt
rm -rf venv/
test -f venv/bin/activate || python3 -m venv $(current_abs_dir)/venv
. venv/bin/activate ;\
pip install --upgrade pip ;\
pip install -Ur requirements/prod.txt ;\
pip freeze | sort > requirements.txt ;\
cat requirements/repo-libraries.txt >> requirements.txt ;\
pip install -Ur requirements/repo-libraries.txt ;\
pip install -Ur requirements/dev.txt
touch venv/bin/activate # update so it's as new as requirements/prod.txt

.PHONY: install-dev
install-dev: venv/bin/activate
. venv/bin/activate ; \
pip install -e .

.PHONY: activate
activate: venv/bin/activate
. venv/bin/activate

.PHONY: local-test
local-test: venv/bin/activate
. venv/bin/activate ; \
pytest

.PHONY: local-coverage
local-coverage: venv/bin/activate
. venv/bin/activate ; \
coverage run -m pytest

.PHONY: coverage-report
coverage-report: local-coverage
. venv/bin/activate ; \
coverage report ; \
coverage html

## Run the coverage report and display in a browser window
mac-cov: install-dev coverage-report
open -a "Google Chrome" htmlcov/index.html

## run pylint on the package and tests
pylint:
pylint --rcfile=setup.cfg \
--load-plugins=pylint_flask \
--disable=C0301,W0511 \
src/bcol_api

## run flake8 on the package and tests
flake8:
flake8 src/bcol_api tests

## Verify source code license headers.
license:
./scripts/verify_license_headers.sh src/bcol_api tests

#################################################################################
# Self Documenting Commands #
#################################################################################

.DEFAULT_GOAL := show-help

# Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
# sed script explained:
# /^##/:
# * save line in hold space
# * purge line
# * Loop:
# * append newline + line to hold space
# * go to next line
# * if line starts with doc comment, strip comment character off and loop
# * remove target prerequisites
# * append hold space (+ newline) to line
# * replace newline plus comments by `---`
# * print line
# Separate expressions are necessary because labels cannot be delimited by
# semicolon; see <http://stackoverflow.com/a/11799865/1968>
.PHONY: show-help
show-help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)"
@echo
@sed -n -e "/^## / { \
h; \
s/.*//; \
:doc" \
-e "H; \
n; \
s/^## //; \
t doc" \
-e "s/:.*//; \
G; \
s/\\n## /---/; \
s/\\n/ /g; \
p; \
}" ${MAKEFILE_LIST} \
| LC_ALL='C' sort --ignore-case \
| awk -F '---' \
-v ncol=$$(tput cols) \
-v indent=19 \
-v col_on="$$(tput setaf 6)" \
-v col_off="$$(tput sgr0)" \
'{ \
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
n = split($$2, words, " "); \
line_length = ncol - indent; \
for (i = 1; i <= n; i++) { \
line_length -= length(words[i]) + 1; \
if (line_length <= 0) { \
line_length = ncol - indent - length(words[i]) - 1; \
printf "\n%*s ", -indent, " "; \
} \
printf "%s ", words[i]; \
} \
printf "\n"; \
}' \
| more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')
77 changes: 77 additions & 0 deletions bcol-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)

[![Bugs](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/api/badges/measure?key=BCRegistriesPayment&metric=bugs&template=FLAT)](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/dashboard?id=BCRegistriesPayment) [![Vulnerabilities](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/api/badges/measure?key=BCRegistriesPayment&metric=vulnerabilities&template=FLAT)](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/dashboard?id=BCRegistriesPayment) [![Code smells](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/api/badges/measure?key=BCRegistriesPayment&metric=code_smells&template=FLAT)](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/dashboard?id=BCRegistriesPayment) [![Coverage](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/api/badges/measure?key=BCRegistriesPayment&metric=coverage&template=FLAT)](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/dashboard?id=BCRegistriesPayment) [![Duplication](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/api/badges/measure?key=BCRegistriesPayment&metric=duplicated_lines_density&template=FLAT)](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/dashboard?id=BCRegistriesPayment) [![Lines of code](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/api/badges/measure?key=BCRegistriesPayment&metric=lines&template=FLAT)](https://sonarqube-l4ygcl-tools.pathfinder.gov.bc.ca/dashboard?id=BCRegistriesPayment)

# BC Registries Payment System

## Technology Stack Used
* Python, Flask
* Postgres - SQLAlchemy, psycopg2-binary & alembic

## Third-Party Products/Libraries used and the the License they are covert by

## Project Status

## Documentation

GitHub Pages (https://guides.github.com/features/pages/) are a neat way to document you application/project.

## Security

Future - BCGov Keycloak

Current - JWT hack

## Files in this repository

```
docs/ - Project Documentation
└── images
└── icons
openshift/ - OpenShift-specific files
├── scripts - helper scripts
└── templates - application templates
```

## Deployment (Local Development)

* Developer Workstation Requirements/Setup
* Application Specific Setup

## Deployment (OpenShift)

See (openshift/Readme.md)

## Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an [issue](../../issues).


## Code standards

Refer [checklist](https://github.com/bcgov/sbc-auth/wiki/API-code-review-checklist)

## How to Contribute

If you would like to contribute, please see our [CONTRIBUTING](./CONTRIBUTING.md) guidelines.

Please note that this project is released with a [Contributor Code of Conduct](./CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.

## License

Copyright 2018 Province of British Columbia

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.
Loading

0 comments on commit 06032d0

Please sign in to comment.