Skip to content

Feature/fixup pylint example errors #6

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

Closed
Closed
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
4 changes: 0 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ jobs:
- name: Pre-commit hooks
run: |
pre-commit run --all-files
- name: PyLint
run: |
pylint $( find . -path './adafruit*.py' )
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" ))
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
- name: Archive bundles
Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,17 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: local
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain how this works. I didn't look into it too deeply, but my first impression was that local meant local to your machine. Will this still work in the library when someone PRs to it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it means that it's not pulling the code that pre-commit runs from another repo, but rather, it's executing things locally.

Since part of the GitHub workflow is to install pylint, and that happens before pre-commit runs when someone creates a PR against a GitHub repository, we will be assured that pylint is installed.

The downside is that pylint isn't automatically installed as it would with pre-commit. If we want, we could add that to the custom hook, however, I know we'd rather not pollute peoples' environments by installing things willy-nilly.

hooks:
- id: "pylint-library"
name: "pylint-library"
entry: /usr/bin/env bash -c
args: ['pylint $( find . -path "./adafruit*.py" )']
language: system
description: Run pylint rules on library python code files
- id: pylint_examples
name: pylint-examples
entry: /usr/bin/env bash -c
args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name,bad-whitespace $example; done)']
language: system
description: Run pylint rules on "examples/*.py" files