Skip to content

Commit

Permalink
build: Codespell setup & PyLint W1401
Browse files Browse the repository at this point in the history
Add codespell config. Activate PyLint warning W1401 (anomalous-backslash-in-string).
  • Loading branch information
buhtz authored Nov 16, 2023
1 parent 969ab4b commit ec13884
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 66 deletions.
29 changes: 29 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[codespell]
# Folders and files to skip
skip = .codespellrc,*.po,Makefile,*.desktop,.git,__pycache__,*.pyc,languages.py
# Print N lines of surrounding context
context = 1
# Check hidden files also (empty means True)
check-hidden=
# Print number of errors as last line on stderr (empty means True)
count=

# Dictionaries to use (default: "clear,rare"). Current: all.
builtin = clear,rare,informal,usage,code,names,en-GB_to_en-US

# Allowed (ignored) words
ignore-words-list=master,whitelist,manuel,dum
# Allowed (ignored) words in URLs and URIs
uri-ignore-words-list=mitre

# Good to know about allowed/ignored words:
# Codespell acts a bit unusual when it comes to case-sensitivity.
# By default the word "Manuel" is an error and codespell recommends to
# modify it into "Manual". Tu allow this German name "Manuel" we have to
# add "manual" (lower case!) to the "ignore-words-list". The upper-case
# version do not work.
# See: https://github.com/codespell-project/codespell/issues/3210

# Simulate "# noqa" and ignore all lines with "# codespell-ignore" at the end.
# Credits: https://github.com/codespell-project/codespell/issues/1212#issuecomment-1721152455
ignore-regex=.*# codespell-ignore$
14 changes: 8 additions & 6 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
Back In Time

