Skip to content

Commit ff4f015

Browse files
committed
feat(repo): initialize with modules 'check', 'log' and 'utils'
1 parent c994276 commit ff4f015

38 files changed

+2346
-93
lines changed

.codespellrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[codespell]
2+
skip = ./src/touch/port/esp_lcd_touch_xpt2046.c

.flake8

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
[flake8]
2+
3+
select =
4+
# Full lists are given in order to suppress all errors from other plugins
5+
# Full list of pyflakes error codes:
6+
F401, # module imported but unused
7+
F402, # import module from line N shadowed by loop variable
8+
F403, # 'from module import *' used; unable to detect undefined names
9+
F404, # future import(s) name after other statements
10+
F405, # name may be undefined, or defined from star imports: module
11+
F406, # 'from module import *' only allowed at module level
12+
F407, # an undefined __future__ feature name was imported
13+
F601, # dictionary key name repeated with different values
14+
F602, # dictionary key variable name repeated with different values
15+
F621, # too many expressions in an assignment with star-unpacking
16+
F622, # two or more starred expressions in an assignment (a, *b, *c = d)
17+
F631, # assertion test is a tuple, which are always True
18+
F701, # a break statement outside of a while or for loop
19+
F702, # a continue statement outside of a while or for loop
20+
F703, # a continue statement in a finally block in a loop
21+
F704, # a yield or yield from statement outside of a function
22+
F705, # a return statement with arguments inside a generator
23+
F706, # a return statement outside of a function/method
24+
F707, # an except: block as not the last exception handler
25+
F721, F722, # doctest syntax error syntax error in forward type annotation
26+
F811, # redefinition of unused name from line N
27+
F812, # list comprehension redefines name from line N
28+
F821, # undefined name name
29+
F822, # undefined name name in __all__
30+
F823, # local variable name referenced before assignment
31+
F831, # duplicate argument name in function definition
32+
F841, # local variable name is assigned to but never used
33+
F901, # raise NotImplemented should be raise NotImplementedError
34+
35+
# Full list of pycodestyle violations:
36+
E101, # indentation contains mixed spaces and tabs
37+
E111, # indentation is not a multiple of four
38+
E112, # expected an indented block
39+
E113, # unexpected indentation
40+
E114, # indentation is not a multiple of four (comment)
41+
E115, # expected an indented block (comment)
42+
E116, # unexpected indentation (comment)
43+
E121, # continuation line under-indented for hanging indent
44+
E122, # continuation line missing indentation or outdented
45+
E123, # closing bracket does not match indentation of opening bracket's line
46+
E124, # closing bracket does not match visual indentation
47+
E125, # continuation line with same indent as next logical line
48+
E126, # continuation line over-indented for hanging indent
49+
E127, # continuation line over-indented for visual indent
50+
E128, # continuation line under-indented for visual indent
51+
E129, # visually indented line with same indent as next logical line
52+
E131, # continuation line unaligned for hanging indent
53+
E133, # closing bracket is missing indentation
54+
E201, # whitespace after '('
55+
E202, # whitespace before ')'
56+
E203, # whitespace before ':'
57+
E211, # whitespace before '('
58+
E221, # multiple spaces before operator
59+
E222, # multiple spaces after operator
60+
E223, # tab before operator
61+
E224, # tab after operator
62+
E225, # missing whitespace around operator
63+
E226, # missing whitespace around arithmetic operator
64+
E227, # missing whitespace around bitwise or shift operator
65+
E228, # missing whitespace around modulo operator
66+
E231, # missing whitespace after ',', ';', or ':'
67+
E241, # multiple spaces after ','
68+
E242, # tab after ','
69+
E251, # unexpected spaces around keyword / parameter equals
70+
E261, # at least two spaces before inline comment
71+
E262, # inline comment should start with '# '
72+
E265, # block comment should start with '# '
73+
E266, # too many leading '#' for block comment
74+
E271, # multiple spaces after keyword
75+
E272, # multiple spaces before keyword
76+
E273, # tab after keyword
77+
E274, # tab before keyword
78+
E275, # missing whitespace after keyword
79+
E301, # expected 1 blank line, found 0
80+
E302, # expected 2 blank lines, found 0
81+
E303, # too many blank lines
82+
E304, # blank lines found after function decorator
83+
E305, # expected 2 blank lines after end of function or class
84+
E306, # expected 1 blank line before a nested definition
85+
E401, # multiple imports on one line
86+
E402, # module level import not at top of file
87+
E501, # line too long (82 > 79 characters)
88+
E502, # the backslash is redundant between brackets
89+
E701, # multiple statements on one line (colon)
90+
E702, # multiple statements on one line (semicolon)
91+
E703, # statement ends with a semicolon
92+
E704, # multiple statements on one line (def)
93+
E711, # comparison to None should be 'if cond is None:'
94+
E712, # comparison to True should be 'if cond is True:' or 'if cond:'
95+
E713, # test for membership should be 'not in'
96+
E714, # test for object identity should be 'is not'
97+
E721, # do not compare types, use 'isinstance()'
98+
E722, # do not use bare except, specify exception instead
99+
E731, # do not assign a lambda expression, use a def
100+
E741, # do not use variables named 'l', 'O', or 'I'
101+
E742, # do not define classes named 'l', 'O', or 'I'
102+
E743, # do not define functions named 'l', 'O', or 'I'
103+
E901, # SyntaxError or IndentationError
104+
E902, # IOError
105+
W191, # indentation contains tabs
106+
W291, # trailing whitespace
107+
W292, # no newline at end of file
108+
W293, # blank line contains whitespace
109+
W391, # blank line at end of file
110+
W503, # line break before binary operator
111+
W504, # line break after binary operator
112+
W505, # doc line too long (82 > 79 characters)
113+
W601, # .has_key() is deprecated, use 'in'
114+
W602, # deprecated form of raising exception
115+
W603, # '<>' is deprecated, use '!='
116+
W604, # backticks are deprecated, use 'repr()'
117+
W605, # invalid escape sequence 'x'
118+
W606, # 'async' and 'await' are reserved keywords starting with Python 3.7
119+
120+
# Full list of flake8 violations
121+
E999, # failed to compile a file into an Abstract Syntax Tree for the plugins that require it
122+
123+
# Full list of mccabe violations
124+
C901 # complexity value provided by the user
125+
126+
ignore =
127+
E221, # multiple spaces before operator
128+
E231, # missing whitespace after ',', ';', or ':'
129+
E241, # multiple spaces after ','
130+
W503, # line break before binary operator
131+
W504 # line break after binary operator
132+
133+
max-line-length = 160
134+
135+
show_source = True
136+
137+
statistics = True
138+
139+
exclude =
140+
.git,
141+
__pycache__,

