Merge pull request #1527 from MrChico/codespell

Add Codespell check to ci
This commit is contained in:
Danny Ryan 2019-12-16 10:32:35 -07:00 committed by GitHub
commit cb72a7d8a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 6 deletions

View File

@ -112,6 +112,15 @@ jobs:
- run: - run:
name: Check table of contents name: Check table of contents
command: sudo npm install -g doctoc && make check_toc command: sudo npm install -g doctoc && make check_toc
codespell:
docker:
- image: circleci/python:3.6
working_directory: ~/specs-repo
steps:
- checkout
- run:
name: Check codespell
command: pip install codespell --user && make codespell
lint: lint:
docker: docker:
- image: circleci/python:3.6 - image: circleci/python:3.6
@ -158,6 +167,7 @@ workflows:
requires: requires:
- install_pyspec_test - install_pyspec_test
- table_of_contents - table_of_contents
- codespell
- lint: - lint:
requires: requires:
- test - test

View File

@ -77,6 +77,9 @@ check_toc: $(MARKDOWN_FILES:=.toc)
diff -q $* $*.tmp && \ diff -q $* $*.tmp && \
rm $*.tmp rm $*.tmp
codespell:
codespell . --skip ./.git -I .codespell-whitelist
lint: $(PY_SPEC_ALL_TARGETS) lint: $(PY_SPEC_ALL_TARGETS)
cd $(PY_SPEC_DIR); . venv/bin/activate; \ cd $(PY_SPEC_DIR); . venv/bin/activate; \
flake8 --ignore=E252,W504,W503 --max-line-length=120 ./eth2spec \ flake8 --ignore=E252,W504,W503 --max-line-length=120 ./eth2spec \

View File

@ -252,7 +252,7 @@ def combine_ssz_objects(old_objects: Dict[str, str], new_objects: Dict[str, str]
return old_objects return old_objects
# inserts are handeled the same way as functions # inserts are handled the same way as functions
combine_inserts = combine_functions combine_inserts = combine_functions

View File

@ -560,7 +560,7 @@ def int_to_bytes(n: uint64, length: uint64) -> bytes:
```python ```python
def bytes_to_int(data: bytes) -> uint64: def bytes_to_int(data: bytes) -> uint64:
""" """
Return the integer deserialization of ``data`` intepreted as ``ENDIANNESS``-endian. Return the integer deserialization of ``data`` interpreted as ``ENDIANNESS``-endian.
""" """
return int.from_bytes(data, ENDIANNESS) return int.from_bytes(data, ENDIANNESS)
``` ```

View File

@ -150,7 +150,7 @@ Template:
Data: Data:
{container name}: Any of the container names listed below (exluding the `(Container)` python super type) {container name}: Any of the container names listed below (excluding the `(Container)` python super type)
``` ```
```python ```python

View File

@ -262,7 +262,7 @@ def test_att1_duplicate_index_normal_signed(spec, state):
indices.pop(1) # remove an index, make room for the additional duplicate index. indices.pop(1) # remove an index, make room for the additional duplicate index.
attester_slashing.attestation_1.attesting_indices = sorted(indices) attester_slashing.attestation_1.attesting_indices = sorted(indices)
# sign it, the signature will be valid for a single occurence. If the transition accidentally ignores the duplicate. # The signature will be valid for a single occurrence. If the transition accidentally ignores the duplicate.
sign_indexed_attestation(spec, state, attester_slashing.attestation_1) sign_indexed_attestation(spec, state, attester_slashing.attestation_1)
indices.append(indices[0]) # add one of the indices a second time indices.append(indices[0]) # add one of the indices a second time
@ -282,7 +282,7 @@ def test_att2_duplicate_index_normal_signed(spec, state):
indices.pop(2) # remove an index, make room for the additional duplicate index. indices.pop(2) # remove an index, make room for the additional duplicate index.
attester_slashing.attestation_2.attesting_indices = sorted(indices) attester_slashing.attestation_2.attesting_indices = sorted(indices)
# sign it, the signature will be valid for a single occurence. If the transition accidentally ignores the duplicate. # The signature will be valid for a single occurrence. If the transition accidentally ignores the duplicate.
sign_indexed_attestation(spec, state, attester_slashing.attestation_2) sign_indexed_attestation(spec, state, attester_slashing.attestation_2)
indices.append(indices[1]) # add one of the indices a second time indices.append(indices[1]) # add one of the indices a second time

View File

@ -155,7 +155,7 @@ def test_duplicate_attestation(spec, state):
next_epoch(spec, single_state) next_epoch(spec, single_state)
next_epoch(spec, dup_state) next_epoch(spec, dup_state)
# Run non-duplicate inclusion rewards for comparision. Do not yield test vectors # Run non-duplicate inclusion rewards for comparison. Do not yield test vectors
for _ in run_process_rewards_and_penalties(spec, single_state): for _ in run_process_rewards_and_penalties(spec, single_state):
pass pass