Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #55 from cmc333333/static-analysis
Browse files Browse the repository at this point in the history
Updates for static analysis
  • Loading branch information
tadhg-ohiggins committed Jun 7, 2016
2 parents 104f1de + 5f67008 commit 65a58d0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
20 changes: 18 additions & 2 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
exclude_paths:
- docs/*
engines:
duplication:
enabled: true
config:
languages:
- python
markdownlint:
enabled: true
pep8:
enabled: true
radon:
enabled: true
shellcheck:
enabled: true
ratings:
paths:
- "**.py"
exclude_paths: []
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ install:
script:
- python manage.py test
- flake8 .
- bandit -r .
after_success:
coveralls
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
regulations-core
================

[![Build Status](https://travis-ci.org/eregs/regulations-core.png)](https://travis-ci.org/eregs/regulations-core)
[![Coverage Status](https://coveralls.io/repos/18F/regulations-core/badge.svg?branch=master&service=github)](https://coveralls.io/github/18F/regulations-core?branch=master)
[![Build Status](https://travis-ci.org/eregs/regulations-core.svg?branch=master)](https://travis-ci.org/eregs/regulations-core)
[![Dependency Status](https://gemnasium.com/badges/github.com/eregs/regulations-core.svg)](https://gemnasium.com/github.com/eregs/regulations-core)
[![Coverage Status](https://coveralls.io/repos/github/eregs/regulations-core/badge.svg?branch=master)](https://coveralls.io/github/eregs/regulations-core?branch=master)
[![Code Climate](https://codeclimate.com/github/eregs/regulations-core/badges/gpa.svg)](https://codeclimate.com/github/eregs/regulations-core)
[![Code Issues](https://www.quantifiedcode.com/api/v1/project/0cdc7eb543724f60b428aa9cae42bd5f/badge.svg)](https://www.quantifiedcode.com/app/project/0cdc7eb543724f60b428aa9cae42bd5f)

An API that provides an interface for storing and retrieving regulations,
Expand Down
11 changes: 9 additions & 2 deletions regcore_write/views/layer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import logging

from regcore.db import storage
from regcore.layer import standardize_params
from regcore.responses import success, user_error
from regcore_write.views.security import json_body, secure_write


logger = logging.getLogger(__name__)


def child_label_of(lhs, rhs):
"""Is the lhs label a child of the rhs label"""
# Interpretations have a slightly different hierarchy
Expand Down Expand Up @@ -51,10 +56,12 @@ def child_layers(layer_params, layer_data):
doc_id_components = layer_params.doc_id.split('/')
if layer_params.doc_type == 'preamble':
doc_tree = storage.for_documents.get('preamble', layer_params.doc_id)
else:
assert layer_params.doc_type == 'cfr'
elif layer_params.doc_type == 'cfr':
version, label = doc_id_components
doc_tree = storage.for_documents.get('cfr', label, version)
else:
doc_tree = None
logger.error("Invalid doc type: %s", layer_params.doc_type)
if not doc_tree:
return []

Expand Down
1 change: 1 addition & 0 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ mock==1.3.0
nose==1.3.7
coverage==4.0.3
coveralls==1.1
git+https://github.com/openstack/bandit.git # PyPi version is out of date

0 comments on commit 65a58d0

Please sign in to comment.