Bug 132293 - Run pyflakes on python uitest files to find unused imports
Summary: Run pyflakes on python uitest files to find unused imports
Status: NEW
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: Not Assigned
URL:
Whiteboard: target:7.1.0 target:7.2.0 target:7.4....
Keywords: difficultyBeginner, easyHack, skillPython, topicCleanup
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2020-04-21 08:29 UTC by Xisco Faulí
Modified: 2023-11-06 08:19 UTC (History)
7 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.
Comment 10 Harsh Garg 2021-02-22 17:54:23 UTC
I have started to work on this
Comment 11 Commit Notification 2021-03-11 14:01:48 UTC
Victor Kukshiev committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1a0af07a556e53dd156d933a8fb82bd13b5e84b1

tdf#132293 remove unused imports from uitest

It will be available in 7.2.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.
Comment 12 Commit Notification 2021-04-08 13:00:31 UTC
Vatsal32 committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a804a0a548dc976a1e9063ad2c34b6ce7542542e

tdf#132293 removed all the unused imports from the folder sw

It will be available in 7.2.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.
Comment 13 Commit Notification 2021-12-01 10:28:08 UTC
4k5h1t committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e01854cd8f0c20c57d7e78103834bd806ead3cd9

tdf#132293 removed some unused imports from uitest

It will be available in 7.4.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.
Comment 14 Xisco Faulí 2022-05-03 11:50:15 UTC
Resetting assignee
Comment 15 Commit Notification 2022-05-23 12:34:44 UTC
tagezi committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/30a048cb895a3dcdd6048f3c525edd95a1371b91

tdf#132293: Removing unused imports from uitests files.

It will be available in 7.4.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.
Comment 16 Commit Notification 2022-05-23 12:36:53 UTC
tagezi committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/69a103b57a39798473ebc48fdad0f696cbd606a6

tdf#132293: Removing unused imports from uitests files.

It will be available in 7.4.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.
Comment 17 Commit Notification 2022-05-27 09:59:35 UTC
tagezi committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bd6cb0d8219b117b1a72774c26d54774c72602da

tdf#132293: Removing unused imports from uitests files.

It will be available in 7.4.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.
Comment 18 mr.hashemian2000 2022-06-29 13:56:30 UTC
I have started to work on this.
Comment 19 Commit Notification 2022-06-30 07:57:58 UTC
m.hashemian committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3258bfd178749fd3deb06d852389554c69299c1e

tdf#132293 remove unused imports and unused variables in sw

It will be available in 7.5.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.
Comment 20 Hossein 2022-07-07 13:37:11 UTC
Re-evaluating the EasyHack in 2022

This issue is still relevant. Running pyflakes over core shows ~1500 lines of output, in which many of them are relevant:

$ pyflakes . 2>&1 |grep "imported but unused"|wc
351

Se
Comment 21 Hossein 2022-08-11 23:03:48 UTC
Setting the status back to NEW.
Comment 22 Commit Notification 2022-10-17 11:33:41 UTC
Rakielle committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/09ba0057e3d7f8c9d1166269b232a8b2692fa506

tdf#132293 remove unused imports and variables

It will be available in 7.5.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.
Comment 23 Commit Notification 2022-11-15 16:42:39 UTC
Bogdan B committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/eedb077f8860e02838b37d75c230e51cd290a283

tdf#132293 remove unused imports from uitest

It will be available in 7.5.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.
Comment 24 Commit Notification 2022-11-28 19:52:26 UTC
Bogdan B committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0c2d485edece9078629842a0e1202bfb75f6d0d6

tdf#132293 remove unused imports from uitest

It will be available in 7.5.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.
Comment 25 Commit Notification 2022-12-08 22:56:30 UTC
Bogdan B committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/15e94efb87118b0ceb4aa926181a8906259f369b

tdf#132293 remove unused imports from uitest

It will be available in 7.5.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.
Comment 26 Commit Notification 2023-03-17 14:15:09 UTC
Uday Sharma committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f18b76cad2e27fe5167cd683916d592088c5bf99

tdf#132293 remove some unused imports from uitests

It will be available in 7.6.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.
Comment 27 danfrantes 2023-09-29 15:05:40 UTC
hello is still work here??
Comment 28 Commit Notification 2023-10-11 07:36:05 UTC
Ankit_Jaipuriar committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1f9cd62b67d679da078c50b4b48295918657a70a

tdf#132293 remove unused imports from uitest

It will be available in 24.2.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.
Comment 29 jfeal 2023-11-06 08:17:15 UTC
Taking on my first assignment.

Found this in pyflakes:
```
sw\qa\python\check_xnamedgraph.py:78:5: redefinition of unused 'test_Statements_RemoveByObject' from line 61
```

Plan is to remove the redundant function and push changes through Cygwin.

On a side note, Windows Defender encountered this problem while running pyflakes:
```
Exploit:O97M/CVE-2010-3333.PA
~/lode/dev/core/sw/qa/extras/rtfimport/data/fdo49893-3.rtf
```
Comment 30 Buovjaga 2023-11-06 08:19:46 UTC
Multi-hack, so this is not assigned.

(In reply to jfeal from comment #29)
> Taking on my first assignment.
> 
> Found this in pyflakes:
> ```
> sw\qa\python\check_xnamedgraph.py:78:5: redefinition of unused
> 'test_Statements_RemoveByObject' from line 61
> ```
> 
> Plan is to remove the redundant function and push changes through Cygwin.
> 
> On a side note, Windows Defender encountered this problem while running
> pyflakes:
> ```
> Exploit:O97M/CVE-2010-3333.PA
> ~/lode/dev/core/sw/qa/extras/rtfimport/data/fdo49893-3.rtf
> ```

You need to whitelist the lode directory in Windows Defender.