.github/scripts/check_versions.sh renamed to .github/scripts/check_lib_versions.sh

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,6 @@ check_version_format() {
1313
return 0
1414
}
1515

16-
if [ $# -lt 1 ]; then
17-
latest_version="0.0.0"
18-
echo "Don't get the lastest version, use \"0.0.0\" as default"
19-
else
20-
# Get the first input parameter as the version to be compared
21-
latest_version="$1"
22-
# Check the version format
23-
check_version_format "${latest_version}"
24-
result=$?
25-
if [ ${result} -ne 0 ]; then
26-
echo "The latest release version (${latest_version}) format is incorrect."
27-
exit 1
28-
fi
29-
fi
30-
31-
# Specify the directory path
32-
target_directory="./"
33-
34-
echo "Checking directory: ${target_directory}"
35-
3616
# Function: Check if a file exists
3717
# Input parameters: $1 The file to check
3818
# Return value: 0 if the file exists, 1 if the file does not exist
@@ -68,6 +48,32 @@ compare_versions() {
6848
return 0
6949
}
7050

51+
# Get the latest release version
52+
latest_version="v0.0.0"
53+
for i in "$@"; do
54+
case $i in
55+
--latest_version=*)
56+
latest_version="${i#*=}"
57+
shift
58+
;;
59+
*)
60+
;;
61+
esac
62+
done
63+
# Check the version format
64+
check_version_format "${latest_version}"
65+
result=$?
66+
if [ ${result} -ne 0 ]; then
67+
echo "The latest release version (${latest_version}) format is incorrect."
68+
exit 1
69+
fi
70+
echo "Get the latest release version: ${latest_version}"
71+
72+
# Specify the directory path
73+
target_directory="./"
74+
75+
echo "Checking directory: ${target_directory}"
76+
7177
echo "Checking file: library.properties"
7278
# Check if "library.properties" file exists
7379
check_file_exists "${target_directory}/library.properties"

.github/workflows/build_test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build:
1010
strategy:
1111
matrix:
12-
idf_ver: ["v4.4.5", "v5.0"]
12+
idf_ver: ["v5.0"]
1313
idf_target: ["esp32"]
1414
runs-on: ubuntu-20.04
1515
container: espressif/idf:${{ matrix.idf_ver }}
@@ -25,4 +25,6 @@ jobs:
2525
export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
2626
export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes"
2727
export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}"
28-
idf.py build
28+
idf.py build
29+
rm -rf sdkconfig build managed_components dependencies.lock
30+
idf.py -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.ci.cxx_exceptions" build

.github/workflows/check_versions.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ jobs:
2727
echo "url: ${{ steps.last_release.outputs.url }}"
2828
- name: Check & Compare versions
2929
run: bash ./.github/scripts/check_versions.sh ${{ steps.last_release.outputs.tag_name }}
30-

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-python@v2
14-
- uses: pre-commit/action@v2.0.3
14+
- uses: pre-commit/action@v2.0.3
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Push components to Espressif Component Service
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
upload_components:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@master
13+
with:
14+
submodules: 'recursive'
15+
- name: Upload components to component service
16+
uses: espressif/upload-components-ci-action@v1
17+
with:
18+
name: "esp-lib-utils"
19+
namespace: "espressif"
20+
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}

