Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TweetyDaBird committed Jul 9, 2021
2 parents c6fc84f + 0a9843b commit fa5d794
Show file tree
Hide file tree
Showing 2,030 changed files with 86,071 additions and 9,242 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ GRAPHICS
# hex files
*.hex binary
*.eep binary
nix/sources.nix linguist-generated=true
57 changes: 26 additions & 31 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,42 @@
name: Format Codebase
name: PR Lint Format

on:
push:
branches:
- master
- develop
pull_request:
paths:
- 'drivers/**'
- 'lib/arm_atsam/**'
- 'lib/lib8tion/**'
- 'lib/python/**'
- 'platforms/**'
- 'quantum/**'
- 'tests/**'
- 'tmk_core/**'

jobs:
format:
lint:
runs-on: ubuntu-latest
container: qmkfm/base_container

# protect against those who develop with their fork on master
if: github.repository == 'qmk/qmk_firmware'
container: qmkfm/base_container

steps:
- uses: rlespinasse/github-slug-action@v3.x

- uses: actions/checkout@v2
with:
token: ${{ secrets.API_TOKEN_GITHUB }}

- name: Install dependencies
run: |
apt-get update && apt-get install -y dos2unix
fetch-depth: 0

- name: Format files
run: |
bin/qmk cformat -a
bin/qmk pyformat
bin/qmk fileformat
- uses: trilom/file-changes-action@v1.2.4
id: file_changes
with:
output: ' '
fileOutput: ' '

- name: Become QMK Bot
- name: Run qmk cformat and qmk pyformat
shell: 'bash {0}'
run: |
git config user.name 'QMK Bot'
git config user.email 'hello@qmk.fm'
qmk cformat --core-only -n $(< ~/files.txt)
cformat_exit=$?
qmk pyformat -n
pyformat_exit=$?
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
delete-branch: true
branch: bugfix/format_${{ env.GITHUB_REF_SLUG }}
author: QMK Bot <hello@qmk.fm>
committer: QMK Bot <hello@qmk.fm>
commit-message: Format code according to conventions
title: '[CI] Format code according to conventions'
exit $((cformat_exit + pyformat_exit))
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ doxygen/
.browse.VC.db*
*.stackdump
# Let these ones be user specific, since we have so many different configurations
*.code-workspace
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/tasks.json
Expand All @@ -71,6 +72,7 @@ id_rsa_*

# python things
__pycache__
.python-version

# prerequisites for updating ChibiOS
/util/fmpp*
Expand Down
44 changes: 0 additions & 44 deletions bin/qmk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
import os
import sys
from importlib.util import find_spec
from pathlib import Path

# Add the QMK python libs to our path
Expand All @@ -12,52 +11,9 @@ qmk_dir = script_dir.parent
python_lib_dir = Path(qmk_dir / 'lib' / 'python').resolve()
sys.path.append(str(python_lib_dir))


def _check_modules(requirements):
""" Check if the modules in the given requirements.txt are available.
"""
with Path(qmk_dir / requirements).open() as fd:
for line in fd.readlines():
line = line.strip().replace('<', '=').replace('>', '=')

if len(line) == 0 or line[0] == '#' or line.startswith('-r'):
continue

if '#' in line:
line = line.split('#')[0]

module = dict()
module['name'] = line.split('=')[0] if '=' in line else line
module['import'] = module['name'].replace('-', '_')

# Not every module is importable by its own name.
if module['name'] == "pep8-naming":
module['import'] = "pep8ext_naming"

if not find_spec(module['import']):
print('Could not find module %s!' % module['name'])
print('Please run `python3 -m pip install -r %s` to install required python dependencies.' % (qmk_dir / requirements,))
if developer:
print('You can also turn off developer mode: qmk config user.developer=None')
print()
exit(255)


developer = False
# Make sure our modules have been setup
_check_modules('requirements.txt')

# Setup the CLI
import milc # noqa

# For developers additional modules are needed
if milc.cli.config.user.developer:
# Do not run the check for 'config',
# so users can turn off developer mode
if len(sys.argv) == 1 or (len(sys.argv) > 1 and 'config' != sys.argv[1]):
developer = True
_check_modules('requirements-dev.txt')

milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'


Expand Down
6 changes: 5 additions & 1 deletion build_keyboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ endif
#
# https://docs.qmk.fm/#/feature_layouts?id=tips-for-making-layouts-keyboard-agnostic
#
QMK_KEYBOARD_H = $(KEYBOARD_OUTPUT)/src/default_keyboard.h
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/$(KEYBOARD_FOLDER_1).h)","")
QMK_KEYBOARD_H = $(KEYBOARD_FOLDER_1).h
endif
Expand Down Expand Up @@ -296,10 +297,13 @@ CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.
$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES)
bin/qmk generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h

$(KEYBOARD_OUTPUT)/src/default_keyboard.h: $(INFO_JSON_FILES)
bin/qmk generate-keyboard-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/default_keyboard.h

$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES)
bin/qmk generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h

generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/default_keyboard.h $(KEYBOARD_OUTPUT)/src/layouts.h

.INTERMEDIATE : generated-files

Expand Down
Loading

0 comments on commit fa5d794

Please sign in to comment.