Skip to content

Commit 711d885

Browse files
committed
Initial commit.
0 parents  commit 711d885

File tree

450 files changed

+35681
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

450 files changed

+35681
-0
lines changed

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
*.sqlite
2+
*.pyc
3+
*~
4+
**sass-cache**
5+
celerybeat-schedule
6+
.merge_file*
7+
**/lastBuild/*
8+
*BASE*
9+
*ORIG*
10+
*BACKUP*
11+
*LOCAL*
12+
*REMOTE*
13+
*\#
14+
**/settings/common.yml
15+
**/venv*/
16+
.checkmate/*
17+
*.db
18+
*.orig
19+
**/.cache/*
20+
**/secrets.yml
21+
.DS_Store
22+
run.sh
23+
.idea
24+
**/settings.yml
25+

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Welcome to QuantifiedCode!
2+
3+
QuantifiedCode is a code analyis \& automation platform. It helps you to keep track of issues and
4+
metrics in your software projects, and can be easily extended to support new types of analyses.
5+
The application consists of several parts:
6+
7+
* A frontend, realized as a React.js app
8+
* A backend, realized as a Flask app, that exposes a REST API consumed by the frontend
9+
* A background worker, realized using Celery, that performs the code analysis
10+
11+
# Installation
12+
13+
We provide several options for installing QuantifiedCode. Which one is the right one for you
14+
depends on your use case.
15+
16+
* The **manual installation** is best if you want to modify or change QuantifiedCode
17+
* The **Docker-based installation** is probably the easiest way to try QuantifiedCode without much work
18+
* The **Ansible-based installation** is the most suitable way if you want to run QuantifiedCode in
19+
a professional infrastructure (possibly with multiple servers)
20+
21+
The following section will only discuss the manual installation process, for the other options please
22+
check their corresponding repositories.
23+
24+
## Manual Installation
25+
26+
The installation consists of three parts:
27+
28+
* Install the dependencies required to run QuantifiedCode
29+
* Download the required source code
30+
* Set up the configuration
31+
32+
### Installing Dependencies
33+
34+
QuantifiedCode requires the following external dependencies:
35+
36+
* A message broker (required for the background tasks message queue). We recommend either RabbitMQ or Redis.
37+
* A database (required for the core application). We recommend PostgreSQL, but SQLite is supported as well. Other database systems might work too (e.g. MySQL), but are currently not officially supported. If you need to run QuantifiedCode on a non-supported database, please get in touch with us and we'll be happy to provide you some guidance.
38+
39+
### Download the QuantifiedCode source code
40+
41+
Now with the dependencies installed, we can go ahead and download QuantifiedCode:
42+
43+
git clone git@github.com:quantifiedcode/quantifiedcode.git
44+
45+
### Set up a virtual environment (optional)
46+
47+
In addition, it is advised to create a (Python 2.7) virtual environment to run QuantifiedCode in:
48+
49+
virtualenv venv
50+
51+
#activate the virtual environment
52+
source venv/bin/activate
53+
54+
### Install the required Python packages
55+
56+
QuantifiedCode manages dependencies via the Python package manager, pip. To install them, simply run
57+
58+
pip install -r requirements.txt
59+
60+
### Edit Settings
61+
62+
QuantifiedCode gets configured via YAML settings files. When starting up the application, it incrementally loads settings from several files, recursively updating the settings object. First, it will load default settings from `quantifiedcode/settings/default.yml`. Then, it will check if a `QC_SETTINGS` environment variable is defined and points to a valid file, and if so it will load settings from it (possibly overwriting default settings). If not, it will look for a `settings.yml` file in the current working
63+
directory and load settings from there. Additionally, it will check if a `QC_SECRETS` environment variable is defined and points to a valid file, and also load settings from there (this is useful for sensitive settings that should be kept seperate from the rest [e.g. to not check them into version control]).
64+
65+
There is a sample `settings.yml` file in the root of the repository that you can start from.
66+
67+
### Running the Setup
68+
69+
After editing your settings, run the setup command via
70+
71+
#run from the root directory of the repository
72+
python manage.py setup
73+
74+
The setup assistant will iteratively walk you through the setup, and when finished you should have a
75+
working instance of QuantifiedCode!
76+
77+
### Running the web application
78+
79+
To run the web application, simply run
80+
81+
python manage.py runserver
82+
83+
### Running the background worker
84+
85+
To run the background worker, simply run
86+
87+
python manage.py runworker
88+
89+
## Docker-Based Installation
90+
91+
Coming Soon!
92+
93+
## Ansible-Based Installation
94+
95+
Coming Soon!

TODO.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Final ToDo's for the Open-Source Edition
2+
3+
* Add bulk operations to issue list (remove all / add all)
4+
* Add better tags for issue classes that should not get enabled by default (i.e. only add generic tag to issue classes that are not too noisy)
5+
* Add link to diff in git snapshot list

data/.empty

Whitespace-only changes.

