Add pep8 and js lint
Add support for pep8 and js linting Will hold off on js cleanups as there are a lot of them. Will make that job non-voting so we can make progress. gate patch Iddb4897c5e8c21dae467a73124b68a120700e909 Blueprint: add-integration-tests Change-Id: Iec0c524325a9dca8e1e7b7a9ff599842c4cc3dbf
This commit is contained in:
parent
56f0804b27
commit
d9b7cc4b3a
|
@ -0,0 +1,53 @@
|
|||
# Set up globals
|
||||
globals:
|
||||
angular: false
|
||||
|
||||
extends: openstack
|
||||
|
||||
# Most environment options are not explicitly enabled or disabled, only
|
||||
# included here for completeness' sake. They are commented out, because the
|
||||
# global updates.py script would otherwise override them during a global
|
||||
# requirements synchronization.
|
||||
#
|
||||
# Individual projects should choose which platforms they deploy to.
|
||||
|
||||
env:
|
||||
# browser global variables.
|
||||
browser: true
|
||||
|
||||
# Adds all of the Jasmine testing global variables for version 1.3 and 2.0.
|
||||
jasmine: true
|
||||
|
||||
# Enable eslint-plugin-angular
|
||||
plugins:
|
||||
- angular
|
||||
|
||||
# Below we adjust rules specific to horizon's usage of openstack's linting
|
||||
# rules, and its own plugin inclusions.
|
||||
rules:
|
||||
#############################################################################
|
||||
# Disabled Rules from eslint-config-openstack
|
||||
#############################################################################
|
||||
valid-jsdoc: 1
|
||||
brace-style: 1
|
||||
no-extra-parens: 1
|
||||
consistent-return: 1
|
||||
callback-return: 1
|
||||
guard-for-in: 1
|
||||
block-scoped-var: 1
|
||||
semi-spacing: 1
|
||||
no-redeclare: 1
|
||||
no-new: 1
|
||||
|
||||
#############################################################################
|
||||
# Angular Plugin Customization
|
||||
#############################################################################
|
||||
|
||||
angular/controller-as-vm:
|
||||
- 1
|
||||
- "ctrl"
|
||||
|
||||
# Remove after migrating to angular 1.4 or later.
|
||||
angular/no-cookiestore:
|
||||
- 1
|
||||
|
|
@ -1,2 +1,24 @@
|
|||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
.eggs
|
||||
eggs
|
||||
parts
|
||||
bin
|
||||
var
|
||||
sdist
|
||||
develop-eggs
|
||||
.idea
|
||||
|
||||
# unit tests
|
||||
.tox
|
||||
|
||||
# reno
|
||||
releasenotes/build/
|
||||
|
||||
# npm
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
|
||||
|
|
|
@ -24,10 +24,6 @@ ADD_INSTALLED_APPS = ['app_catalog']
|
|||
|
||||
ADD_ANGULAR_MODULES = ['horizon.dashboard.project.app_catalog']
|
||||
|
||||
ADD_JS_FILES = [
|
||||
'dashboard/project/app_catalog/app_catalog.js'
|
||||
]
|
||||
ADD_JS_FILES = ['dashboard/project/app_catalog/app_catalog.js']
|
||||
|
||||
ADD_SCSS_FILES = [
|
||||
'dashboard/project/app_catalog/app_catalog.scss'
|
||||
]
|
||||
ADD_SCSS_FILES = ['dashboard/project/app_catalog/app_catalog.scss']
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
from horizon import Horizon
|
||||
from horizon import views
|
||||
from horizon.version import version_info as hvi
|
||||
# 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.
|
||||
|
||||
from app_catalog.version import version_info as acvi
|
||||
from django.conf import settings
|
||||
from horizon import Horizon
|
||||
from horizon.version import version_info as hvi
|
||||
from horizon import views
|
||||
from openstack_dashboard import api
|
||||
import re
|
||||
|
||||
import json
|
||||
|
||||
|
||||
class IndexView(views.APIView):
|
||||
# A very simple class-based view...
|
||||
template_name = 'app_catalog/index.html'
|
||||
|
@ -17,23 +30,28 @@ class IndexView(views.APIView):
|
|||
try:
|
||||
Horizon.get_dashboard('murano')
|
||||
has_murano = True
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
regex = re.compile('(\d+\.\d+\.\d+)-?(.*)')
|
||||
heat_version = None
|
||||
heat_release = None
|
||||
try:
|
||||
info = api.heat.heatclient(request).build_info.build_info()['engine']['revision']
|
||||
info = api.heat.heatclient(
|
||||
request).build_info.build_info()['engine']['revision']
|
||||
match = regex.match(info)
|
||||
if match:
|
||||
heat_version = match.group(1)
|
||||
heat_release = match.group(0)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
heat_version = getattr(settings, 'APP_CATALOG_HEAT_VERSION', heat_version)
|
||||
heat_release = getattr(settings, 'APP_CATALOG_HEAT_RELEASE', heat_release)
|
||||
murano_version = getattr(settings, 'APP_CATALOG_MURANO_VERSION', None)
|
||||
murano_release = getattr(settings, 'APP_CATALOG_MURANO_RELEASE', None)
|
||||
heat_version = getattr(settings,
|
||||
'APP_CATALOG_HEAT_VERSION', heat_version)
|
||||
heat_release = getattr(settings,
|
||||
'APP_CATALOG_HEAT_RELEASE', heat_release)
|
||||
murano_version = getattr(settings,
|
||||
'APP_CATALOG_MURANO_VERSION', None)
|
||||
murano_release = getattr(settings,
|
||||
'APP_CATALOG_MURANO_RELEASE', None)
|
||||
app_catalog_settings = {
|
||||
'HEAT_VERSION': {
|
||||
'VER': heat_version,
|
||||
|
@ -52,7 +70,9 @@ class IndexView(views.APIView):
|
|||
'VER': acvi.version_string(),
|
||||
'REL': acvi.release_string()
|
||||
},
|
||||
'APP_CATALOG_URL': getattr(settings, 'APP_CATALOG_URL', '//apps.openstack.org')
|
||||
'APP_CATALOG_URL': getattr(settings,
|
||||
'APP_CATALOG_URL',
|
||||
'//apps.openstack.org')
|
||||
}
|
||||
context['APP_CATALOG_SETTINGS'] = json.dumps(app_catalog_settings)
|
||||
return context
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from app_catalog.views import IndexView as ACView
|
||||
|
||||
|
||||
class IndexView(ACView):
|
||||
# A very simple class-based view...
|
||||
template_name = 'component_catalog/index.html'
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"name": "app-catalog-ui",
|
||||
"description": "Application Catalog Dashboard",
|
||||
"repository": "none",
|
||||
"license": "Apache 2.0",
|
||||
"devDependencies": {
|
||||
"eslint": "1.2.1",
|
||||
"eslint-config-openstack": "1.2.3",
|
||||
"eslint-plugin-angular": "0.15.0",
|
||||
"jasmine-core": "2.2.0",
|
||||
"karma": "0.12.31",
|
||||
"karma-chrome-launcher": "0.1.8",
|
||||
"karma-cli": "0.0.4",
|
||||
"karma-coverage": "0.3.1",
|
||||
"karma-jasmine": "0.3.5",
|
||||
"karma-ng-html2js-preprocessor": "0.1.2",
|
||||
"karma-phantomjs-launcher": "0.2.0",
|
||||
"karma-threshold-reporter": "0.1.15",
|
||||
"phantomjs": "1.9.17"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --no-color app_catalog/static"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
# Hacking already pins down pep8, pyflakes and flake8
|
||||
hacking<0.11,>=0.10.0
|
||||
|
||||
# doc build requirements
|
||||
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
|
|
23
tox.ini
23
tox.ini
|
@ -1,5 +1,28 @@
|
|||
[tox]
|
||||
minversion = 1.6
|
||||
envlist = pep8,eslint
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
whitelist_externals = /usr/bin/npm
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
|
||||
[testenv:eslint]
|
||||
# npm must be installed on the system, for example
|
||||
# sudo apt-get install npm
|
||||
commands = npm install
|
||||
npm run lint
|
||||
|
||||
[testenv:releasenotes]
|
||||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
|
||||
[flake8]
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
|
||||
show-source = True
|
||||
ignore = E123,E125
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
|
||||
|
|
Loading…
Reference in New Issue