Our automated tests currently run ruff --max-complexity=101 when the recommended setting is 10, not 101. We do not need to reduce complexity all the way down to 10 but we should examine our worst offending functions and try to reduce their cyclomatic complexity.
Strong tests should be put in place before modifying these functions because at 101, we should expect severe spaghetti code with substantial corner cases and side effects. GenerateOutput() is one function that is 739 lines long!
Please modify only one file per pull request given the difficulty of reviewing changes to older yet crucial code.
./gyp/pylib/gyp/generator/xcode.py:641:1: C901 'GenerateOutput' is too complex (101)
./gyp/pylib/gyp/generator/cmake.py:624:1: C901 'WriteTarget' is too complex (78)
./gyp/pylib/gyp/generator/ninja.py:2207:1: C901 'GenerateOutputForConfig' is too complex (55)
./gyp/pylib/gyp/input.py:759:1: C901 'ExpandVariables' is too complex (48)
./gyp/pylib/gyp/__init__.py:316:1: C901 'gyp_main' is too complex (45)
./gyp/pylib/gyp/generator/make.py:1571:5: C901 'MakefileWriter.WriteTarget' is too complex (40)
./gyp/pylib/gyp/generator/ninja.py:1349:5: C901 'NinjaWriter.WriteLinkForArch' is too complex (35)
./gyp/pylib/gyp/generator/make.py:2230:1: C901 'GenerateOutput' is too complex (34)
./gyp/pylib/gyp/xcode_emulation.py:571:5: C901 'XcodeSettings.GetCflags' is too complex (32)
./gyp/pylib/gyp/input.py:2529:1: C901 'ProcessListFiltersInDict' is too complex (27)
./gyp/pylib/gyp/generator/ninja.py:1057:5: C901 'NinjaWriter.WriteSourcesForArch' is too complex (25)
./gyp/pylib/gyp/generator/xcode.py:138:5: C901 'XcodeProject.Finalize1' is too complex (25)
./gyp/pylib/gyp/generator/ninja.py:378:5: C901 'NinjaWriter.WriteSpec' is too complex (24)
./gyp/pylib/gyp/MSVSNew.py:230:5: C901 'MSVSSolution.Write' is too complex (21)
./gyp/pylib/gyp/input.py:2974:1: C901 'Load' is too complex (21)
./gyp/pylib/gyp/generator/ninja.py:686:5: C901 'NinjaWriter.WriteRules' is too complex (21)
16 C901 'GenerateOutput' is too complex (101)
Coincidence: Our most complex function has a McCabe complexity of 101 and this is issue #101.
Our automated tests currently run
ruff --max-complexity=101
when the recommended setting is10
, not101
. We do not need to reduce complexity all the way down to 10 but we should examine our worst offending functions and try to reduce their cyclomatic complexity.Strong tests should be put in place before modifying these functions because at 101, we should expect severe spaghetti code with substantial corner cases and side effects.
GenerateOutput()
is one function that is 739 lines long!Please modify only one file per pull request given the difficulty of reviewing changes to older yet crucial code.
%
flake8 --ignore=E203,W503 --max-line-length=88 --statistics --max-complexity=20
Coincidence: Our most complex function has a McCabe complexity of 101 and this is issue #101.