Skip to content

Commit

Permalink
Merge pull request #4432 from freedomofpress/resolve-linting-issues
Browse files Browse the repository at this point in the history
Resolve linting issues, consolidate linting makefile targets
  • Loading branch information
kushaldas authored May 16, 2019
2 parents 4b1b1ab + 45b7139 commit 62191c8
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 51 deletions.
22 changes: 20 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ common-steps:
paths:
- /caches/layers.tar

- &installenchant
run:
name: Install enchant
command: sudo apt-get install enchant

version: 2
jobs:
lint:
Expand All @@ -54,7 +59,19 @@ jobs:
steps:
- checkout
- *rebaseontarget
- run: make ci-lint
- *installenchant

- run:
name: Install development dependencies
command: pip install -U -r securedrop/requirements/develop-requirements.txt

- run:
name: Run code linting
command: make lint

- run:
name: Run documentation linting
command: make docs-lint

app-tests:
machine:
Expand Down Expand Up @@ -194,7 +211,7 @@ jobs:
docker:
- image: gcr.io/cloud-builders/docker
steps:
- run: apt-get install -y make virtualenv python-pip
- run: apt-get install -y make virtualenv python-pip enchant
- checkout
- setup_remote_docker
- run: make fetch-tor-packages
Expand Down Expand Up @@ -248,6 +265,7 @@ jobs:
steps:
- checkout
- *rebaseontarget
- *installenchant

- run:
name: Run Staging tests on GCE (Xenial)
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Any special considerations for deployment? Consider both:

### If you made changes to the server application code:

- [ ] Linting (`make ci-lint`) and tests (`make -C securedrop test`) pass in the development container
- [ ] Linting (`make lint`) and tests (`make -C securedrop test`) pass in the development container

### If you made changes to `securedrop-admin`:

Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ ci-go: ## Creates, provisions, tests, and destroys GCE host for testing staging
ci-teardown: ## Destroys GCE host for testing staging environment.
./devops/gce-nested/gce-stop.sh

.PHONY: ci-lint
ci-lint: ## Runs linting in linting container.
devops/scripts/dev-shell-ci run make --keep-going lint typelint

.PHONY: ci-deb-tests
ci-deb-tests: ## Runs deb tests in ci
@./devops/scripts/test-built-packages.sh
Expand Down Expand Up @@ -76,7 +72,7 @@ shellcheckclean: ## Cleans up temporary container associated with shellcheck tar
@docker rm -f shellcheck-targets

.PHONY: lint
lint: docs-lint app-lint flake8 html-lint yamllint shellcheck ansible-config-lint ## Runs all linting tools (docs, pylint, flake8, HTML, YAML, shell, ansible-config).
lint: app-lint flake8 html-lint yamllint shellcheck ansible-config-lint ## Runs all linting tools (pylint, flake8, HTML, YAML, shell, ansible-config).

.PHONY: build-debs
build-debs: ## Builds and tests debian packages
Expand Down
35 changes: 0 additions & 35 deletions devops/docker/Dockerfile.linting

This file was deleted.

2 changes: 0 additions & 2 deletions devops/docker/Dockerfile.linting.deps

This file was deleted.

2 changes: 1 addition & 1 deletion devops/gce-nested/gce-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function create_gce_ssh_key() {
# Value will be used in the create call.
function find_latest_ci_image() {
gcloud_call compute images list \
--filter="family:fpf-securedrop AND name ~ ^ci-nested-virt" \
--filter="family:fpf-securedrop AND name ~ ^ci-nested-virt-stretch" \
--sort-by=~Name --limit=1 --format="value(Name)"
}

Expand Down
2 changes: 1 addition & 1 deletion securedrop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ IMAGE = securedrop
.PHONY: lint
lint: ## Run the python linter with the project's default error settings
find . -name '*.py' | xargs pylint --reports=no --errors-only \
--disable=import-error \
--disable=no-name-in-module \
--disable=unexpected-keyword-arg \
--disable=too-many-function-args \
--disable=import-error \
--disable=no-member \
--max-line-length=100

.PHONY: lint-full
Expand Down
5 changes: 1 addition & 4 deletions securedrop/requirements/develop-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ molecule>2.13
# http://docs.ansible.com/ansible/latest/playbooks_filters_ipaddr.html
netaddr
pip-tools>=3.5.0,<4
#
# pyenchant should be included here but is in Dockerfile.linting
# because of https://github.com/freedomofpress/securedrop/issues/2906
#
pyenchant
pylint
pytest-xdist
python-vagrant
Expand Down
1 change: 1 addition & 0 deletions securedrop/requirements/develop-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ py==1.4.34 # via pytest
pyasn1==0.3.1 # via paramiko
pycodestyle==2.3.1 # via flake8
pycparser==2.18 # via cffi
pyenchant==2.0.0
pyflakes==1.5.0 # via flake8
pygments==2.2.0 # via sphinx
pylint==1.8.1
Expand Down

0 comments on commit 62191c8

Please sign in to comment.