manage.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from quantifiedcode.settings import settings
2+
from quantifiedcode.backend.commands import commands
3+
4+
import click
5+
import os
6+
import logging
7+
8+
@click.group()
9+
def qc():
10+
pass
11+
12+
for command in commands:
13+
qc.add_command(command)
14+
15+
if __name__ == '__main__':
16+
settings.initialize(initialize_logging=True)
17+
for plugin in settings.get('plugins',[]):
18+
config = settings.load_plugin_config(plugin)
19+
if 'commands' in config:
20+
for command in config['commands']:
21+
qc.add_command(command)
22+
qc()

quantifiedcode/__init__.py

Whitespace-only changes.

quantifiedcode/alembic.ini

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[alembic]
2+
script_location = quantifiedcode/migrations
3+
4+
[loggers]
5+
keys = root,sqlalchemy,alembic
6+
7+
[handlers]
8+
keys = console
9+
10+
[formatters]
11+
keys = generic
12+
13+
[logger_root]
14+
level = WARN
15+
handlers =
16+
qualname =
17+
18+
[logger_sqlalchemy]
19+
level = WARN
20+
handlers =
21+
qualname = sqlalchemy.engine
22+
23+
[logger_alembic]
24+
level = WARN
25+
handlers =
26+
qualname = alembic
27+
28+
[handler_console]
29+
class = StreamHandler
30+
args = (sys.stderr,)
31+
level = NOTSET
32+
formatter = generic
33+
34+
[formatter_generic]
35+
format = %(levelname)-5.5s [%(name)s] %(message)s
36+
datefmt = %H:%M:%S

quantifiedcode/app.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
5+
Main QuantifiedCode app.
6+
7+
"""
8+
9+
from __future__ import unicode_literals
10+
from __future__ import absolute_import
11+
12+
import sys
13+
import re
14+
import argparse
15+
import urlparse
16+
17+
from flask import Flask,request
18+
from werkzeug.wsgi import DispatcherMiddleware
19+
20+
from quantifiedcode.settings import settings, backend
21+
from quantifiedcode.backend.app import get_app as get_backend_app
22+
from quantifiedcode.frontend.app import get_app as get_frontend_app
23+
24+
"""
25+
Run the backend and the frontend as a single Flask application.
26+
27+
You might need to change 'settings.js' in the frontend to accommodate for the
28+
changed API URL.
29+
"""
30+
31+
def get_app(settings):
32+
33+
app = Flask(__name__)
34+
empty_app = Flask(__name__)
35+
app.wsgi_app = DispatcherMiddleware(empty_app, {
36+
'/api': get_backend_app(settings),
37+
settings.get('frontend.url') : get_frontend_app(settings),
38+
})
39+
40+
return app
41+
42+
if __name__ == '__main__':
43+
44+
parser = argparse.ArgumentParser()
45+
parser.add_argument(
46+
dest=u'host',
47+
nargs=u'?',
48+
default=u'0.0.0.0:5000',
49+
)
50+
51+
args = parser.parse_args(sys.argv[1:])
52+
53+
if u':' in args.host:
54+
host, port = args.host.split(':', 1)
55+
port = int(port)
56+
else:
57+
url = urlparse.urlparse(settings.get('url'))
58+
if url.port:
59+
port = url.port
60+
else:
61+
port = 5000
62+
if url.hostname:
63+
host = url.hostname
64+
else:
65+
host = '0.0.0.0'
66+
67+
settings.initialize(backend)
68+
app = get_app(settings)
69+
70+
app.run(
71+
debug=settings.get('debug', False),
72+
host=host,
73+
port=port,
74+
processes=1,
75+
threaded = False,
76+
use_reloader=True
77+
)

quantifiedcode/backend/.gitignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
*.py[cod]
2+
hipchatlog.txt
3+
*.log
4+
*.pid
5+
data/*
6+
venv/*
7+
*/data/logs/*
8+
# C extensions
9+
*.so
10+
wsgi.py
11+
node_modules/
12+
*~
13+
# Packages
14+
*.egg
15+
celerybeat-schedule
16+
*.egg-info
17+
dist
18+
**/data/repositories/*
19+
build
20+
.checkmate
21+
eggs
22+
parts
23+
bin
24+
qc/frontend
25+
var
26+
sdist
27+
develop-eggs
28+
.installed.cfg
29+
lib
30+
lib64
31+
__pycache__
32+
**/settings/common.py
33+
**/settings/development.py
34+
**/settings/production.py
35+
**/settings/stage.py
36+
37+
# Installer logs
38+
pip-log.txt
39+
40+
# Unit test / coverage reports
41+
.coverage
42+
.tox
43+
nosetests.xml
44+
45+
# Translations
46+
*.mo
47+
secrets*.py
48+
!secrets_template.py
49+
*/settings/common.py
50+
# Mr Developer
51+
.mr.developer.cfg
52+
.project
53+
.pydevproject

quantifiedcode/backend/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)