mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
210 stars 122 forks source link

Large number of Flake8 complexity warnings #20508

Closed josephframsay closed 6 years ago

josephframsay commented 6 years ago

This is an umbrella issue for the 41 warnings for too much cyclomatic complexity in Python scripts in the build servers. These should be reduced as much as possible. The following is a list of all the areas where these warnings occur, and how many warnings they cause.

A number of warnings in #20530 and #20663 were not fixed, but suppressed with a noqa flag. This was deemed acceptable, as these scripts are very complex, untested and soon to be deprecated, so refactoring them is needlessly risky.

mganeva commented 6 years ago

@josephframsay could you please update the line about TOFTOF GUI to scripts/Interface/reduction_gui/reduction/toftof (1) #20635?

josephframsay commented 6 years ago

@mganeva done - thanks for your help on this!

martyngigg commented 6 years ago

@josephframsay Is this meant for 3.12?

josephframsay commented 6 years ago

Yup - changed!

ElliotAOram commented 6 years ago

Flake8 warnings from the algorithms section can not be resolved until proper unit tests have been written. Issues have been opened to this affect see:

20861

20764

josephframsay commented 6 years ago

Flake8 warnings from scripts/reduction/reducer.py were not resolved as the file has no unit tests on it. An issue has been open at #20863 to address this.

Other than that and LRReflectivityOutput, all files have either been refactored sufficient to make the warnings go away, or issued with a noqa flag to suppress the warnings on the build server. This has only been done in the case of files which are to be deprecated soon and have insufficient tests, making refactoring needlessly risky.

Once all the relevant PRs have gone through the cap on the Flake8 build server should presumably be lowered to the number of outstanding issues , which I think is 3.