diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 221659e1..fd99feee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,11 +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" )) - ([[ ! -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 @@ -62,7 +57,12 @@ jobs: with: name: bundles path: ${{ github.workspace }}/bundles/ + - name: Check For docs folder + id: need-docs + run: | + echo ::set-output name=docs::$( find . -wholename './docs' ) - name: Build docs + if: contains(steps.need-docs.outputs.docs, 'docs') working-directory: docs run: sphinx-build -E -W -b html . _build/html - name: Check For setup.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07f886c0..354c7618 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,18 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace +- repo: https://github.com/pycqa/pylint + rev: pylint-2.7.1 + hooks: + - id: pylint + name: pylint (library code) + types: [python] + exclude: "^(docs/|examples/|setup.py$)" +- repo: local + hooks: + - id: pylint_examples + name: pylint (examples code) + description: Run pylint rules on "examples/*.py" files + entry: /usr/bin/env bash -c + args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name $example; done)'] + language: system diff --git a/adafruit_minimqtt/adafruit_minimqtt.py b/adafruit_minimqtt/adafruit_minimqtt.py index bb45d554..9aff97e0 100755 --- a/adafruit_minimqtt/adafruit_minimqtt.py +++ b/adafruit_minimqtt/adafruit_minimqtt.py @@ -227,6 +227,15 @@ def _get_connect_socket(self, host, port, *, timeout=1): "ssl_context must be set before using adafruit_mqtt for secure MQTT." ) + if self.logger and port == MQTT_TLS_PORT: + self.logger.info( + "Establishing a SECURE SSL connection to {0}:{1}".format(host, port) + ) + else: + self.logger.info( + "Establishing an INSECURE connection to {0}:{1}".format(host, port) + ) + addr_info = self._socket_pool.getaddrinfo( host, port, 0, self._socket_pool.SOCK_STREAM )[0]