Skip to content

Commit

Permalink
add flake8 to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
planetmarshall committed Feb 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 0042aed commit c5d97e0
Showing 6 changed files with 22 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -9,15 +9,20 @@ jobs:

- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: install prerequisites
run: |
pip install pytest
pip install -r requirements
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
sudo add-apt-repository "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
sudo apt-get install -y qtbase5-dev lldb-17
sudo ln --force --symbolic /usr/bin/lldb-17 /usr/bin/lldb
- name: run linter
run: flake8 --verbose lldb_qt_formatters

- name: run tests
run: pytest test --junitxml=test.xml --full-trace --verbose test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build
venv
venv

.idea
__pycache__
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -18,8 +18,9 @@ test-formatters:
script:
- python3 -m venv venv
- source venv/bin/activate
- pip install pytest
- pip install -r requirements
- echo "settings set target.load-cwd-lldbinit false" > ~/.lldbinit
- flake8 --verbose lldb_qt_formatters
- pytest --junitxml=lldb_qt_formatters.xml --full-trace --verbose test
artifacts:
reports:
5 changes: 3 additions & 2 deletions lldb_qt_formatters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# We need to import the formatters like this - no other method will work
from .qstring import *
from .qmap import *


def __lldb_init_module(debugger, dict):
def __lldb_init_module(debugger, internal_dict):
init_commands = [
'type summary add --python-function lldb_qt_formatters.qstring.format_summary "QString"',
'type summary add --summary-string "\{${var.key}: ${var.value}\}" -x "QMapNode<.+>$"',
'type summary add --summary-string "\{${var.key}: ${var.value}\}" -x "QMapNode<.+>$"', # noqa: W605
'type synthetic add --python-class lldb_qt_formatters.qmap.SyntheticChildrenProvider -x "QMap<.+>$"',
'type summary add --expand --python-function lldb_qt_formatters.qmap.format_summary -x "QMap<.+>$"'
]
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
flake8-bugbear
flake8
pep8-naming
pytest
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 140
extend-ignore = F401,F403

0 comments on commit c5d97e0

Please sign in to comment.