Version 1.4.2-dev (development of upcoming release)
* Fix bug: RTE: module 'qttools' has no attribute 'initate_translator' with encFS when prompting the user for a password (#1553)
* Fix bug: RTE: module 'qttools' has no attribute 'initate_translator' with encFS when prompting the user for a password (#1553).
* Build: Use PyLint in unit testing to catch E1101 (no-member) errors.
* Build: Activate PyLint warning W1401 (anomalous-backslash-in-string).
* Build: Add codespell config.
* Translation: Minor modifications in source strings and updating language files.

Version 1.4.1 (2023-10-01)
* Dependency: Add "qt translations" to GUI runtime dependencies (#1538)
* Dependency: Add "qt translations" to GUI runtime dependencies (#1538).
* Build: Unit tests do generically ignore all instead of well-known warnings now (#1539).
* Build: Warnings about missing Qt translation now are ignored while testing (#1537).
* Fix bug: GUI didn't start when "show hidden files" button was on (#1535).
Expand Down Expand Up @@ -113,7 +115,7 @@ Version 1.2.0 (2019-04-27)
* Fix bug: 23:00 is missing in the list of every day hours (https://github.com/bit-team/backintime/issues/736)
* Fix bug: ssh-agent output changed (https://github.com/bit-team/backintime/issues/840)
* remove unused and undocumented userscript plugin
* Fix bug: exception on making backintime folder world writeable (https://github.com/bit-team/backintime/issues/812)
* Fix bug: exception on making backintime folder world writable (https://github.com/bit-team/backintime/issues/812)
* Fix bug: stat free space for snapshot folder instead of backintime folder (https://github.com/bit-team/backintime/issues/733)
* add contextmenu for logview dialog which can copy, exclude and decode lines
* move progressbar under statusbar
Expand Down Expand Up @@ -250,7 +252,7 @@ Version 1.1.10 (2016-01-09)
* Fix bug: FileNotFoundError while starting pw-cache from source
* continue an unfinished new_snapshot if possible (https://github.com/bit-team/backintime/issues/400)
* Fix bug: suppress warning about failed inhibit suspend if run as root (https://github.com/bit-team/backintime/issues/500)
* Fix bug: UI blocked/greyed out while removing snapshot (https://github.com/bit-team/backintime/issues/487)
* Fix bug: UI blocked/grayed out while removing snapshot (https://github.com/bit-team/backintime/issues/487)
* Fix bug: pw-cache failed on leftover PID file, using ApplicationInstance now (https://github.com/bit-team/backintime/issues/468)
* Fix bug: failed to parse some arguments (https://github.com/bit-team/backintime/issues/492)
* Fix bug: failed to start GUI if launched from systray icon
Expand All @@ -268,7 +270,7 @@ Version 1.1.8 (2015-09-28)
* show current app name and profile ID in syslog (https://launchpad.net/bugs/906213)
* Fix bug: BiT freeze when activate 'Decode path' in 'Snapshot Log View'
* Show 'Profiles' dropdown only in 'Last Log Viewer', add 'Snapshots' dropdown in 'Snapshot Log Viewer' (https://launchpad.net/bugs/1478219)
* Fix bug: empty grey window appears when starting the gui as root (https://launchpad.net/bugs/1493020)
* Fix bug: empty gray window appears when starting the gui as root (https://launchpad.net/bugs/1493020)
* do not restore permission if they are identical with current permissions
* Fix bug: gnu_find_suffix_support doesn't set back to True (https://launchpad.net/bugs/1487781)
* security issue: do not run user-callback in a shell
Expand Down Expand Up @@ -335,7 +337,7 @@ Version 1.1.4 (2015-03-22)
* Fix bug: OSError in free_space; add alternate method to get free space
* add bash-completion
* Fix bug: ugly theme while running as root on Gnome based DEs (https://launchpad.net/bugs/1418447)
* Fix bug: filename with broken charset throwed UnicodeError exception (https://launchpad.net/bugs/1419694)
* Fix bug: UnicodeError thrown if filename has broken charset (https://launchpad.net/bugs/1419694)
* use 'crontab' instead of 'crontab -' to read from stdin (https://launchpad.net/bugs/1419466)

Version 1.1.2 (2015-02-04)
Expand Down
4 changes: 2 additions & 2 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ permissions were set to `-rw-r--r--`. In 1.2.0 rsync is executed with `--perms`
option which tells rsync to preserve the source file permission.
That's why so many files seem to be changed.

If you don't like the new behaviour, you can use "Expert Options"
If you don't like the new behavior, you can use "Expert Options"
-> "Paste additional options to rsync" to add the value
`--no-perms --no-group --no-owner` in that field.

Expand Down Expand Up @@ -914,7 +914,7 @@ For detailed setup instructions see the [how to setup openssh for unit tests](co
The goal is to log into the SSH server on your local computer via `ssh localhost` without using
a password:

- Generate an RSA keypair executing `ssh-keygen`. Use the default file name
- Generate an RSA key pair executing `ssh-keygen`. Use the default file name
and don't use a passphrase for the key.
- Populate the public key to the server executing `ssh-copy-id`.
- Make the `ssh` instance run.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You only need to specify 3 things:
A small team (Christian Buhtz, Michael Büker and Jürgen Altfeld)
has started in summer 2022 to get things moving again after the
development of this project has been dormant for a while.
We do the development in our spare time and have to prioritise so
We do the development in our spare time and have to prioritize so
stick with us, we all ♥️ _Back In Time_. 😁

We are currently focusing on fixing
Expand Down
2 changes: 1 addition & 1 deletion common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ def removeOldCrontab(self, crontab):
if not self.SYSTEM_ENTRY_MESSAGE in crontab:
#Then the system entry message has not yet been used in this crontab
#therefore we assume all entries are system entries and clear them all.
#This is the old behaviour
#This is the old behavior
logger.debug("Clearing all Back In Time entries", self)
return [x for x in crontab if not 'backintime' in x]
else:
Expand Down
2 changes: 1 addition & 1 deletion common/create-manpage-backintime-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
other information. The founder of that script @Germar gave a detailed
description about that script in #1354.
The script reads every line and tries to analyse it:
The script reads every line and tries to analyze it:
- It searches for `DEFAULT` and puts those into a `dict` for later replacing
the variable with the value.
- If that didn't match it will look for lines starting with `#?` which is
Expand Down
73 changes: 36 additions & 37 deletions common/doc-dev/BiT_release_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,34 @@ using a "feature" branch and sending a pull request asking for a review.

## Preconditions for a new release

- Developers agreed on the new version number
- Most-recent translations were merged into `dev` branch
- `dev` version was tested (CLI in `common` and GUI in `qt`) and testers/developers agreed on "readiness to be released"
- Full CI build pipeline matrix was activated, see:
https://github.com/bit-team/backintime/pull/1529
- Developers agreed on the new version number.
- Most-recent translations were merged into `dev` branch. See the [localization docu](2_localization.md).
- Full CI build pipeline matrix is activate (see [#1529](https://github.com/bit-team/backintime/issues/1529)).
- `dev` version was tested (CLI in `common` and GUI in `qt`) and testers/developers agreed on "readiness to be released".


## TLDR ;-)

- Create a new branch in your clone for the new release candidate
- Update `VERSION` file
- Update `CHANGES` file
- Execute the script `./updateversion.sh`
- Create a new branch in your clone for the new release candidate.
- Update `VERSION` file.
- Update `CHANGES` file.
- Execute the script `./updateversion.sh` to update the version numbers (based on `VERSION` file) in several files.
- Update the "as at" date in the man page files `backintime.1` and `backintime-askpass.1`.
- Autogenerate and update the man page file `backintime-config.1` by executing the script `common/create-manapge-backintime-config.py`.
- Update `README.md` file
- Commit
- Open a new pull request (PR)
- Update `README.md` file.
- Run `codespell` to check for common spelling errors.
- Commit the changes.
- Open a new pull request (PR) for review by other developers.

When the PR is merged:
- Create a new tar archive (eg. `backintime-1.4.0.tar.gz`) with `./make-tarball.sh`
- Create a new release in Github (attaching above tar archive)
- Update `VERSION` and `CHANGES` for the `dev` branch
- Create a new tar archive (eg. `backintime-1.4.0.tar.gz`) with `./make-tarball.sh`.
- Create a new release in Github (attaching above tar archive).
- Update `VERSION` and `CHANGES` for the `dev` branch.


## Step by step

- Announce code freeze on `dev` branch to all active developers via email
- Announce code freeze on `dev` branch to all active developers via email.

- Check that Travis CI did successfully build the latest `dev` branch commit:

Expand Down Expand Up @@ -80,7 +80,7 @@ When the PR is merged:
```
- Use a linter like [`pylint`](https://pypi.org/project/pylint/) to identify code errors that are not obvious but
may be found only (too late) at run-time, eg. object name typos (see eg. #1553).
may be found only (too late) at run-time, eg. object name typos (see e.g. [#1553](https://github.com/bit-team/backintime/issues/1553)).
- Update the `CHANGES` text file in the project's root folder:
Expand All @@ -106,15 +106,15 @@ When the PR is merged:
- Execute the script `./updateversion.sh` in the project's root folder
to automatically update the version number in multiple files
using the version number from the `VERSION` file
(so you do not forget to update one file ;-)
(so you do not forget to update one file ;-).
- BiT CLI config in `common/config.py`
- Sphinx config in `common/doc-dev/conf.py`
- man pages in `common/man/C/backintime*.1` and `qt/man/C/backintime*.1`
- changelog to build a debian package in `debian/changelog`
(this will be deprecated once we give up or separate the packaging for distros)
- Check that the version numbers have been update by opening some of the above files
- Check that the version numbers have been update by opening some of the above files.
- Update the "as at" date in the man page files (in `common/man/C/backintime*.1` and `qt/man/C/backintime*.1`) manually by changing
the month and year in the first line that looks like this:
Expand Down Expand Up @@ -159,19 +159,21 @@ When the PR is merged:
make
```
- Do a manual smoke and UAT ("user acceptance test") of the GUI
- Execute [`codespell`](https://pypi.org/project/codespell) in the repositories root folder to check for common spelling errors.
- Do a manual smoke and UAT ("user acceptance test") of the GUI.
- If you find bugs:
- Open an issue
- Decide if you want to fix this in the release candidate
- If you fix it in the release candidate: Update the CHANGES file (add the issue number + description)
- Open an issue.
- Decide if you want to fix this in the release candidate.
- If you fix it in the release candidate: Update the CHANGES file (add the issue number + description).
- If you don't fix it (eg. too risky) and it is a HIGH bug:
- Add the bug to the [Known Problems and Workarounds](https://github.com/bit-team/backintime#known-problems-and-workarounds)
section of `README.md` (of the release candidate branch) and describe
a workaround (if any)
a workaround (if any).
- Commit and push, if no "show-stopping" bug exists
- Commit and push, if no "show-stopping" bug exists.
Note: To push your release candidate branch into a new remote branch use:
```
Expand All @@ -180,21 +182,21 @@ When the PR is merged:
- Open a new pull request for your pushed release candidate branch:
- Add all developers as reviewers
- Add all developers as reviewers.
- Mention bugs (and status) discovered during preparation of the release candidate
in the description
in the description.
- Fix review findings and push the changes again to update the pull request
- Fix review findings and push the changes again to update the pull request.
- Finally check the Travis CI status of the pull request (everything must be green)
- Finally check the Travis CI status of the pull request (everything must be green).
- Once all the PR reviewer approved the PR do a squash-merge (= all changes are "squashed" into one commit)
into the `dev` branch using a commit message like
`Release candidate for v1.4.1 (Oct. 1, 2023) `
`Release candidate for v1.4.1 (Oct. 1, 2023)`
- Wait for the final Travis CI build on the `dev` branch and check
if everything is OK to proceed with the release
if everything is OK to proceed with the release.
- Create the tarball archive files to be attached as "binaries" to the release:
- Update the `dev` branch
Expand Down Expand Up @@ -280,12 +282,7 @@ When the PR is merged:
### "Read the docs" code documentation
The "Read the docs" site is automatically updated with every commit on the `dev` branch:
https://github.com/bit-team/backintime/pull/1533#issuecomment-1720897669
https://readthedocs.org/projects/backintime-dev/
The "Read the docs" site is automatically updated with every commit on the `dev` branch. See [Issue #1533](https://github.com/bit-team/backintime/pull/1533#issuecomment-1720897669) and the [_backintime-dev_ project](https://readthedocs.org/projects/backintime-dev) at Read the docs.
### Building `deb` package files
Expand All @@ -294,3 +291,5 @@ We do no longer maintain and publish `deb` package files.
To build your own `deb` file see:
https://github.com/bit-team/backintime/blob/dev/CONTRIBUTING.md#build-own-deb-file
<sub>November 2023</sub>
6 changes: 1 addition & 5 deletions common/doc-dev/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@
copyright = '2016, Germar Reitze'
author = 'Germar Reitze'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
# Don't edit this variable. It is updated automatically by "updateversion.sh".
version = '1.4.2-dev'
# The full version, including alpha/beta/rc tags.
release = version # '1.3.3-dev'
Expand Down
3 changes: 2 additions & 1 deletion common/encfstools.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,8 @@ def __init__(self, cfg, string = True):
#precompile some regular expressions
host, port, user, path, cipher = cfg.sshHostUserPortPathCipher()
#replace: --exclude"<crypted_path>" or --include"<crypted_path>"
self.re_include_exclude = re.compile(r'(--(?:ex|in)clude=")(.*?)(")')
self.re_include_exclude = re.compile(
r'(--(?:ex|in)clude=")(.*?)(")') # codespell-ignore

#replace: 'USER@HOST:"PATH<crypted_path>"'
self.re_remote_path = re.compile(r'(\'%s@%s:"%s)(.*?)("\')' %(user, host, path))
Expand Down
4 changes: 2 additions & 2 deletions common/pluginmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
from exceptions import StopException

class Plugin:
""" Interface methods to customize behaviour for different backup steps
""" Interface methods to customize behavior for different backup steps
Back In Time allows to inform plugins (implemented in Python
files) about different steps ("events") in the backup process.
Plugins may implement special behaviour to predefined
Plugins may implement special behavior to predefined
"events" that are declared in this interface class
as methods.
Expand Down
2 changes: 1 addition & 1 deletion common/plugins/usercallbackplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


class UserCallbackPlugin(pluginmanager.Plugin):
""" Executes a script file at different backup steps to customize behaviour
""" Executes a script file at different backup steps to customize behavior
Back In Time allows to inform plugins (implemented in Python
files) about different steps ("events") in the backup process
Expand Down
2 changes: 1 addition & 1 deletion common/test/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
tools.registerBackintimePath('qt', 'plugins')

TMP_FLOCK = NamedTemporaryFile(prefix='backintime', suffix='.flock')
# A simple (local) RSA keypair via "ssh-keygen" and activate it
# A simple (local) RSA key pair via "ssh-keygen" and activate it
# via "ssh-copy-id localhost".
PRIV_KEY_FILE = pathlib.Path.home() / '.ssh' / 'id_rsa'
PUBLIC_KEY_FILE = PRIV_KEY_FILE.with_suffix('.pub')
Expand Down
2 changes: 1 addition & 1 deletion common/test/test_backintime.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_local_snapshot_is_successful(self):
Development notes (by Buhtz):
Multiple tests do compare return codes and output on stdout. The
intention might be an integration tests. But the asserts not qualified
to answer the important questions and observe the intended behaviour.
to answer the important questions and observe the intended behavior.
Heavy refactoring is needed. But because of the "level" of that tests
it won't happen in the near future.
"""
Expand Down
4 changes: 2 additions & 2 deletions common/test/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def test_with_pylint(self):
'--disable=all'
]

# Explicite activate checks
# Explicit activate checks
err_codes = [
'E1101', # no-member
# 'W0613', # unused-argument
'W1401', # anomalous-backslash-in-string (invalid escape sequence)
]
cmd.append('--enable=' + ','.join(err_codes))

Expand Down
4 changes: 2 additions & 2 deletions common/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def get_available_language_codes():


def get_language_names(language_code):
"""Return a list with language names in three different flavours.
"""Return a list with language names in three different flavors.
Language codes from `get_available_language_codes()` are combined with
`languages.language_names` to prepare the list.
Expand Down Expand Up @@ -264,7 +264,7 @@ def get_language_names(language_code):


def get_native_language_and_completeness(language_code):
"""Return the language name in its native flavour and the completeness of
"""Return the language name in its native flavor and the completeness of
its translation in percent.
Args:
Expand Down
4 changes: 2 additions & 2 deletions qt/test/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def test_with_pylint(self):
'--disable=all'
]

# Explicite activate checks
# Explicit activate checks
err_codes = [
'E1101', # no-member
# 'W0613', # unused-argument
'W1401', # anomalous-backslash-in-string (invalid escape sequence)
]
cmd.append('--enable=' + ','.join(err_codes))

Expand Down
2 changes: 1 addition & 1 deletion update_language_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def create_languages_file():


def create_language_names_dict(language_codes: list) -> dict:
"""Create dict of language names in different flavours.
"""Create dict of language names in different flavors.
The dict is used in the LanguageDialog to display the name of
each language in the UI's current language and the language's own native
representation.
Expand Down

0 comments on commit ec13884

Please sign in to comment.