.pre-commit-config.yaml

Lines changed: 100 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,104 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
14
repos:
2-
- repo: https://github.com/igrr/astyle_py.git
3-
rev: master
5+
- repo: https://github.com/igrr/astyle_py.git
6+
rev: v1.0.5
47
hooks:
5-
- id: astyle_py
8+
- id: astyle_py
69
args: ['--style=otbs', '--attach-namespaces', '--attach-classes', '--indent=spaces=4', '--convert-tabs', '--align-pointer=name', '--align-reference=name', '--keep-one-line-statements', '--pad-header', '--pad-oper']
710

8-
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v4.3.0
10-
hooks:
11-
- id: trailing-whitespace
12-
types_or: [c, c++]
13-
- id: end-of-file-fixer
14-
types_or: [c, c++]
15-
- id: check-merge-conflict
16-
- id: mixed-line-ending
17-
types_or: [c, c++]
18-
args: ['--fix=lf']
19-
description: Forces to replace line ending by the UNIX 'lf' character
20-
21-
- repo: https://github.com/espressif/check-copyright/
22-
rev: v1.0.3
23-
hooks:
24-
- id: check-copyright
25-
args: ['--config', 'check_copyright_config.yaml']
11+
- repo: https://github.com/espressif/check-copyright/
12+
rev: v1.0.3
13+
hooks:
14+
- id: check-copyright
15+
args: ['--config', 'check_copyright_config.yaml']
16+
17+
- repo: https://github.com/PyCQA/flake8
18+
rev: 5.0.4
19+
hooks:
20+
- id: flake8
21+
types: [python]
22+
args: ['--config=.flake8', '--tee', '--benchmark']
23+
24+
- repo: https://github.com/pre-commit/pre-commit-hooks
25+
rev: v4.6.0
26+
hooks:
27+
- id: trailing-whitespace
28+
# note: whitespace exclusions use multiline regex, see https://pre-commit.com/#regular-expressions
29+
# items are:
30+
# 1 - some file extensions
31+
# 2 - any file matching *test*/*expected* (for host tests, if possible use this naming pattern always)
32+
# 3 - any file with known-warnings in the name
33+
# 4 - any directory named 'testdata'
34+
# 5 - protobuf auto-generated files
35+
exclude: &whitespace_excludes |
36+
(?x)^(
37+
.+\.(md|rst|map|bin)|
38+
.+test.*\/.*expected.*|
39+
.+known-warnings.*|
40+
.+\/testdata\/.+|
41+
.*_pb2.py|
42+
.*.pb-c.h|
43+
.*.pb-c.c|
44+
.*.yuv
45+
)$
46+
- id: end-of-file-fixer
47+
exclude: *whitespace_excludes
48+
- id: check-executables-have-shebangs
49+
- id: check-shebang-scripts-are-executable
50+
- id: mixed-line-ending
51+
args: ['-f=lf']
52+
- id: double-quote-string-fixer
53+
- id: no-commit-to-branch
54+
name: Do not use more than one slash in the branch name
55+
args: ['--pattern', '^[^/]*/[^/]*/']
56+
- id: no-commit-to-branch
57+
name: Do not use uppercase letters in the branch name
58+
args: ['--pattern', '^[^A-Z]*[A-Z]']
59+
60+
- repo: https://github.com/espressif/conventional-precommit-linter
61+
rev: v1.8.0
62+
hooks:
63+
- id: conventional-precommit-linter
64+
stages: [commit-msg]
65+
args:
66+
- --subject-min-length=15
67+
- --body-max-line-length=200
68+
69+
- repo: https://github.com/codespell-project/codespell
70+
rev: v2.3.0
71+
hooks:
72+
- id: codespell
73+
args: ['-w' , '--config', '.codespellrc']
74+
75+
- repo: local
76+
hooks:
77+
- id: check-executables
78+
name: Check File Permissions
79+
entry: tools/check_executables.py --action executables
80+
language: python
81+
types: [executable]
82+
exclude: '\.pre-commit/.+'
83+
- id: check-executable-list
84+
name: Validate executable-list.txt
85+
entry: tools/check_executables.py --action list
86+
language: python
87+
pass_filenames: false
88+
always_run: true
89+
90+
- repo: local
91+
hooks:
92+
- id: check-file-versions
93+
name: Update when versions change
94+
entry: python3 tools/check_file_version.py ./
95+
language: system
96+
files: '(library.properties|.*esp_utils_versions.h)'
97+
98+
- repo: local
99+
hooks:
100+
- id: check-library-versions
101+
name: Check library versions
102+
entry: ./.github/scripts/check_lib_versions.sh
103+
language: system
104+
files: '(idf_component.yml|library.properties)'

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ChangeLog
22

3-
## v0.0.1 - [xxx]
3+
## v0.1.0
44

55
### Enhancements:
66

7-
* [xxx]
7+
* feat(repo): initialize with modules 'check', 'log' and 'utils'

0 commit comments

Comments
 (0)