Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve linting issues, consolidate linting makefile targets #4432

Merged
merged 7 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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