Add a basic pre-commit config

Also fix some things it cleaned up in default config.
This commit is contained in:
Dan Smith 2023-10-02 17:02:17 -07:00 committed by Dan Smith
parent ffd2e63e23
commit 68f6a46f5c
10 changed files with 64 additions and 46 deletions

23
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,23 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
exclude_types:
- binary
exclude: \.img$
- id: end-of-file-fixer
exclude_types:
- binary
exclude: \.img$
- id: check-yaml
- repo: local
hooks:
- id: pep8
verbose: true
name: pep8
entry: env PATH=.tox/style/bin python tools/cpep8.py
files: \.py$
language: python

View File

@ -1,11 +1,11 @@
# lint Python modules using external checkers.
#
#
# This is the main checker controling the other ones and the reports
# generation. It is itself both a raw checker and an astng checker in order
# to:
# * handle message activation / deactivation at the module level
# * handle some basic but necessary stats'data (number of classes, methods...)
#
#
[MASTER]
# Specify a configuration file.
@ -102,7 +102,7 @@ comment=no
# * dangerous default values as arguments
# * redefinition of function / method / class
# * uses of the global statement
#
#
[BASIC]
# Required attributes for module, separated by a comma
@ -152,7 +152,7 @@ bad-functions=map,filter,apply,input
# try to find bugs in the code using type inference
#
#
[TYPECHECK]
# Tells wether missing members accessed in mixin class should be ignored. A
@ -173,7 +173,7 @@ acquired-members=REQUEST,acl_users,aq_parent
# * undefined variables
# * redefinition of variable from builtins or from an outer scope
# * use of variable before assigment
#
#
[VARIABLES]
# Tells wether we should check for unused import in __init__ files.
@ -190,7 +190,7 @@ additional-builtins=
# checks for sign of poor/misdesign:
# * number of methods, attributes, local variables...
# * size, complexity of functions, methods
#
#
[DESIGN]
# Maximum number of arguments for function / method
@ -228,7 +228,7 @@ max-public-methods=20
# * attributes not defined in the __init__ method
# * supported interfaces implementation
# * unreachable code
#
#
[CLASSES]
# List of interface methods to ignore, separated by a comma. This is used for
@ -244,7 +244,7 @@ defining-attr-methods=__init__,__new__,setUp
# * relative / wildcard imports
# * cyclic imports
# * uses of deprecated modules
#
#
[IMPORTS]
# Deprecated modules which should not be used, separated by a comma
@ -266,7 +266,7 @@ int-import-graph=
# checks for:
# * warning notes in the code like FIXME, XXX
# * PEP 263: source code with non ascii character but no encoding declaration
#
#
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
@ -278,7 +278,7 @@ notes=FIXME,XXX,TODO
# * strict indentation
# * line length
# * use of <> instead of !=
#
#
[FORMAT]
# Maximum number of characters on a single line.
@ -295,7 +295,7 @@ indent-string=' '
# checks for similarities and duplicated code. This computation may be
# memory / CPU intensive, so you should disable it if you experiments some
# problems.
#
#
[SIMILARITIES]
# Minimum lines number of a similarity.

31
INSTALL
View File

@ -1,7 +1,7 @@
This file describes the installation of Chirp without package management
on Linux and other Unix-like operating systems. This sort of thing may
be your only choice because 1) a package has not yet been made for your
OS or distribution, 2) the packaged version is obsolete, or 3) you want
This file describes the installation of Chirp without package management
on Linux and other Unix-like operating systems. This sort of thing may
be your only choice because 1) a package has not yet been made for your
OS or distribution, 2) the packaged version is obsolete, or 3) you want
to try a daily build.
@ -14,7 +14,7 @@ python-serial
python-suds (optional)
python-support
For Redhat, Fedora, CentOS and related systems, the following packages
For Redhat, Fedora, CentOS and related systems, the following packages
are required: (This list is incomplete. Please submit corrections.)
python
pygtk2
@ -29,24 +29,23 @@ python-libxml2
libxslt-python
python-suds-jurko
Once these packages are installed, you can run Chirp directly from the
distribution directory by typing "./chirpw". If you want to install it
Once these packages are installed, you can run Chirp directly from the
distribution directory by typing "./chirpw". If you want to install it
properly, type this:
sudo python setup.py install --record files.txt
This will install the package and create a list of files that were
added to your system. If you want to deinstall Chirp, type this:
This will install the package and create a list of files that were
added to your system. If you want to deinstall Chirp, type this:
sudo xargs -0 rm -rf < files.txt
This will cause rm(1) to take its list of arguments from the file named
"files.txt" and remove those files from the system. If you forgot to
create "files.txt", you can simply reinstall the way it is shown here
This will cause rm(1) to take its list of arguments from the file named
"files.txt" and remove those files from the system. If you forgot to
create "files.txt", you can simply reinstall the way it is shown here
and continue on your way.
Note: This will not uninstall directories created by the installation of
Chirp. Presence of these empty directories shouldn't be a problem, but
if they are, it's easy to go through the files.txt file, identify them,
Note: This will not uninstall directories created by the installation of
Chirp. Presence of these empty directories shouldn't be a problem, but
if they are, it's easy to go through the files.txt file, identify them,
and remove them.

