Move lints to be per-project, not global.

This commit is contained in:
Mike Cooper 2017-06-28 09:54:27 -07:00
Родитель abec492ca4
Коммит e562c0437b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 74AB8817639D69C1
11 изменённых файлов: 12 добавлений и 317 удалений

Просмотреть файл

@ -8,10 +8,8 @@ fi
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../../.. && pwd)"
PROJECTS=(
recipe-client-addon
recipe-server
mock-recipe-server
lints
compose
eslint-config-normandy
mozjexl

Просмотреть файл

@ -34,6 +34,7 @@ compile:
test:
override:
- ./ci/circleci/bin/runner.sh lint
- ./ci/circleci/bin/runner.sh test
deployment:

Просмотреть файл

@ -1,34 +0,0 @@
FROM python:3.6.0-slim
WORKDIR /app
# Create app user and chown directories it needs access to
RUN groupadd --gid 1001 app && useradd -g app --uid 1001 --shell /usr/sbin/nologin app
RUN mkdir -p /home/app
RUN chown -R app /app && \
chown -R app /usr/local && \
chown -R app /home/app
RUN apt-get update && apt-get install -y --no-install-recommends \
curl apt-transport-https git
# Install node from NodeSource
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
apt-get update && \
apt-get install -y nodejs && \
npm install npm@latest -g
# Switch to app user BEFORE running npm install to avoid issue with Docker on
# CircleCI (see https://github.com/npm/npm/issues/16766 and
# https://github.com/npm/npm/issues/16892).
USER app
COPY ./requirements /app/requirements
COPY ./package.json /app/package.json
RUN pip install -U 'pip>=8' && \
pip install --upgrade --no-cache-dir -r requirements/default.txt -c requirements/constraints.txt && \
npm install
COPY . /app
ENV PATH="/app/node_modules/.bin:$PATH"
CMD ["/app/bin/default_command"]

Просмотреть файл

@ -1,27 +0,0 @@
# Lints
This is a unified linting tool for all Normandy projects.
# Usage
The lints are run in a Docker container which sets up all tools needed. To
provide the code to lint, mount it as a Docker volume at ``/app/code``. The
default command for the Dockerfile is the lint tool.
```shell
$ docker build -t lint .
$ docker run -v $CODE_TO_LINT:/app/code lint
```
The directory mounted must be a git repo, as git information is used to find
files to lint. It must contain a `.therapist.yml` config file.
# Implementation
All lints are run and managed through [Therapist][]. The lints currently run are:
* flake8 - For Python files
* eslint - for JS and JSX files. Local .eslintrc files are respected.
* stylelint - For CSS and SCSS files. Local .stylelint files are respected.
[Therapist]: https://github.com/rehandalal/therapist

Просмотреть файл

@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -eu
# build image
docker build -t normandy-lint:build .

Просмотреть файл

@ -1,16 +0,0 @@
#!/usr/bin/env bash
set -eu
echo "Running lint tests"
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../../.. && pwd)"
DOCKER_ARGS=( )
if [[ -v CIRCLE_TEST_REPORTS ]]; then
DOCKER_ARGS+=(--volume $CIRCLE_TEST_REPORTS:/test_artifacts)
fi
docker run \
--net host \
--volume $REPO_DIR:/app/code \
"${DOCKER_ARGS[@]}" \
normandy-lint:build

Просмотреть файл

@ -1,25 +0,0 @@
#!/usr/bin/env bash
num_errors=0
cd /app/code
therapist run --use-tracked-files
if [[ $? -ne 0 ]]; then
num_errors=$((num_errors + 1))
fi
for directory in *; do
if [[ -f $directory/package.json ]]; then
echo "Checking $directory for known NPM security issues..."
pushd $directory
# Temporarily disable nsp, as it fails builds if it can't reach the NSP servers
# See https://github.com/mozilla/normandy/issues/521
nsp check || true
if [[ $? -ne 0 ]]; then
num_errors=$((num_errors + 1))
fi
popd
fi
done
exit $num_errors

Просмотреть файл

