Bug 52817 - sync code and linting of 4.4 branch to kelvin branch
Summary: sync code and linting of 4.4 branch to kelvin branch
Status: CLOSED FIXED
Alias: None
Product: UCS@school
Classification: Unclassified
Component: HTTP-API (Kelvin)
Version: UCS@school 4.4
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: Daniel Tröder
QA Contact: Ole Schwiegert
URL:
Keywords:
Depends on:
Blocks: 52950
  Show dependency treegraph
 
Reported: 2021-02-20 16:16 CET by Daniel Tröder
Modified: 2021-06-30 16:12 CEST (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): Cleanup
Customer ID:
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 2021-02-20 16:16:13 CET
The code in the 4.4 git branch is formatted in a certain way and lots of linters are used to check both formatting and for programming errors.

Introduce those same formatters and linters with the same settings to the Kelvin API git branch to make development work easier and safer.
Comment 1 Daniel Tröder univentionstaff 2021-02-20 16:26:32 CET
The same per-commit hooks and configuration as in 4.4 have been added to the branch "dtroeder/kelvin_pre-commit", branched off from "feature/kelvin".

The files in packages not used by the Kelvin API are being ignored.
Excluded are:
^doc/doc-common/
^doc/manual/
^italc-windows/
^italc/
^ucs-school-branding/
^ucs-school-import/usr/share/ucs-school-import/scripts/ucs-school-import
^ucs-school-info/
^ucs-school-italc/
^ucs-school-l10n-fr/
^ucs-school-ldap-acls-master/
^ucs-school-metapackage/
^ucs-school-netlogon-user-logonscripts/
^ucs-school-netlogon/
^ucs-school-old-homedirs/
^ucs-school-old-sharedirs/
^ucs-school-ox-support/
^ucs-school-radius-802.1x/
^ucs-school-roleshares/
^ucs-school-s4-branch-site/
^ucs-school-selfservice-support/
^ucs-school-ucc-integration/
^ucs-school-umc-
^ucs-school-webproxy/
^ucs-test-ucsschool/
^univention-management-console-module-selective-udm/

The files in ucs-school-lib and ucs-school-import have been reformatted and adhere to all linters except flake8, as those directories will be synced to 4.4 in a separate step. After that, they will also be checked by flake8.

Except for a few Python 2/3 fixes, the commit contains only white space and comment changes:

[1a21ca89f] Bug #52817: introduce same formatting and linting as in the 4.4 branch, except for non-Kelvin packages and ucs-school-lib|ucs-school-import as they will be handled separately

To test the code, copy the repository to a VM and build the docker image there. Then install the Kelvin API app.
Comment 2 Tobias Wenzel univentionstaff 2021-03-10 09:53:10 CET
In share.py get_nt_acls needs lo because the sid is not in UDM. 

There were still lots of "type:" annotations. I took the liberty of converting them in ucs-school-lib automatically and hope that's OK. 

[dtroeder/kelvin_pre-commit] 423a7ddeb Bug #52817: type hints
[dtroeder/kelvin_pre-commit] dafe32fe8 Bug #52817: type hints in validator and share.py

I also found some locations, where udm_obj was used as a dict, which seems not
right.
Comment 3 Daniel Tröder univentionstaff 2021-03-12 16:54:38 CET
More changes… still not gone throug all…

[dtroeder/kelvin_pre-commit] 3b32415a8 Bug #52817: sync from 4.4 (WIP)

Additionally I created a git branch "dtroeder/52817_sync_4.4_kelvin" of "4.4" with changes to the "regular" ucsschool.lib, to make future code comparisons easier:

[a2bfea660] Bug #52817: sync code in 4.4 and kelvin
Comment 4 Daniel Tröder univentionstaff 2021-03-18 13:02:03 CET
Commits have been squashed and merged into 4.4:

[4.4] ed67a9f86 Bug #52817: sync code in 4.4 and kelvin
Comment 5 Ole Schwiegert univentionstaff 2021-03-18 15:03:03 CET
Code Review: OK
Merge: OK
Comment 6 Daniel Tröder univentionstaff 2021-06-30 16:12:32 CEST
Kelvin 1.4.4 has been released.