Global Metrics
path: .metrics.loc.blank
old: 86.0
new: 100.0
path: .metrics.loc.sloc
old: 796.0
new: 978.0
path: .metrics.loc.ploc
old: 554.0
new: 799.0
path: .metrics.loc.cloc
old: 156.0
new: 79.0
path: .metrics.loc.lloc
old: 248.0
new: 581.0
path: .metrics.nexits.sum
old: 19.0
new: 41.0
path: .metrics.nexits.average
old: 0.34545454545454546
new: 1.7826086956521738
path: .metrics.cognitive.average
old: 0.16363636363636364
new: 3.9565217391304346
path: .metrics.cognitive.sum
old: 9.0
new: 91.0
path: .metrics.mi.mi_visual_studio
old: 1.1481748024037923
new: 0.0
path: .metrics.mi.mi_sei
old: -37.842772708785944
new: -99.53374876787493
path: .metrics.mi.mi_original
old: 1.9633789121104857
new: -47.73532448074201
path: .metrics.cyclomatic.average
old: 1.32
new: 9.708333333333334
path: .metrics.cyclomatic.sum
old: 33.0
new: 233.0
path: .metrics.nargs.average
old: 0.5818181818181818
new: 1.2608695652173914
path: .metrics.nargs.sum
old: 32.0
new: 29.0
path: .metrics.nom.closures
old: 36.0
new: 0.0
path: .metrics.nom.functions
old: 19.0
new: 23.0
path: .metrics.nom.total
old: 55.0
new: 23.0
path: .metrics.halstead.level
old: 0.012206572769953052
new: 0.020581713276927385
path: .metrics.halstead.n2
old: 260.0
new: 478.0
path: .metrics.halstead.vocabulary
old: 290.0
new: 517.0
path: .metrics.halstead.N2
old: 1420.0
new: 1191.0
path: .metrics.halstead.effort
old: 2289141.266602918
new: 1455787.6518917242
path: .metrics.halstead.difficulty
old: 81.92307692307692
new: 48.58682008368201
path: .metrics.halstead.N1
old: 1996.0
new: 2133.0
path: .metrics.halstead.purity_ratio
old: 0.6536950671123108
new: 1.3419810531740146
path: .metrics.halstead.time
old: 127174.51481127324
new: 80877.09177176245
path: .metrics.halstead.volume
old: 27942.569451491017
new: 29962.60404332684
path: .metrics.halstead.bugs
old: 5.789758846120164
new: 4.281646084189677
path: .metrics.halstead.estimated_program_length
old: 2233.022349255654
new: 4460.745020750424
path: .metrics.halstead.n1
old: 30.0
new: 39.0
path: .metrics.halstead.length
old: 3416.0
new: 3324.0
Spaces Data
Minimal test - lines (92, 109)
path: .spaces[4].metrics.loc.cloc
old: 10.0
new: 0.0
path: .spaces[4].metrics.loc.lloc
old: 22.0
new: 3.0
path: .spaces[4].metrics.loc.ploc
old: 43.0
new: 18.0
path: .spaces[4].metrics.loc.sloc
old: 58.0
new: 18.0
path: .spaces[4].metrics.loc.blank
old: 5.0
new: 0.0
path: .spaces[4].metrics.nom.closures
old: 6.0
new: 0.0
path: .spaces[4].metrics.nom.total
old: 7.0
new: 1.0
path: .spaces[4].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[4].metrics.nargs.average
old: 0.2857142857142857
new: 1.0
path: .spaces[4].metrics.halstead.estimated_program_length
old: 460.9407761481053
new: 122.10749561002054
path: .spaces[4].metrics.halstead.difficulty
old: 16.215384615384615
new: 5.454545454545454
path: .spaces[4].metrics.halstead.length
old: 310.0
new: 71.0
path: .spaces[4].metrics.halstead.bugs
old: 0.3356845281732905
new: 0.05114002522742025
path: .spaces[4].metrics.halstead.volume
old: 1970.841121431606
new: 348.3892322882048
path: .spaces[4].metrics.halstead.purity_ratio
old: 1.486905729510017
new: 1.7198238818312752
path: .spaces[4].metrics.halstead.vocabulary
old: 82.0
new: 30.0
path: .spaces[4].metrics.halstead.effort
old: 31957.946799829424
new: 1900.304903390208
path: .spaces[4].metrics.halstead.time
old: 1775.4414888794124
new: 105.57249463278932
path: .spaces[4].metrics.halstead.N1
old: 186.0
new: 41.0
path: .spaces[4].metrics.halstead.level
old: 0.06166982922201139
new: 0.18333333333333335
path: .spaces[4].metrics.halstead.n1
old: 17.0
new: 8.0
path: .spaces[4].metrics.halstead.N2
old: 124.0
new: 30.0
path: .spaces[4].metrics.halstead.n2
old: 65.0
new: 22.0
path: .spaces[4].metrics.mi.mi_original
old: 65.31250161097739
new: 93.2787117627946
path: .spaces[4].metrics.mi.mi_visual_studio
old: 38.194445386536486
new: 54.5489542472483
path: .spaces[4].metrics.mi.mi_sei
old: 48.719465575016855
new: 59.07552260749099
path: .spaces[4].metrics.cognitive.average
old: 0.14285714285714285
new: 1.0
path: .spaces[4].metrics.nexits.average
old: 0.2857142857142857
new: 0.0
path: .spaces[4].metrics.nexits.sum
old: 2.0
new: 0.0
Code
nsLookAndFeel::nsLookAndFeel(const LookAndFeelCache* aCache)
: nsXPLookAndFeel(),
mUseAccessibilityTheme(0),
mUseDefaultTheme(0),
mNativeThemeId(eWindowsTheme_Generic),
mCaretBlinkTime(-1),
mHasColorMenuHoverText(false),
mHasColorAccent(false),
mHasColorAccentText(false),
mHasColorMediaText(false),
mHasColorCommunicationsText(false),
mInitialized(false) {
mozilla::Telemetry::Accumulate(mozilla::Telemetry::TOUCH_ENABLED_DEVICE,
WinUtils::IsTouchDeviceSupportPresent());
if (aCache) {
DoSetCache(*aCache);
}
}
Minimal test - lines (116, 126)
path: .spaces[7].metrics.cognitive.sum
old: 3.0
new: 1.0
path: .spaces[7].metrics.cognitive.average
old: 3.0
new: 1.0
path: .spaces[7].metrics.nargs.sum
old: 3.0
new: 0.0
path: .spaces[7].metrics.nargs.average
old: 3.0
new: 0.0
path: .spaces[7].metrics.cyclomatic.sum
old: 3.0
new: 2.0
path: .spaces[7].metrics.cyclomatic.average
old: 3.0
new: 2.0
path: .spaces[7].metrics.halstead.length
old: 84.0
new: 46.0
path: .spaces[7].metrics.halstead.time
old: 381.3834904832366
new: 123.0803126743894
path: .spaces[7].metrics.halstead.volume
old: 403.8178134528387
new: 205.1338544573157
path: .spaces[7].metrics.halstead.estimated_program_length
old: 106.60593781761293
new: 76.2388309575275
path: .spaces[7].metrics.halstead.n2
old: 14.0
new: 10.0
path: .spaces[7].metrics.halstead.N1
old: 50.0
new: 28.0
path: .spaces[7].metrics.halstead.purity_ratio
old: 1.2691183073525347
new: 1.6573658903810329
path: .spaces[7].metrics.halstead.effort
old: 6864.902828698258
new: 2215.4456281390094
path: .spaces[7].metrics.halstead.vocabulary
old: 28.0
new: 22.0
path: .spaces[7].metrics.halstead.N2
old: 34.0
new: 18.0
path: .spaces[7].metrics.halstead.difficulty
old: 17.0
new: 10.8
path: .spaces[7].metrics.halstead.level
old: 0.058823529411764705
new: 0.0925925925925926
path: .spaces[7].metrics.halstead.bugs
old: 0.12040236236682296
new: 0.05664820363996762
path: .spaces[7].metrics.halstead.n1
old: 14.0
new: 12.0
path: .spaces[7].metrics.loc.lloc
old: 7.0
new: 5.0
path: .spaces[7].metrics.loc.ploc
old: 14.0
new: 9.0
path: .spaces[7].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[7].metrics.loc.sloc
old: 14.0
new: 11.0
path: .spaces[7].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[7].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[7].metrics.mi.mi_visual_studio
old: 56.346350525786335
new: 60.82517571027915
path: .spaces[7].metrics.mi.mi_original
old: 96.35225939909463
new: 104.01105046457737
path: .spaces[7].metrics.mi.mi_sei
old: 63.6115343997215
new: 74.55901442969365
Code
void nsLookAndFeel::RefreshImpl() {
nsXPLookAndFeel::RefreshImpl();
for (auto e = mSystemFontCache.begin(), end = mSystemFontCache.end();
e != end; ++e) {
e->mCacheValid = false;
}
mCaretBlinkTime = -1;
mInitialized = false;
}
Minimal test - lines (373, 622)
path: .spaces[9].metrics.loc.blank
old: 14.0
new: 8.0
path: .spaces[9].metrics.loc.lloc
old: 40.0
new: 174.0
path: .spaces[9].metrics.loc.cloc
old: 28.0
new: 29.0
path: .spaces[9].metrics.loc.sloc
old: 125.0
new: 250.0
path: .spaces[9].metrics.loc.ploc
old: 83.0
new: 213.0
path: .spaces[9].metrics.cognitive.sum
old: 0.0
new: 31.0
path: .spaces[9].metrics.cognitive.average
old: 0.0
new: 31.0
path: .spaces[9].metrics.nexits.sum
old: 3.0
new: 2.0
path: .spaces[9].metrics.nexits.average
old: 0.5
new: 2.0
path: .spaces[9].metrics.mi.mi_original
old: 49.62565899583613
new: 21.14682415221229
path: .spaces[9].metrics.mi.mi_visual_studio
old: 29.020853213939255
new: 12.366563831703091
path: .spaces[9].metrics.mi.mi_sei
old: 29.458648684659885
new: -13.297699910225536
path: .spaces[9].metrics.nom.closures
old: 5.0
new: 0.0
path: .spaces[9].metrics.nom.total
old: 6.0
new: 1.0
path: .spaces[9].metrics.cyclomatic.sum
old: 1.0
new: 66.0
path: .spaces[9].metrics.cyclomatic.average
old: 1.0
new: 66.0
path: .spaces[9].metrics.halstead.purity_ratio
old: 1.3863426613609
new: 1.4326462699236238
path: .spaces[9].metrics.halstead.n1
old: 19.0
new: 29.0
path: .spaces[9].metrics.halstead.effort
old: 81954.11857710071
new: 159540.84728145524
path: .spaces[9].metrics.halstead.bugs
old: 0.6289159385309758
new: 0.9805280183655009
path: .spaces[9].metrics.halstead.difficulty
old: 21.305825242718445
new: 26.651408450704224
path: .spaces[9].metrics.halstead.time
old: 4553.006587616706
new: 8863.380404525291
path: .spaces[9].metrics.halstead.vocabulary
old: 122.0
new: 171.0
path: .spaces[9].metrics.halstead.estimated_program_length
old: 769.4201770552995
new: 1156.1455398283645
path: .spaces[9].metrics.halstead.n2
old: 103.0
new: 142.0
path: .spaces[9].metrics.halstead.length
old: 555.0
new: 807.0
path: .spaces[9].metrics.halstead.level
old: 0.04693552061973115
new: 0.03752146915048223
path: .spaces[9].metrics.halstead.N2
old: 231.0
new: 261.0
path: .spaces[9].metrics.halstead.N1
old: 324.0
new: 546.0
path: .spaces[9].metrics.halstead.volume
old: 3846.5592223474023
new: 5986.20697951292
path: .spaces[9].metrics.nargs.average
old: 0.6666666666666666
new: 2.0
path: .spaces[9].metrics.nargs.sum
old: 4.0
new: 2.0
Code
nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
nsresult res = NS_OK;
switch (aID) {
case IntID::ScrollButtonLeftMouseButtonAction:
aResult = 0;
break;
case IntID::ScrollButtonMiddleMouseButtonAction:
case IntID::ScrollButtonRightMouseButtonAction:
aResult = 3;
break;
case IntID::CaretBlinkTime:
// IntID::CaretBlinkTime is often called by updating editable text
// that has focus. So it should be cached to improve performance.
if (mCaretBlinkTime < 0) {
mCaretBlinkTime = static_cast(::GetCaretBlinkTime());
}
aResult = mCaretBlinkTime;
break;
case IntID::CaretWidth:
aResult = 1;
break;
case IntID::ShowCaretDuringSelection:
aResult = 0;
break;
case IntID::SelectTextfieldsOnKeyFocus:
// Select textfield content when focused by kbd
// used by EventStateManager::sTextfieldSelectModel
aResult = 1;
break;
case IntID::SubmenuDelay:
// This will default to the Windows' default
// (400ms) on error.
aResult = GetSystemParam(SPI_GETMENUSHOWDELAY, 400);
break;
case IntID::TooltipDelay:
aResult = 500;
break;
case IntID::MenusCanOverlapOSBar:
// we want XUL popups to be able to overlap the task bar.
aResult = 1;
break;
case IntID::DragThresholdX:
// The system metric is the number of pixels at which a drag should
// start. Our look and feel metric is the number of pixels you can
// move before starting a drag, so subtract 1.
aResult = ::GetSystemMetrics(SM_CXDRAG) - 1;
break;
case IntID::DragThresholdY:
aResult = ::GetSystemMetrics(SM_CYDRAG) - 1;
break;
case IntID::UseAccessibilityTheme:
// High contrast is a misnomer under Win32 -- any theme can be used with
// it, e.g. normal contrast with large fonts, low contrast, etc. The high
// contrast flag really means -- use this theme and don't override it.
if (XRE_IsContentProcess()) {
// If we're running in the content process, then the parent should
// have sent us the accessibility state when nsLookAndFeel
// initialized, and stashed it in the mUseAccessibilityTheme cache.
aResult = mUseAccessibilityTheme;
} else {
// Otherwise, we can ask the OS to see if we're using High Contrast
// mode.
aResult = nsUXThemeData::IsHighContrastOn();
}
break;
case IntID::ScrollArrowStyle:
aResult = eScrollArrowStyle_Single;
break;
case IntID::ScrollSliderStyle:
aResult = eScrollThumbStyle_Proportional;
break;
case IntID::TreeOpenDelay:
aResult = 1000;
break;
case IntID::TreeCloseDelay:
aResult = 0;
break;
case IntID::TreeLazyScrollDelay:
aResult = 150;
break;
case IntID::TreeScrollDelay:
aResult = 100;
break;
case IntID::TreeScrollLinesMax:
aResult = 3;
break;
case IntID::WindowsClassic:
aResult = !nsUXThemeData::IsAppThemed();
break;
case IntID::TouchEnabled:
aResult = WinUtils::IsTouchDeviceSupportPresent();
break;
case IntID::WindowsDefaultTheme:
if (XRE_IsContentProcess()) {
aResult = mUseDefaultTheme;
} else {
aResult = nsUXThemeData::IsDefaultWindowTheme();
}
break;
case IntID::WindowsThemeIdentifier:
if (XRE_IsContentProcess()) {
aResult = mNativeThemeId;
} else {
aResult = nsUXThemeData::GetNativeThemeId();
}
break;
case IntID::OperatingSystemVersionIdentifier: {
aResult = int32_t(GetOperatingSystemVersion());
break;
}
case IntID::MacGraphiteTheme:
aResult = 0;
res = NS_ERROR_NOT_IMPLEMENTED;
break;
case IntID::DWMCompositor:
aResult = gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled();
break;
case IntID::WindowsAccentColorInTitlebar: {
nscolor unused;
if (NS_WARN_IF(NS_FAILED(GetAccentColor(unused)))) {
aResult = 0;
break;
}
uint32_t colorPrevalence;
nsresult rv = mDwmKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
u"SOFTWARE\\Microsoft\\Windows\\DWM"_ns,
nsIWindowsRegKey::ACCESS_QUERY_VALUE);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
// The ColorPrevalence value is set to 1 when the "Show color on title
// bar" setting in the Color section of Window's Personalization settings
// is turned on.
aResult = (NS_SUCCEEDED(mDwmKey->ReadIntValue(u"ColorPrevalence"_ns,
&colorPrevalence)) &&
colorPrevalence == 1)
? 1
: 0;
mDwmKey->Close();
} break;
case IntID::WindowsGlass:
// Aero Glass is only available prior to Windows 8 when DWM is used.
aResult = (gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled() &&
!IsWin8OrLater());
break;
case IntID::AlertNotificationOrigin:
aResult = 0;
{
// Get task bar window handle
HWND shellWindow = FindWindowW(L"Shell_TrayWnd", nullptr);
if (shellWindow != nullptr) {
// Determine position
APPBARDATA appBarData;
appBarData.hWnd = shellWindow;
appBarData.cbSize = sizeof(appBarData);
if (SHAppBarMessage(ABM_GETTASKBARPOS, &appBarData)) {
// Set alert origin as a bit field - see LookAndFeel.h
// 0 represents bottom right, sliding vertically.
switch (appBarData.uEdge) {
case ABE_LEFT:
aResult = NS_ALERT_HORIZONTAL | NS_ALERT_LEFT;
break;
case ABE_RIGHT:
aResult = NS_ALERT_HORIZONTAL;
break;
case ABE_TOP:
aResult = NS_ALERT_TOP;
// fall through for the right-to-left handling.
case ABE_BOTTOM:
// If the task bar is right-to-left,
// move the origin to the left
if (::GetWindowLong(shellWindow, GWL_EXSTYLE) & WS_EX_LAYOUTRTL)
aResult |= NS_ALERT_LEFT;
break;
}
}
}
}
break;
case IntID::IMERawInputUnderlineStyle:
case IntID::IMEConvertedTextUnderlineStyle:
aResult = NS_STYLE_TEXT_DECORATION_STYLE_DASHED;
break;
case IntID::IMESelectedRawTextUnderlineStyle:
case IntID::IMESelectedConvertedTextUnderline:
aResult = NS_STYLE_TEXT_DECORATION_STYLE_NONE;
break;
case IntID::SpellCheckerUnderlineStyle:
aResult = NS_STYLE_TEXT_DECORATION_STYLE_WAVY;
break;
case IntID::ScrollbarButtonAutoRepeatBehavior:
aResult = 0;
break;
case IntID::SwipeAnimationEnabled:
aResult = 0;
break;
case IntID::UseOverlayScrollbars:
aResult = false;
break;
case IntID::AllowOverlayScrollbarsOverlap:
aResult = 0;
break;
case IntID::ScrollbarDisplayOnMouseMove:
aResult = 1;
break;
case IntID::ScrollbarFadeBeginDelay:
aResult = 2500;
break;
case IntID::ScrollbarFadeDuration:
aResult = 350;
break;
case IntID::ContextMenuOffsetVertical:
case IntID::ContextMenuOffsetHorizontal:
aResult = 2;
break;
case IntID::SystemUsesDarkTheme:
res = SystemWantsDarkTheme(aResult);
break;
case IntID::PrefersReducedMotion: {
BOOL enableAnimation = TRUE;
::SystemParametersInfoW(SPI_GETCLIENTAREAANIMATION, 0, &enableAnimation,
0);
aResult = enableAnimation ? 0 : 1;
break;
}
case IntID::PrimaryPointerCapabilities: {
PointerCapabilities caps =
widget::WinUtils::GetPrimaryPointerCapabilities();
aResult = static_cast(caps);
break;
}
case IntID::AllPointerCapabilities: {
PointerCapabilities caps = widget::WinUtils::GetAllPointerCapabilities();
aResult = static_cast(caps);
break;
}
default:
aResult = 0;
res = NS_ERROR_FAILURE;
}
return res;
}
Minimal test - lines (113, 113)
path: .spaces[6].metrics.nargs.average
old: 0.15384615384615383
new: 0.0
path: .spaces[6].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[6].metrics.halstead.difficulty
old: 26.307692307692307
new: 2.5
path: .spaces[6].metrics.halstead.estimated_program_length
old: 672.9199350135095
new: 13.60964047443681
path: .spaces[6].metrics.halstead.length
old: 636.0
new: 8.0
path: .spaces[6].metrics.halstead.n1
old: 19.0
new: 5.0
path: .spaces[6].metrics.halstead.volume
old: 4312.944777801684
new: 22.458839376460833
path: .spaces[6].metrics.halstead.purity_ratio
old: 1.0580502122853923
new: 1.7012050593046013
path: .spaces[6].metrics.halstead.time
old: 6303.534675248615
new: 3.1192832467306713
path: .spaces[6].metrics.halstead.vocabulary
old: 110.0
new: 7.0
path: .spaces[6].metrics.halstead.effort
old: 113463.62415447508
new: 56.14709844115208
path: .spaces[6].metrics.halstead.level
old: 0.03801169590643275
new: 0.4
path: .spaces[6].metrics.halstead.N1
old: 384.0
new: 6.0
path: .spaces[6].metrics.halstead.n2
old: 91.0
new: 2.0
path: .spaces[6].metrics.halstead.N2
old: 252.0
new: 2.0
path: .spaces[6].metrics.halstead.bugs
old: 0.7812376761002807
new: 0.0048876146417121315
path: .spaces[6].metrics.loc.ploc
old: 100.0
new: 1.0
path: .spaces[6].metrics.loc.lloc
old: 57.0
new: 1.0
path: .spaces[6].metrics.loc.sloc
old: 142.0
new: 1.0
path: .spaces[6].metrics.loc.blank
old: 13.0
new: 0.0
path: .spaces[6].metrics.loc.cloc
old: 29.0
new: 0.0
path: .spaces[6].metrics.mi.mi_original
old: 46.96484546376438
new: 154.58924178123317
path: .spaces[6].metrics.mi.mi_visual_studio
old: 27.46482190863414
new: 90.4030653691422
path: .spaces[6].metrics.mi.mi_sei
old: 24.371648731256812
new: 147.42610035996177
path: .spaces[6].metrics.nexits.average
old: 0.4615384615384616
new: 0.0
path: .spaces[6].metrics.nexits.sum
old: 6.0
new: 0.0
path: .spaces[6].metrics.nom.total
old: 13.0
new: 1.0
path: .spaces[6].metrics.nom.closures
old: 12.0
new: 0.0
Code
void nsLookAndFeel::NativeInit() { EnsureInit(); }
Minimal test - lines (42, 53)
path: .spaces[1].metrics.nexits.sum
old: 1.0
new: 2.0
path: .spaces[1].metrics.nexits.average
old: 0.5
new: 2.0
path: .spaces[1].metrics.halstead.level
old: 0.05620915032679738
new: 0.12363636363636364
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.519152879202718
new: 1.8227223068858651
path: .spaces[1].metrics.halstead.volume
old: 1203.939679525266
new: 283.6339404013986
path: .spaces[1].metrics.halstead.n2
old: 43.0
new: 17.0
path: .spaces[1].metrics.halstead.n1
old: 18.0
new: 11.0
path: .spaces[1].metrics.halstead.N1
old: 118.0
new: 34.0
path: .spaces[1].metrics.halstead.N2
old: 85.0
new: 25.0
path: .spaces[1].metrics.halstead.difficulty
old: 17.790697674418606
new: 8.088235294117647
path: .spaces[1].metrics.halstead.length
old: 203.0
new: 59.0
path: .spaces[1].metrics.halstead.time
old: 1189.940380926135
new: 127.4498915202363
path: .spaces[1].metrics.halstead.bugs
old: 0.2570852837214738
new: 0.05798113716593528
path: .spaces[1].metrics.halstead.vocabulary
old: 61.0
new: 28.0
path: .spaces[1].metrics.halstead.effort
old: 21418.92685667043
new: 2294.0980473642535
path: .spaces[1].metrics.halstead.estimated_program_length
old: 308.3880344781518
new: 107.54061610626604
path: .spaces[1].metrics.nargs.sum
old: 2.0
new: 5.0
path: .spaces[1].metrics.nargs.average
old: 1.0
new: 5.0
path: .spaces[1].metrics.loc.blank
old: 2.0
new: 0.0
path: .spaces[1].metrics.loc.lloc
old: 8.0
new: 4.0
path: .spaces[1].metrics.loc.sloc
old: 47.0
new: 12.0
path: .spaces[1].metrics.loc.cloc
old: 10.0
new: 0.0
path: .spaces[1].metrics.loc.ploc
old: 35.0
new: 12.0
path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[1].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[1].metrics.nom.closures
old: 1.0
new: 0.0
path: .spaces[1].metrics.nom.total
old: 2.0
new: 1.0
path: .spaces[1].metrics.mi.mi_original
old: 71.28216532462851
new: 100.9165530579717
path: .spaces[1].metrics.mi.mi_visual_studio
old: 41.68547679802837
new: 59.01552810407702
path: .spaces[1].metrics.mi.mi_sei
old: 60.10658774400095
new: 70.09459836713994
Code
static nsresult GetColorFromTheme(nsUXThemeClass cls, int32_t aPart,
int32_t aState, int32_t aPropId,
nscolor& aColor) {
COLORREF color;
HRESULT hr = GetThemeColor(nsUXThemeData::GetTheme(cls), aPart, aState,
aPropId, &color);
if (hr == S_OK) {
aColor = COLOREF_2_NSRGB(color);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
Minimal test - lines (55, 58)
path: .spaces[2].metrics.mi.mi_visual_studio
old: 49.17866346545608
new: 72.24902761352239
path: .spaces[2].metrics.mi.mi_sei
old: 81.20093179184124
new: 102.74175440530044
path: .spaces[2].metrics.mi.mi_original
old: 84.0955145259299
new: 123.54583721912329
path: .spaces[2].metrics.nargs.average
old: 1.0
new: 2.0
path: .spaces[2].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[2].metrics.nom.closures
old: 1.0
new: 0.0
path: .spaces[2].metrics.nom.total
old: 2.0
new: 1.0
path: .spaces[2].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[2].metrics.loc.cloc
old: 7.0
new: 0.0
path: .spaces[2].metrics.loc.sloc
old: 27.0
new: 4.0
path: .spaces[2].metrics.loc.ploc
old: 17.0
new: 4.0
path: .spaces[2].metrics.loc.lloc
old: 6.0
new: 1.0
path: .spaces[2].metrics.loc.blank
old: 3.0
new: 0.0
path: .spaces[2].metrics.halstead.volume
old: 602.0682532102144
new: 112.0
path: .spaces[2].metrics.halstead.N2
old: 45.0
new: 11.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 213.3029689088065
new: 48.72905595320056
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.9569079716404263
new: 1.7403234269000198
path: .spaces[2].metrics.halstead.n1
old: 14.0
new: 10.0
path: .spaces[2].metrics.halstead.bugs
old: 0.109164881422044
new: 0.03392332291873024
path: .spaces[2].metrics.halstead.effort
old: 5926.609367538048
new: 1026.6666666666663
path: .spaces[2].metrics.halstead.level
old: 0.1015873015873016
new: 0.1090909090909091
path: .spaces[2].metrics.halstead.vocabulary
old: 46.0
new: 16.0
path: .spaces[2].metrics.halstead.time
old: 329.256075974336
new: 57.03703703703703
path: .spaces[2].metrics.halstead.length
old: 109.0
new: 28.0
path: .spaces[2].metrics.halstead.difficulty
old: 9.84375
new: 9.166666666666666
path: .spaces[2].metrics.halstead.N1
old: 64.0
new: 17.0
path: .spaces[2].metrics.halstead.n2
old: 32.0
new: 6.0
Code
static int32_t GetSystemParam(long flag, int32_t def) {
DWORD value;
return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def;
}
Minimal test - lines (24, 40)
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 4.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 4.0
path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[0].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[0].metrics.cyclomatic.sum
old: 13.0
new: 4.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 4.0
path: .spaces[0].metrics.mi.mi_sei
old: 43.334045111675664
new: 63.36580413986394
path: .spaces[0].metrics.mi.mi_original
old: 64.47911308668135
new: 96.11135601382492
path: .spaces[0].metrics.mi.mi_visual_studio
old: 37.707083676421846
new: 56.205471353113985
path: .spaces[0].metrics.nargs.sum
old: 7.0
new: 0.0
path: .spaces[0].metrics.nargs.average
old: 0.875
new: 0.0
path: .spaces[0].metrics.halstead.level
old: 0.06993006993006992
new: 0.1176470588235294
path: .spaces[0].metrics.halstead.estimated_program_length
old: 217.57865339808407
new: 57.05865002596162
path: .spaces[0].metrics.halstead.N1
old: 108.0
new: 36.0
path: .spaces[0].metrics.halstead.bugs
old: 0.20916273291452345
new: 0.05074899406196717
path: .spaces[0].metrics.halstead.vocabulary
old: 46.0
new: 18.0
path: .spaces[0].metrics.halstead.volume
old: 1099.1888292553456
new: 221.00602507644257
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.0933600673270556
new: 1.0765783023766342
path: .spaces[0].metrics.halstead.effort
old: 15718.400258351445
new: 1878.5512131497617
path: .spaces[0].metrics.halstead.time
old: 873.2444587973024
new: 104.36395628609787
path: .spaces[0].metrics.halstead.n1
old: 11.0
new: 9.0
path: .spaces[0].metrics.halstead.N2
old: 91.0
new: 17.0
path: .spaces[0].metrics.halstead.length
old: 199.0
new: 53.0
path: .spaces[0].metrics.halstead.difficulty
old: 14.3
new: 8.5
path: .spaces[0].metrics.halstead.n2
old: 35.0
new: 9.0
path: .spaces[0].metrics.loc.lloc
old: 5.0
new: 8.0
path: .spaces[0].metrics.loc.blank
old: 10.0
new: 3.0
path: .spaces[0].metrics.loc.cloc
old: 7.0
new: 0.0
path: .spaces[0].metrics.loc.ploc
old: 46.0
new: 14.0
path: .spaces[0].metrics.loc.sloc
old: 63.0
new: 17.0
path: .spaces[0].metrics.nom.total
old: 8.0
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 8.0
new: 1.0
Code
LookAndFeel::OperatingSystemVersion nsLookAndFeel::GetOperatingSystemVersion() {
static OperatingSystemVersion version = OperatingSystemVersion::Unknown;
if (version != OperatingSystemVersion::Unknown) {
return version;
}
if (IsWin10OrLater()) {
version = OperatingSystemVersion::Windows10;
} else if (IsWin8OrLater()) {
version = OperatingSystemVersion::Windows8;
} else {
version = OperatingSystemVersion::Windows7;
}
return version;
}
Minimal test - lines (641, 702)
path: .spaces[11].metrics.loc.sloc
old: 13.0
new: 62.0
path: .spaces[11].metrics.loc.blank
old: 2.0
new: 11.0
path: .spaces[11].metrics.loc.cloc
old: 0.0
new: 16.0
path: .spaces[11].metrics.loc.lloc
old: 6.0
new: 18.0
path: .spaces[11].metrics.loc.ploc
old: 11.0
new: 35.0
path: .spaces[11].metrics.cognitive.average
old: 0.0
new: 7.0
path: .spaces[11].metrics.cognitive.sum
old: 0.0
new: 7.0
path: .spaces[11].metrics.cyclomatic.average
old: 1.0
new: 7.0
path: .spaces[11].metrics.cyclomatic.sum
old: 1.0
new: 7.0
path: .spaces[11].metrics.mi.mi_visual_studio
old: 57.8494718207685
new: 38.40277148558962
path: .spaces[11].metrics.mi.mi_sei
old: 67.1161077221069
new: 55.16346103427391
path: .spaces[11].metrics.mi.mi_original
old: 98.92259681351412
new: 65.66873924035825
path: .spaces[11].metrics.halstead.n2
old: 18.0
new: 44.0
path: .spaces[11].metrics.halstead.effort
old: 2241.1765955873907
new: 22593.52877455712
path: .spaces[11].metrics.halstead.level
old: 0.1512605042016807
new: 0.05304400241109102
path: .spaces[11].metrics.halstead.N1
old: 39.0
new: 120.0
path: .spaces[11].metrics.halstead.difficulty
old: 6.611111111111111
new: 18.852272727272727
path: .spaces[11].metrics.halstead.n1
old: 7.0
new: 21.0
path: .spaces[11].metrics.halstead.N2
old: 34.0
new: 79.0
path: .spaces[11].metrics.halstead.length
old: 73.0
new: 199.0
path: .spaces[11].metrics.halstead.purity_ratio
old: 1.2973991024707512
new: 1.6706213924542466
path: .spaces[11].metrics.halstead.volume
old: 339.0015018535549
new: 1198.4511947926624
path: .spaces[11].metrics.halstead.vocabulary
old: 25.0
new: 65.0
path: .spaces[11].metrics.halstead.estimated_program_length
old: 94.71013448036484
new: 332.45365709839507
path: .spaces[11].metrics.halstead.bugs
old: 0.05708598042951304
new: 0.266400349134745
path: .spaces[11].metrics.halstead.time
old: 124.50981086596614
new: 1255.1960430309512
path: .spaces[11].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[11].metrics.nexits.sum
old: 0.0
new: 2.0
Code
LookAndFeelFont nsLookAndFeel::GetLookAndFeelFontInternal(
const LOGFONTW& aLogFont, bool aUseShellDlg) {
LookAndFeelFont result{};
result.haveFont() = false;
// Get scaling factor from physical to logical pixels
double pixelScale = 1.0 / WinUtils::SystemScaleFactor();
// The lfHeight is in pixels, and it needs to be adjusted for the
// device it will be displayed on.
// Screens and Printers will differ in DPI
//
// So this accounts for the difference in the DeviceContexts
// The pixelScale will typically be 1.0 for the screen
// (though larger for hi-dpi screens where the Windows resolution
// scale factor is 125% or 150% or even more), and could be
// any value when going to a printer, for example pixelScale is
// 6.25 when going to a 600dpi printer.
float pixelHeight = -aLogFont.lfHeight;
if (pixelHeight < 0) {
nsAutoFont hFont(::CreateFontIndirectW(&aLogFont));
if (!hFont) {
return result;
}
nsAutoHDC dc(::GetDC(nullptr));
HGDIOBJ hObject = ::SelectObject(dc, hFont);
TEXTMETRIC tm;
::GetTextMetrics(dc, &tm);
::SelectObject(dc, hObject);
pixelHeight = tm.tmAscent;
}
pixelHeight *= pixelScale;
// we have problem on Simplified Chinese system because the system
// report the default font size is 8 points. but if we use 8, the text
// display very ugly. force it to be at 9 points (12 pixels) on that
// system (cp936), but leave other sizes alone.
if (pixelHeight < 12 && ::GetACP() == 936) {
pixelHeight = 12;
}
result.haveFont() = true;
if (aUseShellDlg) {
result.name() = u"MS Shell Dlg 2"_ns;
} else {
result.name() = aLogFont.lfFaceName;
}
result.size() = pixelHeight;
result.italic() = !!aLogFont.lfItalic;
// FIXME: Other weights?
result.weight() = ((aLogFont.lfWeight == FW_BOLD) ? FontWeight::Bold()
: FontWeight::Normal())
.ToFloat();
return result;
}
Minimal test - lines (128, 371)
path: .spaces[8].metrics.cognitive.average
old: 0.7142857142857143
new: 15.0
path: .spaces[8].metrics.cognitive.sum
old: 5.0
new: 15.0
path: .spaces[8].metrics.nexits.average
old: 0.42857142857142855
new: 11.0
path: .spaces[8].metrics.nexits.sum
old: 3.0
new: 11.0
path: .spaces[8].metrics.halstead.n1
old: 25.0
new: 18.0
path: .spaces[8].metrics.halstead.length
old: 576.0
new: 812.0
path: .spaces[8].metrics.halstead.difficulty
old: 28.34158415841584
new: 16.04895104895105
path: .spaces[8].metrics.halstead.N2
old: 229.0
new: 255.0
path: .spaces[8].metrics.halstead.N1
old: 347.0
new: 557.0
path: .spaces[8].metrics.halstead.effort
old: 113902.36770165012
new: 95534.66321008193
path: .spaces[8].metrics.halstead.time
old: 6327.90931675834
new: 5307.481289448995
path: .spaces[8].metrics.halstead.level
old: 0.03528384279475982
new: 0.06230936819172113
path: .spaces[8].metrics.halstead.n2
old: 101.0
new: 143.0
path: .spaces[8].metrics.halstead.purity_ratio
old: 1.3690551467053806
new: 1.3533500630360484
path: .spaces[8].metrics.halstead.vocabulary
old: 126.0
new: 161.0
path: .spaces[8].metrics.halstead.bugs
old: 0.7832503180079243
new: 0.6966041593011127
path: .spaces[8].metrics.halstead.volume
old: 4018.913235935952
new: 5952.704505029069
path: .spaces[8].metrics.halstead.estimated_program_length
old: 788.5757645022993
new: 1098.9202511852714
path: .spaces[8].metrics.mi.mi_visual_studio
old: 29.057457025848453
new: 9.385701692293162
path: .spaces[8].metrics.mi.mi_sei
old: 25.147152170776987
new: -31.354936794088175
path: .spaces[8].metrics.mi.mi_original
old: 49.68825151420086
new: 16.049549893821307
path: .spaces[8].metrics.nargs.average
old: 0.2857142857142857
new: 2.0
path: .spaces[8].metrics.cyclomatic.sum
old: 5.0
new: 90.0
path: .spaces[8].metrics.cyclomatic.average
old: 5.0
new: 90.0
path: .spaces[8].metrics.nom.total
old: 7.0
new: 1.0
path: .spaces[8].metrics.nom.closures
old: 6.0
new: 0.0
path: .spaces[8].metrics.loc.lloc
old: 43.0
new: 219.0
path: .spaces[8].metrics.loc.blank
old: 10.0
new: 5.0
path: .spaces[8].metrics.loc.cloc
old: 18.0
new: 6.0
path: .spaces[8].metrics.loc.ploc
old: 88.0
new: 233.0
path: .spaces[8].metrics.loc.sloc
old: 116.0
new: 244.0
Code
nsresult nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) {
EnsureInit();
nsresult res = NS_OK;
int idx;
switch (aID) {
case ColorID::WindowBackground:
idx = COLOR_WINDOW;
break;
case ColorID::WindowForeground:
idx = COLOR_WINDOWTEXT;
break;
case ColorID::WidgetBackground:
idx = COLOR_BTNFACE;
break;
case ColorID::WidgetForeground:
idx = COLOR_BTNTEXT;
break;
case ColorID::WidgetSelectBackground:
idx = COLOR_HIGHLIGHT;
break;
case ColorID::WidgetSelectForeground:
idx = COLOR_HIGHLIGHTTEXT;
break;
case ColorID::Widget3DHighlight:
idx = COLOR_BTNHIGHLIGHT;
break;
case ColorID::Widget3DShadow:
idx = COLOR_BTNSHADOW;
break;
case ColorID::TextBackground:
idx = COLOR_WINDOW;
break;
case ColorID::TextForeground:
idx = COLOR_WINDOWTEXT;
break;
case ColorID::TextSelectBackground:
case ColorID::IMESelectedRawTextBackground:
case ColorID::IMESelectedConvertedTextBackground:
idx = COLOR_HIGHLIGHT;
break;
case ColorID::TextSelectForeground:
case ColorID::IMESelectedRawTextForeground:
case ColorID::IMESelectedConvertedTextForeground:
idx = COLOR_HIGHLIGHTTEXT;
break;
case ColorID::IMERawInputBackground:
case ColorID::IMEConvertedTextBackground:
aColor = NS_TRANSPARENT;
return NS_OK;
case ColorID::IMERawInputForeground:
case ColorID::IMEConvertedTextForeground:
aColor = NS_SAME_AS_FOREGROUND_COLOR;
return NS_OK;
case ColorID::IMERawInputUnderline:
case ColorID::IMEConvertedTextUnderline:
aColor = NS_SAME_AS_FOREGROUND_COLOR;
return NS_OK;
case ColorID::IMESelectedRawTextUnderline:
case ColorID::IMESelectedConvertedTextUnderline:
aColor = NS_TRANSPARENT;
return NS_OK;
case ColorID::SpellCheckerUnderline:
aColor = NS_RGB(0xff, 0, 0);
return NS_OK;
// New CSS 2 Color definitions
case ColorID::Activeborder:
idx = COLOR_ACTIVEBORDER;
break;
case ColorID::Activecaption:
idx = COLOR_ACTIVECAPTION;
break;
case ColorID::Appworkspace:
idx = COLOR_APPWORKSPACE;
break;
case ColorID::Background:
idx = COLOR_BACKGROUND;
break;
case ColorID::Buttonface:
case ColorID::MozButtonhoverface:
idx = COLOR_BTNFACE;
break;
case ColorID::Buttonhighlight:
idx = COLOR_BTNHIGHLIGHT;
break;
case ColorID::Buttonshadow:
idx = COLOR_BTNSHADOW;
break;
case ColorID::Buttontext:
case ColorID::MozButtonhovertext:
idx = COLOR_BTNTEXT;
break;
case ColorID::Captiontext:
idx = COLOR_CAPTIONTEXT;
break;
case ColorID::Graytext:
idx = COLOR_GRAYTEXT;
break;
case ColorID::Highlight:
case ColorID::MozAccentColor:
case ColorID::MozHtmlCellhighlight:
case ColorID::MozMenuhover:
idx = COLOR_HIGHLIGHT;
break;
case ColorID::MozMenubarhovertext:
if (!nsUXThemeData::IsAppThemed()) {
idx = nsUXThemeData::AreFlatMenusEnabled() ? COLOR_HIGHLIGHTTEXT
: COLOR_MENUTEXT;
break;
}
// Fall through
case ColorID::MozMenuhovertext:
if (mHasColorMenuHoverText) {
aColor = mColorMenuHoverText;
return NS_OK;
}
// Fall through
case ColorID::Highlighttext:
case ColorID::MozAccentColorForeground:
case ColorID::MozHtmlCellhighlighttext:
idx = COLOR_HIGHLIGHTTEXT;
break;
case ColorID::Inactiveborder:
idx = COLOR_INACTIVEBORDER;
break;
case ColorID::Inactivecaption:
idx = COLOR_INACTIVECAPTION;
break;
case ColorID::Inactivecaptiontext:
idx = COLOR_INACTIVECAPTIONTEXT;
break;
case ColorID::Infobackground:
idx = COLOR_INFOBK;
break;
case ColorID::Infotext:
idx = COLOR_INFOTEXT;
break;
case ColorID::Menu:
idx = COLOR_MENU;
break;
case ColorID::Menutext:
case ColorID::MozMenubartext:
idx = COLOR_MENUTEXT;
break;
case ColorID::Scrollbar:
idx = COLOR_SCROLLBAR;
break;
case ColorID::Threeddarkshadow:
idx = COLOR_3DDKSHADOW;
break;
case ColorID::Threedface:
idx = COLOR_3DFACE;
break;
case ColorID::Threedhighlight:
idx = COLOR_3DHIGHLIGHT;
break;
case ColorID::Threedlightshadow:
idx = COLOR_3DLIGHT;
break;
case ColorID::Threedshadow:
idx = COLOR_3DSHADOW;
break;
case ColorID::Window:
idx = COLOR_WINDOW;
break;
case ColorID::Windowframe:
idx = COLOR_WINDOWFRAME;
break;
case ColorID::Windowtext:
idx = COLOR_WINDOWTEXT;
break;
case ColorID::MozEventreerow:
case ColorID::MozOddtreerow:
case ColorID::Field:
case ColorID::MozCombobox:
idx = COLOR_WINDOW;
break;
case ColorID::Fieldtext:
case ColorID::MozComboboxtext:
idx = COLOR_WINDOWTEXT;
break;
case ColorID::MozDialog:
case ColorID::MozCellhighlight:
idx = COLOR_3DFACE;
break;
case ColorID::MozWinAccentcolor:
if (mHasColorAccent) {
aColor = mColorAccent;
} else {
// Seems to be the default color (hardcoded because of bug 1065998)
aColor = NS_RGB(158, 158, 158);
}
return NS_OK;
case ColorID::MozWinAccentcolortext:
if (mHasColorAccentText) {
aColor = mColorAccentText;
} else {
aColor = NS_RGB(0, 0, 0);
}
return NS_OK;
case ColorID::MozWinMediatext:
if (mHasColorMediaText) {
aColor = mColorMediaText;
return NS_OK;
}
// if we've gotten here just return -moz-dialogtext instead
idx = COLOR_WINDOWTEXT;
break;
case ColorID::MozWinCommunicationstext:
if (mHasColorCommunicationsText) {
aColor = mColorCommunicationsText;
return NS_OK;
}
// if we've gotten here just return -moz-dialogtext instead
idx = COLOR_WINDOWTEXT;
break;
case ColorID::MozDialogtext:
case ColorID::MozCellhighlighttext:
case ColorID::MozColheadertext:
case ColorID::MozColheaderhovertext:
idx = COLOR_WINDOWTEXT;
break;
case ColorID::MozDragtargetzone:
idx = COLOR_HIGHLIGHTTEXT;
break;
case ColorID::MozButtondefault:
idx = COLOR_3DDKSHADOW;
break;
case ColorID::MozNativehyperlinktext:
idx = COLOR_HOTLIGHT;
break;
default:
NS_WARNING("Unknown color for nsLookAndFeel");
idx = COLOR_WINDOW;
res = NS_ERROR_FAILURE;
break;
}
aColor = GetColorForSysColorIndex(idx);
return res;
}
Minimal test - lines (111, 111)
path: .spaces[5].metrics.loc.sloc
old: 89.0
new: 1.0
path: .spaces[5].metrics.loc.blank
old: 5.0
new: 0.0
path: .spaces[5].metrics.loc.cloc
old: 20.0
new: 0.0
path: .spaces[5].metrics.loc.lloc
old: 34.0
new: 0.0
path: .spaces[5].metrics.loc.ploc
old: 64.0
new: 1.0
path: .spaces[5].metrics.nargs.average
old: 0.4
new: 0.0
path: .spaces[5].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[5].metrics.nom.closures
old: 4.0
new: 0.0
path: .spaces[5].metrics.nom.total
old: 5.0
new: 1.0
path: .spaces[5].metrics.mi.mi_sei
old: 39.55103861055529
new: 152.37629276875444
path: .spaces[5].metrics.mi.mi_visual_studio
old: 33.094095893082006
new: 92.40962204246613
path: .spaces[5].metrics.mi.mi_original
old: 56.59090397717023
new: 158.02045369261705
path: .spaces[5].metrics.halstead.purity_ratio
old: 1.5449390145775217
new: 1.6
path: .spaces[5].metrics.halstead.N1
old: 251.0
new: 4.0
path: .spaces[5].metrics.halstead.vocabulary
old: 109.0
new: 5.0
path: .spaces[5].metrics.halstead.n2
old: 89.0
new: 1.0
path: .spaces[5].metrics.halstead.n1
old: 20.0
new: 4.0
path: .spaces[5].metrics.halstead.time
old: 3226.167861477001
new: 1.289960052715201
path: .spaces[5].metrics.halstead.difficulty
old: 20.0
new: 2.0
path: .spaces[5].metrics.halstead.level
old: 0.05
new: 0.5
path: .spaces[5].metrics.halstead.volume
old: 2903.551075329301
new: 11.60964047443681
path: .spaces[5].metrics.halstead.bugs
old: 0.4998638413851954
new: 0.002712967490108627
path: .spaces[5].metrics.halstead.N2
old: 178.0
new: 1.0
path: .spaces[5].metrics.halstead.estimated_program_length
old: 662.7788372537567
new: 8.0
path: .spaces[5].metrics.halstead.effort
old: 58071.021506586025
new: 23.21928094887362
path: .spaces[5].metrics.halstead.length
old: 429.0
new: 5.0
path: .spaces[5].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[5].metrics.nexits.average
old: 0.4
new: 0.0
Code
nsLookAndFeel::~nsLookAndFeel() {}
Minimal test - lines (60, 90)
path: .spaces[3].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[3].metrics.nexits.sum
old: 1.0
new: 4.0
path: .spaces[3].metrics.nexits.average
old: 0.5
new: 4.0
path: .spaces[3].metrics.loc.cloc
old: 4.0
new: 0.0
path: .spaces[3].metrics.loc.ploc
old: 21.0
new: 27.0
path: .spaces[3].metrics.loc.lloc
old: 8.0
new: 12.0
path: .spaces[3].metrics.loc.sloc
old: 29.0
new: 31.0
path: .spaces[3].metrics.nom.total
old: 2.0
new: 1.0
path: .spaces[3].metrics.nom.closures
old: 1.0
new: 0.0
path: .spaces[3].metrics.cyclomatic.sum
old: 1.0
new: 5.0
path: .spaces[3].metrics.cyclomatic.average
old: 1.0
new: 5.0
path: .spaces[3].metrics.cognitive.sum
old: 0.0
new: 4.0
path: .spaces[3].metrics.cognitive.average
old: 0.0
new: 4.0
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.867557222069672
new: 1.5858453293797494
path: .spaces[3].metrics.halstead.time
old: 435.1400129189287
new: 367.8651411159691
path: .spaces[3].metrics.halstead.bugs
old: 0.13146589293350125
new: 0.11754013162629628
path: .spaces[3].metrics.halstead.N1
old: 73.0
new: 61.0
path: .spaces[3].metrics.halstead.estimated_program_length
old: 231.57709553663932
new: 163.3420689261142
path: .spaces[3].metrics.halstead.vocabulary
old: 49.0
new: 38.0
path: .spaces[3].metrics.halstead.difficulty
old: 11.25
new: 12.25
path: .spaces[3].metrics.halstead.n1
old: 15.0
new: 14.0
path: .spaces[3].metrics.halstead.length
old: 124.0
new: 103.0
path: .spaces[3].metrics.halstead.volume
old: 696.2240206702859
new: 540.5365338846893
path: .spaces[3].metrics.halstead.level
old: 0.08888888888888889
new: 0.08163265306122448
path: .spaces[3].metrics.halstead.n2
old: 34.0
new: 24.0
path: .spaces[3].metrics.halstead.N2
old: 51.0
new: 42.0
path: .spaces[3].metrics.halstead.effort
old: 7832.520232540716
new: 6621.572540087444
path: .spaces[3].metrics.mi.mi_original
old: 82.18231587212952
new: 81.49808370407487
path: .spaces[3].metrics.mi.mi_sei
old: 70.17166125542369
new: 42.38512850683202
path: .spaces[3].metrics.mi.mi_visual_studio
old: 48.0598338433506
new: 47.659698072558406
Code
static nsresult SystemWantsDarkTheme(int32_t& darkThemeEnabled) {
if (!IsWin10OrLater()) {
darkThemeEnabled = 0;
return NS_OK;
}
nsresult rv = NS_OK;
nsCOMPtr personalizeKey =
do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
rv = personalizeKey->Open(
nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
nsLiteralString(
u"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"),
nsIWindowsRegKey::ACCESS_QUERY_VALUE);
if (NS_FAILED(rv)) {
return rv;
}
uint32_t lightThemeEnabled;
rv =
personalizeKey->ReadIntValue(u"AppsUseLightTheme"_ns, &lightThemeEnabled);
if (NS_SUCCEEDED(rv)) {
darkThemeEnabled = !lightThemeEnabled;
}
return rv;
}
Minimal test - lines (624, 639)
path: .spaces[10].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[10].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[10].metrics.halstead.N2
old: 51.0
new: 20.0
path: .spaces[10].metrics.halstead.level
old: 0.10784313725490197
new: 0.08571428571428572
path: .spaces[10].metrics.halstead.bugs
old: 0.0796718100811434
new: 0.06788693109250382
path: .spaces[10].metrics.halstead.estimated_program_length
old: 46.05374780501027
new: 96.32251891746031
path: .spaces[10].metrics.halstead.volume
old: 398.5028407520689
new: 249.12330506147785
path: .spaces[10].metrics.halstead.n1
old: 4.0
new: 14.0
path: .spaces[10].metrics.halstead.effort
old: 3695.208159701003
new: 2906.438559050575
path: .spaces[10].metrics.halstead.n2
old: 11.0
new: 12.0
path: .spaces[10].metrics.halstead.length
old: 102.0
new: 53.0
path: .spaces[10].metrics.halstead.purity_ratio
old: 0.45150733142166927
new: 1.817406017310572
path: .spaces[10].metrics.halstead.N1
old: 51.0
new: 33.0
path: .spaces[10].metrics.halstead.time
old: 205.2893422056113
new: 161.46880883614304
path: .spaces[10].metrics.halstead.difficulty
old: 9.272727272727272
new: 11.666666666666666
path: .spaces[10].metrics.halstead.vocabulary
old: 15.0
new: 26.0
path: .spaces[10].metrics.loc.sloc
old: 18.0
new: 16.0
path: .spaces[10].metrics.loc.blank
old: 3.0
new: 1.0
path: .spaces[10].metrics.loc.lloc
old: 12.0
new: 11.0
path: .spaces[10].metrics.mi.mi_visual_studio
old: 54.274772785164934
new: 56.55013639181912
path: .spaces[10].metrics.mi.mi_original
old: 92.80986146263204
new: 96.7007332300107
path: .spaces[10].metrics.mi.mi_sei
old: 58.29729474512264
new: 64.11427586746363
path: .spaces[10].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[10].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[10].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[10].metrics.nexits.average
old: 0.0
new: 1.0
Code
nsresult nsLookAndFeel::NativeGetFloat(FloatID aID, float& aResult) {
nsresult res = NS_OK;
switch (aID) {
case FloatID::IMEUnderlineRelativeSize:
aResult = 1.0f;
break;
case FloatID::SpellCheckerUnderlineRelativeSize:
aResult = 1.0f;
break;
default:
aResult = -1.0;
res = NS_ERROR_FAILURE;
}
return res;
}