@ -1,101 +0,0 @@
{
"name": "normandy-lints",
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/mozilla/normandy.git"
},
"dependencies": {
"antd": "2.11.2",
"babel-polyfill": "6.13.0",
"babel-runtime": "6.11.6",
"classnames": "2.2.5",
"cssmin": "0.4.3",
"font-awesome": "4.6.3",
"immutable": "3.8.1",
"jquery": "3.1.0",
"json-editor": "0.7.28",
"json-loader": "0.5.4",
"localforage": "1.4.3",
"moment": "2.14.1",
"mozjexl": "1.1.5",
"node-sass": "3.9.3",
"node-uuid": "1.4.7",
"nsp": "^2.6.2",
"react": "15.3.1",
"react-addons-css-transition-group": "15.3.1",
"react-breadcrumbs": "1.3.16",
"react-dom": "15.3.1",
"react-redux": "4.4.5",
"react-router": "2.7.0",
"react-router-redux": "4.0.5",
"reactable": "0.14.1",
"redux": "3.6.0",
"redux-form": "6.1.0",
"redux-little-router": "14.0.0-0",
"redux-thunk": "2.1.0",
"sha.js": "2.4.5",
"underscore": "1.8.3",
"underscore.string": "3.3.4"
},
"devDependencies": {
"babel-core": "6.24.1",
"babel-eslint": "7.2.3",
"babel-loader": "6.2.5",
"babel-plugin-syntax-async-functions": "6.13.0",
"babel-plugin-transform-class-properties": "6.24.1",
"babel-plugin-transform-es2015-destructuring": "6.23.0",
"babel-plugin-transform-es2015-modules-commonjs": "6.24.1",
"babel-plugin-transform-export-extensions": "6.22.0",
"babel-plugin-transform-function-bind": "6.22.0",
"babel-plugin-transform-object-rest-spread": "6.23.0",
"babel-plugin-transform-runtime": "6.15.0",
"babel-preset-react": "6.11.1",
"babili-webpack-plugin": "^0.1.1",
"css-loader": "0.24.0",
"enzyme": "2.4.1",
"eslint": "3.19.0",
"eslint-config-airbnb": "10.0.1",
"eslint-config-normandy": "1.0.0",
"eslint-import-resolver-webpack": "0.7.0",
"eslint-plugin-babel": "4.1.1",
"eslint-plugin-import": "1.14.0",
"eslint-plugin-jasmine": "1.8.1",
"eslint-plugin-jsx-a11y": "2.2.1",
"eslint-plugin-mozilla": "0.3.2",
"eslint-plugin-react": "6.2.0",
"exports-loader": "0.6.3",
"extract-text-webpack-plugin": "1.0.1",
"fetch-mock": "5.1.1",
"file-loader": "0.9.0",
"imports-loader": "0.6.5",
"jasmine-core": "2.5.0",
"jasmine-immutable-matchers": "1.0.1",
"jasmine-promises": "0.4.1",
"karma": "1.2.0",
"karma-firefox-launcher": "1.0.0",
"karma-jasmine": "1.0.2",
"karma-junit-reporter": "1.1.0",
"karma-react-jsx-preprocessor": "0.1.1",
"karma-sourcemap-loader": "0.3.7",
"karma-spec-reporter": "0.0.26",
"karma-webpack": "1.8.0",
"postcss-loader": "0.11.1",
"react-addons-test-utils": "15.2.1",
"react-tools": "0.13.3",
"redux-devtools": "3.3.1",
"redux-devtools-dock-monitor": "1.1.1",
"redux-devtools-log-monitor": "1.0.11",
"redux-logger": "3.0.6",
"redux-mock-store": "1.1.4",
"sass-loader": "4.0.1",
"style-loader": "0.13.1",
"stylelint": "7.6.0",
"stylelint-config-standard": "15.0.0",
"stylelint-order": "0.2.2",
"webpack": "1.13.2",
"webpack-async-await": "1.0.4",
"webpack-bundle-tracker": "0.0.93",
"yargs": "4.8.1"
}
}

Просмотреть файл

