Bug 52458 - enable more linting
enable more linting
Status: VERIFIED FIXED
Product: UCS@school
Classification: Unclassified
Component: General
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v8-errata
Assigned To: Daniel Tröder
Tobias Wenzel
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-12-04 10:28 CET by Daniel Tröder
Modified: 2021-02-16 14:35 CET (History)
2 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2020-12-04 10:28:54 CET
The flake8 linter is currently configured to test only very few things.
Configure more source code validation.
Comment 1 Florian Best univentionstaff 2020-12-04 11:16:06 CET
You don't mean the flake8 plugin of ucslint, right?
Do you have a UCS@school flake8 pipeline?
Comment 2 Daniel Tröder univentionstaff 2020-12-07 09:04:23 CET
(In reply to Florian Best from comment #1)
> You don't mean the flake8 plugin of ucslint, right?
> Do you have a UCS@school flake8 pipeline?
We have a *pre-commit hook* that verifies:
* Python import sorting (isort)
* Python code formatting (black)
* Python code style / static checks (flake8)

The current flake8 configuration is rather minimal. In the past we wanted to introduce it without to much changes at once. This bug is about activating more checks in flake8.
Comment 3 Daniel Tröder univentionstaff 2021-01-21 18:26:30 CET
The git branch dtroeder/52458_more_linting contains 46 commits that enable step by step more flake8 checks and other linters.

The last 3 commits (from today) have not yet been reviewed.

All commits have been merged to '4.4' and squashed into 1 commit, which was added to the git-hyper-blame ignore list:

[4.4 b40ff404a] Bug #52458: enable most flake8 tests and add more linters
[4.4 fa6d190fb] Bug #52458: add 'more linters' commit to git-hyper-blame ignore list

No packages will be rebuilt.
Comment 4 Tobias Wenzel univentionstaff 2021-01-22 08:53:34 CET
QA → All OK → Verify

Configs → OK
Code changes → OK 
Merge without conflicts → OK
git hyperblame → OK

as mentioned, the packages are not rebuild.
Comment 5 Daniel Tröder univentionstaff 2021-02-15 14:22:26 CET
The cleanup of imports in file ucs-school-import/modules/ucsschool/http_api/import_api/models.py lead to an ImportError from serializers.py, because JOB_SCHEDULED was not imported in models.py anymore (where it was not needed).

The import in serializers.py has been fixed and the package rebuilt (it had been build for Bug 52770):

[4.4] 9111129ce Bug #52458: fix ImportError after cleanup of imports
[4.4] 41c316978 Bug #52458: advisory update
Comment 6 Daniel Tröder univentionstaff 2021-02-16 14:35:55 CET
Another failed test (215_import-users_illegal_chars_in_username_v2) from introducing more linting fixed:

[4.4 7eb3747cd] Bug #52458: fix ValueError raised by doctest (invalid option: '#')
[4.4 333f955a8] Bug #52458: advisory update