View File

@ -28,7 +28,7 @@ the "Browser" tab in the left sidebar, which is visible when the Developer
tools are enabled.
The default size is 10. Values less than 4, greater than 144, or not
recognized as an integer will result in a log message and the default
recognized as an integer will result in a log message and the default
size will be used.
========
@ -37,7 +37,7 @@ This specifies the fontsize used in the hex dump/diff display which is
invoked by selecting View -> Developer -> Diff tabs.
The default size is 11. Values less than 4, greater than 144, or not
recognized as an integer will result in a log message and the default
recognized as an integer will result in a log message and the default
size will be used.
========
@ -60,5 +60,3 @@ Exceptions that have been observed in testing formats which are
invalid in this context are caught, and the default format is used.
========

View File

@ -1,8 +1,8 @@
name: chirp-snap
summary: A free, open-source tool for programming your amateur radio
description: |
CHIRP is a free, open-source tool for programming your amateur radio.
It supports a large number of manufacturers and models, as well as
CHIRP is a free, open-source tool for programming your amateur radio.
It supports a large number of manufacturers and models, as well as
provides a way to interface with multiple data sources and formats.
adopt-info: chirp
@ -24,7 +24,7 @@ apps:
command: bin/chirp
desktop: lib/python3.10/site-packages/chirp/share/chirp.desktop
extensions:
# WARNING: gnome extension is incompatible with python apps.
# WARNING: gnome extension is incompatible with python apps.
- gnome
plugs:
- home

View File

@ -465,21 +465,22 @@ For the purposes of the Python 3 effort, a "tested" radio means
at least the following procedure was followed:
1. Download from the radio
1. Make some change to a memory
1. If the radio has settings support, make sure settings load and tweak one setting
1. If the radio has settings support, make sure settings load and tweak
one setting
1. Upload to the radio
1. Confirm that the changes stick and look correct, or at least are not a
regression from the master py2 branch.
The drivers are all passing the automated tests, but tests with real hardware
and serial ports is important, especially around bytes-vs-string safety.
The drivers are all passing the automated tests, but tests with real
hardware and serial ports is important, especially around bytes-vs-string
safety.
To update this document, add/edit entries in `tests/py3_driver_testers.txt` and
then run `tox -e makesupported`. Commit the result (including the changes to this `.md`
file) and submit a PR.
To update this document, add/edit entries in `tests/py3_driver_testers.txt`
and then run `tox -e makesupported`. Commit the result (including the
changes to this `.md` file) and submit a PR.
The "Byte Clean" flag refers to whether or not the radio has set the
`NEEDS_COMPAT_SERIAL = False` flag on the radio class, and thus uses
`MemoryMapBytes` exclusively internally. Whenever possible, all radios
that are fixed for py3 should do so with this flag set to False and with
the byte-native memory map.

View File

@ -32,4 +32,3 @@ serialsniff: serialsniff.c
clean:
$(REMOVE) serialsniff *~ *.o *.bak core tags shar a.out

View File

@ -92,4 +92,3 @@ for usbserial in /sys/class/tty/ttyUSB*; do
break
fi
done

View File

@ -208,8 +208,7 @@ def main():
`NEEDS_COMPAT_SERIAL = False` flag on the radio class, and thus uses
`MemoryMapBytes` exclusively internally. Whenever possible, all radios
that are fixed for py3 should do so with this flag set to False and with
the byte-native memory map.
"""),
the byte-native memory map."""),
file=output)
for driver, (tester, tested) in testers.items():

View File

@ -146,7 +146,7 @@ int saferead(int fd, char *buf, int len)
if ((val.it_value.tv_sec == 0) &&
(val.it_value.tv_usec == 0)) {
if (!quiescent)
printf("Timeout\n");
printf("Timeout\n");
break;
}