@ -1,100 +0,0 @@
alabaster==0.7.7 \
--hash=sha256:d57602b3d730c2ecb978a213face0b7a16ceaa4a263575361bd4fd9e2669a544 \
--hash=sha256:f416a84e0d0ddbc288f6b8f2c276d10b40ca1238562cd9ed5a751292ec647b71
Babel==2.2.0 \
--hash=sha256:fed07cbcdcb3de79b53a8220eebed21c93f8dbb3dbce1d9c6b1c4b09e8aecf2b \
--hash=sha256:d8cb4c0e78148aee89560f9fe21587aa57739c975bb89ff66b1e842cc697428f
cffi==1.5.2 \
--hash=sha256:810c52902a8a8ebdf37c3097930de1e51f0a70167444faa91f426228bc3f5277 \
--hash=sha256:10154ed65b135fd1e94df56e6e05796c2c745e62c3233d147bf873417efdc9aa \
--hash=sha256:9aee43865a42243555394d8090eaf97a0c9e0fc5ddc3344fce5a34b17f4b8c94 \
--hash=sha256:96ca8beab869c2a0164b3ec9716dc85713a8e8b480e8d303520e6869dec27216 \
--hash=sha256:da9bde99872e46f7bb5cff40a9b1cc08406765efafb583c704de108b6cb821dd
click==6.7 \
--hash=sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d \
--hash=sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b
configparser==3.5.0 \
--hash=sha256:5308b47021bc2340965c371f0f058cc6971a04502638d4244225c49d80db273a
contextlib2==0.5.1 \
--hash=sha256:227c79e126e8a8904a81d162750581ed3d49af2395a3100be7067b7296d33d45
docutils==0.12 \
--hash=sha256:dcebd4928112631626f4c4d0df59787c748404e66dda952110030ea883d3b8cd \
--hash=sha256:c7db717810ab6965f66c8cf0398a98c9d8df982da39b4cd7f162911eb89596fa
fake-factory==0.5.3 \
--hash=sha256:90f507891ad1073e08cf6908eb51d5e1debc3c5a5d554427e8c3fbf73cdf12ee
frozendict==0.6 \
--hash=sha256:168791393c2c642264a6839aac5e7c6a34b3a284aa02b8c950739962f756163c
Jinja2==2.8 \
--hash=sha256:1cc03ef32b64be19e0a5b54578dd790906a34943fe9102cfdae0d4495bd536b4 \
--hash=sha256:bc1ff2ff88dbfacefde4ddde471d1417d3b304e8df103a7a9437d47269201bf4
MarkupSafe==0.23 \
--hash=sha256:a4ec1aff59b95a14b45eb2e23761a0179e98319da5a7eb76b56ea8cdc7b871c3
mohawk==0.3.2.1 \
--hash=sha256:46e98d8349f927b40227f1a9f0021509fedcf0398e1feb22dac954010f625f1d
maxminddb==1.2.0 \
--hash=sha256:00bf6c469a11316b052f732ab326363acadb6b3bd610eabfb479f4621baffab8
mccabe==0.6.1 \
--hash=sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42 \
--hash=sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f
pathspec==0.5.0 \
--hash=sha256:aa3a071054d4740b963c91a3127a5e0e1358351718bae2a3f731ec24fb0bdd1f
pep8==1.7.0 \
--hash=sha256:4fc2e478addcf17016657dff30b2d8d611e8341fac19ccf2768802f6635d7b8a \
--hash=sha256:a113d5f5ad7a7abacef9df5ec3f2af23a20a28005921577b15dd584d099d5900
py==1.4.31 \
--hash=sha256:4a3e4f3000c123835ac39cab5ccc510642153bc47bc1f13e2bbb53039540ae69 \
--hash=sha256:a6501963c725fc2554dabfece8ae9a8fb5e149c0ac0a42fd2b02c5c1c57fc114
pycparser==2.14 \
--hash=sha256:7959b4a74abdc27b312fed1c21e6caf9309ce0b29ea86b591fd2e99ecdf27f73
pyflakes==1.5.0 \
--hash=sha256:cc5eadfb38041f8366128786b4ca12700ed05bbf1403d808e89d57d67a3875a7 \
--hash=sha256:aa0d4dff45c0cc2214ba158d29280f8fa1129f3e87858ef825930845146337f4
Pygments==2.1 \
--hash=sha256:3e723f70dc47b4ad5ca3ab4f1d1c3f76438b3dc74d6a843ded3e154e8af99838 \
--hash=sha256:148e04b185d3541b8d702e8cde3ee5acd06b31cc0d474127baba9f4652b2aaf1 \
--hash=sha256:13a0ef5fafd7b16cf995bc28fe7aab0780dab1b2fda0fc89e033709af8b8a47b
pytz==2015.7 \
--hash=sha256:3ede470d3d17ba3c07638dfa0d10452bc1b6e5ad326127a65ba77e6aaeb11bec \
--hash=sha256:e079b1dadc5c06246cc1bb6fe1b23a50b1d1173f2edd5104efd40bb73a28f406 \
--hash=sha256:fbd26746772c24cb93c8b97cbdad5cb9e46c86bbdb1b9d8a743ee00e2fb1fc5d \
--hash=sha256:99266ef30a37e43932deec2b7ca73e83c8dbc3b9ff703ec73eca6b1dae6befea \
--hash=sha256:8b6ce1c993909783bc96e0b4f34ea223bff7a4df2c90bdb9c4e0f1ac928689e3
PyYAML==3.12 \
--hash=sha256:3262c96a1ca437e7e4763e2843746588a965426550f3797a79fca9c6199c431f \
--hash=sha256:16b20e970597e051997d90dc2cddc713a2876c47e3d92d59ee198700c5427736 \
--hash=sha256:e863072cdf4c72eebf179342c94e6989c67185842d9997960b3e69290b2fa269 \
--hash=sha256:bc6bced57f826ca7cb5125a10b23fd0f2fff3b7c4701d64c439a300ce665fff8 \
--hash=sha256:c01b880ec30b5a6e6aa67b09a2fe3fb30473008c85cd6a67359a1b15ed6d83a4 \
--hash=sha256:827dc04b8fa7d07c44de11fabbc888e627fa8293b695e0f99cb544fdfa1bf0d1 \
--hash=sha256:592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab \
--hash=sha256:ca233c64c6e40eaa6c66ef97058cdc80e8d0157a443655baa1b2966e812807ca \
--hash=sha256:4474f8ea030b5127225b8894d626bb66c01cda098d47a2b0d3429b6700af9fd8 \
--hash=sha256:326420cbb492172dec84b0f65c80942de6cedb5233c413dd824483989c000608 \
--hash=sha256:5f84523c076ad14ff5e6c037fe1c89a7f73a3e04cf0377cb4d017014976433f3 \
--hash=sha256:0c507b7f74b3d2dd4d1322ec8a94794927305ab4cebbe89cc47fe5e81541e6e8 \
--hash=sha256:b4c423ab23291d3945ac61346feeb9a0dc4184999ede5e7c43e1ffb975130ae6 \
--hash=sha256:5ac82e411044fb129bae5cfbeb3ba626acb2af31a8d17d175004b70862a741a7
setuptools==19.6 \
--hash=sha256:57c63a363b37ffa2d64db4ffee26844e3ab81441fc02da4cd5e8cafcff9acb3a \
--hash=sha256:ecd48d753c1a8ecc6a2826b863a6defaafbfd4ceafc0c1d62e5362f5a86912e9 \
--hash=sha256:ada6bc13059b504c939a77baa06d71cbe5028babc12b7e4b41816d0130be456f
simplejson==3.8.2 \
--hash=sha256:e3b2fed6fedf3fdce70d10c61dee8779b8bf7e67b5625efee4bff8243b180487 \
--hash=sha256:8793bb83911ea75c0be8806456cfb6242f2e513107115811dc6bc010029fb1b0 \
--hash=sha256:99694d33744924958412312113925a9eff918e4c32ec850f1636a7af3a463481 \
--hash=sha256:d58439c548433adcda98e695be53e526ba940a4b9c44fb9a05d92cd495cdd47f \
--hash=sha256:a97dd6d819626dc4371adbc7b6bdf3246fbffaf9346be4d22a7b5e501d7da99a \
--hash=sha256:8a66052d057871962b20574346a8380f03bff0a2f5c0eedc307d10dd0172aa46
six==1.10.0 \
--hash=sha256:0ff78c403d9bccf5a425a6d31a12aa6b47f1c21ca4dc2573a7e2f32a97335eb1 \
--hash=sha256:105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a
snowballstemmer==1.2.1 \
--hash=sha256:9f3bcd3c401c3e862ec0ebe6d2c069ebc012ce142cce209c098ccb5b09136e89 \
--hash=sha256:919f26a68b2c17a7634da993d91339e288964f93c274f1343e3bbbe2096e1128
colorama==0.3.7 \
--hash=sha256:a4c0f5bc358a62849653471e309dcc991223cf86abafbec17cd8f41327279e89 \
--hash=sha256:e043c8d32527607223652021ff648fbb394d5e19cba9f1a698670b338c9d782b \
--hash=sha256:f4945bf52ae49da0728fe730a33c18744803752fc948f154f29dc0c4f9f2f9cc
pycodestyle==2.3.1 \
--hash=sha256:6c4245ade1edfad79c3446fadfc96b0de2759662dc29d07d80a6f27ad1ca6ba9 \
--hash=sha256:682256a5b318149ca0d2a9185d365d8864a768a28db66a84a2ea946bcc426766

Просмотреть файл

@ -1,7 +0,0 @@
flake8==3.3.0 \
--hash=sha256:83905eadba99f73fbfe966598aaf1682b3eb6755d2263c5b33a4e8367d60b0d1 \
--hash=sha256:b907a26dcf5580753d8f80f1be0ec1d5c45b719f7bac441120793d1a70b03f12
flake8-junit-report==2.0.1 \
--hash=sha256:55914a99126d3b30cad2a042d95d466b5b368c7f69ef68ec7ec8321d3f0e2eee
therapist==1.2.1 \
--hash=sha256:d73aef73167d2cef2f02abad5fc34e87c147e90dc1a041dcdef090e50f1b0ee5

11
recipe-server/bin/ci/lint Executable file
Просмотреть файл

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -eu
echo "Linting Python files"
bin/ci/docker-run.sh flake8 normandy/ contract-tests/
echo "Linting JS files"
bin/ci/docker-run.sh eslint normandy
echo "Linting Style files"
bin/ci/docker-run.sh stylelint normandy