Bug 132293 - Run pyflakes on python uitest files to find unused imports
Summary: Run pyflakes on python uitest files to find unused imports
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.0.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: bx2
URL:
Whiteboard: target:7.1.0
Keywords: difficultyBeginner, easyHack, skillPython, topicCleanup
Depends on:
Blocks:
 
Reported: 2020-04-21 08:29 UTC by Xisco Faulí
Modified: 2020-09-10 07:28 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2020-04-21 08:29:14 UTC
Use a passive checker like pyflakes or any other out there and remove the warning like 'imported but unused' or 'is assigned to but never used'

From your local LibreOffice directory run 'pyflakes sw' or 'pyflakes sc' or pyflakes uitest...
Comment 1 Julien Nabet 2020-04-21 09:30:13 UTC
Great tool for cleaning py files!
I gave it a try and found interesting errors like:
com/sun/star/wizards/document/OfficeDocument.py:120: undefined name 'IllegalArgumentException'
(it seems the one who converted Java file didn't take into account the type of exception).
Is it ok to fix them or should we let this for newcomers since it's an easyhack?
Comment 2 Julien Nabet 2020-04-21 09:44:51 UTC Comment hidden (obsolete)
Comment 3 Xisco Faulí 2020-04-22 08:38:17 UTC Comment hidden (obsolete)
Comment 4 Julien Nabet 2020-04-22 08:47:30 UTC Comment hidden (obsolete)
Comment 5 Julien Nabet 2020-05-03 14:05:41 UTC
Xisco: any updates here?
Comment 6 Xisco Faulí 2020-05-04 09:17:00 UTC
Let's make it clearer: This easyhacks focuses only on unused python imports
Comment 7 Julien Nabet 2020-05-04 09:22:36 UTC
Thank you for your feedback Xisco, so for the other issues than "Unused imports", indicated by PyFlakes, it can be dealt by anyone.
Comment 8 bx2 2020-05-05 22:34:42 UTC
I am beginning to work on this bug as a training
Comment 9 Commit Notification 2020-09-10 07:28:48 UTC
Ilkyu Ju committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/13e0c7258b28c4c4c4453e38f04d975c01a0f07e

tdf#132293 remove unused imports from .py files under sc/qa/uitest/autofilter

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.