before_code stringlengths 30 149k | reviewer_comment stringlengths 16 20.6k | after_code stringlengths 30 163k | diff_context stringlengths 0 22.4k | file_path stringlengths 6 155 | comment_line int64 0 26 | language stringclasses 19
values | quality_score float64 0.07 1 | comment_type stringclasses 9
values | comment_length int64 16 20.6k | before_lines int64 2 4.61k | after_lines int64 2 4.4k | is_negative bool 2
classes | pr_title stringlengths 7 140 | pr_number int64 18 61.2k | repo_name stringclasses 29
values | repo_stars int64 321 56k | repo_language stringclasses 14
values | reviewer_username stringclasses 378
values | author_username stringclasses 739
values | user stringlengths 361 200k | assistant stringlengths 16 20.6k | system stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_parent.SelectionStart = selectionStart;
_parent.SelectionEnd = selectionEnd;
RaiseSelectionChanged();
}
}
public override bool SupportsPreedit => true;
public override bool SupportsSurroundingText => true;
public void SetP... | No issues found. |
_parent.SelectionStart = selectionStart;
_parent.SelectionEnd = selectionEnd;
RaiseSelectionChanged();
}
}
public override bool SupportsPreedit => true;
public override bool SupportsSurroundingText => true;
public void SetP... | @@ -13,7 +13,6 @@ internal class TextBoxTextInputMethodClient : TextInputMethodClient
private TextPresenter? _presenter;
private bool _selectionChanged;
private bool _isInChange;
- private ITextInputMethodImpl? _im;
public override Visual TextViewVisual => _presenter!;
@@ ... | src/Avalonia.Controls/TextBoxTextInputMethodClient.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Revert 15603, add InputPaneActivationRequested in TextInputMethodClient | 19,225 | AvaloniaUI/Avalonia | 24,333 | C# | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/TextBoxTextInputMethodClient.cs
PR Title: Revert 15603, add InputPaneActivationRequested in TextInputMethodClient
BEFORE CODE:
_parent.SelectionStart = selectionStart;
_parent.SelectionEnd = selectionEnd;
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
SetParameters(true, false, true, true, true);
var showNewWindowDecorations = Session.FindElementByAccessibilityId("ShowNewWindowDecorations");
showNewWindowDecorations.Click();
Thread.Sleep(1000);
var secondaryWindow = Session.GetWindowById("SecondaryWi... | No issues found. | SetParameters(true, false, true, true, true);
var showNewWindowDecorations = Session.FindElementByAccessibilityId("ShowNewWindowDecorations");
showNewWindowDecorations.Click();
Thread.Sleep(1000);
var secondaryWindow = Session.GetWindowById("SecondaryWi... | @@ -0,0 +1,89 @@
+using System;
+using System.Threading;
+using OpenQA.Selenium.Appium;
+using OpenQA.Selenium.Interactions;
+using Xunit;
+
+namespace Avalonia.IntegrationTests.Appium;
+
+[Collection("WindowDecorations")]
+public class PointerTests_MacOS : TestBase, IDisposable
+{
+ public PointerTests_MacOS(Defaul... | tests/Avalonia.IntegrationTests.Appium/PointerTests_MacOS.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fixes/osx thick titlebar pointer events streaming, (tabs interface) #15696 | 19,320 | AvaloniaUI/Avalonia | 24,333 | C# | ErtyHackward | Review this pull request change.
Language: C#
File: tests/Avalonia.IntegrationTests.Appium/PointerTests_MacOS.cs
PR Title: Fixes/osx thick titlebar pointer events streaming, (tabs interface) #15696
BEFORE CODE: SetParameters(true, false, true, true, true);
var showNewWindowDecorations = Ses... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
{
// iOS doesn't add any paddings/margins to the application by itself.
// Application is fully responsible for safe area paddings.
// So, unlikely to android, we need to "fake" safe area insets when edge to edge is disabled.
... | No issues found. | {
// iOS doesn't add any paddings/margins to the application by itself.
// Application is fully responsible for safe area paddings.
// So, unlikely to android, we need to "fake" safe area insets when edge to edge is disabled.
... | @@ -76,6 +76,17 @@ public AvaloniaView()
{
#if !TVOS
MultipleTouchEnabled = true;
+
+ if (OperatingSystem.IsIOSVersionAtLeast(13, 4) || OperatingSystem.IsMacCatalyst())
+ {
+ var scrollGestureRecognizer = new UIPanGestureRec... | src/iOS/Avalonia.iOS/AvaloniaView.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | [iOS] Enable Pointer/Trackpad scrolling | 19,342 | AvaloniaUI/Avalonia | 24,333 | C# | drasticactions | Review this pull request change.
Language: C#
File: src/iOS/Avalonia.iOS/AvaloniaView.cs
PR Title: [iOS] Enable Pointer/Trackpad scrolling
BEFORE CODE: {
// iOS doesn't add any paddings/margins to the application by itself.
// Application is fully responsible ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
[Fact]
public void FormatString_Is_Applied_Immediately()
{
RunTest((control, textbox) =>
{
const decimal value = 10.11m;
// Establish and verify initial conditions.
control.FormatString = "F0";
co... | No issues found. | }
[Fact]
public void FormatString_Is_Applied_Immediately()
{
RunTest((control, textbox) =>
{
const decimal value = 10.11m;
// Establish and verify initial conditions.
control.FormatString = "F0";
co... | @@ -152,5 +152,22 @@ private static IControlTemplate CreateTemplate()
}.RegisterInNameScope(scope);
});
}
+
+ [Fact]
+ public void TabIndex_Should_Be_Synchronized_With_Inner_TextBox()
+ {
+ RunTest((control, textbox) =>
+ {
+ ... | tests/Avalonia.Controls.UnitTests/NumericUpDownTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Track TabIndex value in NumericUpDown | 19,348 | AvaloniaUI/Avalonia | 24,333 | C# | drasticactions | Review this pull request change.
Language: C#
File: tests/Avalonia.Controls.UnitTests/NumericUpDownTests.cs
PR Title: Track TabIndex value in NumericUpDown
BEFORE CODE: }
[Fact]
public void FormatString_Is_Applied_Immediately()
{
RunTest((control, textbox) =>
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
[SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", Justification = "Using Win32 naming for consistency.")]
private IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{
if (msg == (int)WindowsMessage.WM_DISPATCH_... | No issues found. |
[SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", Justification = "Using Win32 naming for consistency.")]
private IntPtr WndProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
{
if (msg == (int)WindowsMessage.WM_DISPATCH_... | @@ -218,6 +218,8 @@ private void CreateMessageWindow()
{
throw new Win32Exception();
}
+
+ TrayIconImpl.ChangeWindowMessageFilter(_hwnd);
}
public ITrayIconImpl CreateTrayIcon() | src/Windows/Avalonia.Win32/Win32Platform.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Enable tray icon creation in all circumstances when running as an admin | 19,382 | AvaloniaUI/Avalonia | 24,333 | C# | Wesley-Lin-coder | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/Win32Platform.cs
PR Title: Enable tray icon creation in all circumstances when running as an admin
BEFORE CODE:
[SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1305:FieldNamesMustNotUseHungarianNotation", Justificat... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
public void RemoveListener(INotifyCollectionChanged collection, ICollectionChangedListener listener)
{
collection = collection ?? throw new ArgumentNullException(nameof(collection));
listener = listener ?? throw new ArgumentNullException(nameof(listener));
Dispatcher... | No issues found. |
public void RemoveListener(INotifyCollectionChanged collection, ICollectionChangedListener listener)
{
collection = collection ?? throw new ArgumentNullException(nameof(collection));
listener = listener ?? throw new ArgumentNullException(nameof(listener));
Dispatcher... | @@ -132,18 +132,22 @@ static void Notify(
}
}
- var l = Listeners.ToArray();
-
if (Dispatcher.UIThread.CheckAccess())
{
+ var l = Listeners.ToArray();
Notify(_collection, e, l);
... | src/Avalonia.Controls/Utils/CollectionChangedEventManager.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | WeakEvent subscription management thread race condition fix | 19,383 | AvaloniaUI/Avalonia | 24,333 | C# | 11v1 | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Utils/CollectionChangedEventManager.cs
PR Title: WeakEvent subscription management thread race condition fix
BEFORE CODE:
public void RemoveListener(INotifyCollectionChanged collection, ICollectionChangedListener listener)
{
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
.With(globalClock: new MockGlobalClock()));
var wnd = new Window
{
Width = 1280,
Height = 720
};
var splitView = new SplitView();
wnd.Content = splitView;
wnd.Show();
splitView.IsPaneOpen... | No issues found. | .With(globalClock: new MockGlobalClock()));
var wnd = new Window
{
Width = 1280,
Height = 720
};
var splitView = new SplitView();
wnd.Content = splitView;
wnd.Show();
splitView.IsPaneOpen... | @@ -303,5 +303,45 @@ public void With_Default_IsPaneOpen_Value_Should_Have_Closed_Pseudo_Class_Set()
Assert.Contains(splitView.Classes, ":closed".Equals);
}
+
+ [Fact]
+ public void SplitView_Shouldnt_Close_Panel_When_IsPaneOpen_True_Then_Display_Mode_Changed()
+ {
+... | tests/Avalonia.Controls.UnitTests/SplitViewTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fix SplitView incorrectly closing when the user changes DisplayMode to inline when IsPaneOpen is already true | 19,460 | AvaloniaUI/Avalonia | 24,333 | C# | danwalmsley | Review this pull request change.
Language: C#
File: tests/Avalonia.Controls.UnitTests/SplitViewTests.cs
PR Title: Fix SplitView incorrectly closing when the user changes DisplayMode to inline when IsPaneOpen is already true
BEFORE CODE: .With(globalClock: new MockGlobalClock()));
var wnd... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// https://github.com/AvaloniaUI/Avalonia/issues/12676
[Fact]
public void Similar_Runs_Have_Same_InkBounds_After_Blob_Creation()
{
using (Start())
{
var typeface = new Typeface("resm:Avalonia.Skia.UnitTests.Assets?assembly=Avalonia.Skia.UnitTests#I... | No issues found. | // https://github.com/AvaloniaUI/Avalonia/issues/12676
[Fact]
public void Similar_Runs_Have_Same_InkBounds_After_Blob_Creation()
{
using (Start())
{
var typeface = new Typeface("resm:Avalonia.Skia.UnitTests.Assets?assembly=Avalonia.Skia.UnitTests#I... | @@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
+using System.Linq;
using Avalonia.Media;
using Avalonia.Media.TextFormatting;
using Avalonia.UnitTests;
@@ -191,6 +192,94 @@ public void GlyphRun_With_Leading_Space_Has_Correct_InkBounds()
}
}
+ ... | tests/Avalonia.Skia.UnitTests/Media/GlyphRunTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fix zero width space handling | 19,488 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | Review this pull request change.
Language: C#
File: tests/Avalonia.Skia.UnitTests/Media/GlyphRunTests.cs
PR Title: Fix zero width space handling
BEFORE CODE: // https://github.com/AvaloniaUI/Avalonia/issues/12676
[Fact]
public void Similar_Runs_Have_Same_InkBounds_After_Blob_Creation()
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
var defaultProperties = new GenericTextRunProperties(typeface, 32, foregroundBrush: Brushes.Black);
var styleSpans = new[]
{
new ValueSpan<TextRunProperties>(0, 5,
new GenericTextRunProperties(typeface, 48)),
... | No issues found. | var defaultProperties = new GenericTextRunProperties(typeface, 32, foregroundBrush: Brushes.Black);
var styleSpans = new[]
{
new ValueSpan<TextRunProperties>(0, 5,
new GenericTextRunProperties(typeface, 48)),
... | @@ -1088,6 +1088,32 @@ public void Should_Wrap_Chinese()
}
}
+ [Fact]
+ public void Should_MatchCharacter_For_Spacing_CombiningMark()
+ {
+ using (Start())
+ {
+ var text = "𖾇";
+
+ var typeface = new Typeface(new FontFami... | tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Do not treat combining marks as whitespace | 19,498 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | Review this pull request change.
Language: C#
File: tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextFormatterTests.cs
PR Title: Do not treat combining marks as whitespace
BEFORE CODE: var defaultProperties = new GenericTextRunProperties(typeface, 32, foregroundBrush: Brushes.Black);
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
/// <returns>
/// An <see cref="IImmutableSolidColorBrush"/> instance representing the specified color.
/// Brushes created from known colors are cached and reused for efficiency.
/// </returns>
public static IImmutableSolidColorBrush ToBrush(this KnownColor color)
{
... | No issues found. | /// <returns>
/// An <see cref="IImmutableSolidColorBrush"/> instance representing the specified color.
/// Brushes created from known colors are cached and reused for efficiency.
/// </returns>
public static IImmutableSolidColorBrush ToBrush(this KnownColor color)
{
... | @@ -1,8 +1,7 @@
using System;
-using System.Reflection;
using System.Collections.Generic;
-using Avalonia.SourceGenerator;
using System.Diagnostics.CodeAnalysis;
+using Avalonia.SourceGenerator;
namespace Avalonia.Media
{
@@ -45,13 +44,47 @@ static KnownColors()
}
#if !BUILDTASK
+
+ /// <summa... | src/Avalonia.Base/Media/KnownColors.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Update Brush.Parse() to Handle all Color Formats | 19,526 | AvaloniaUI/Avalonia | 24,333 | C# | robloo | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Media/KnownColors.cs
PR Title: Update Brush.Parse() to Handle all Color Formats
BEFORE CODE: /// <returns>
/// An <see cref="IImmutableSolidColorBrush"/> instance representing the specified color.
/// Brushes created from ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
[Fact]
public void Should_Parse_FontFamily_With_Resource_Folder()
{
var source = new Uri("resm:Avalonia.Visuals.UnitTests#MyFont");
var key = new FontFamilyKey(source);
var fontFamily = FontFamily.Parse(source.OriginalString);
Assert.... | No issues found. | }
[Fact]
public void Should_Parse_FontFamily_With_Resource_Folder()
{
var source = new Uri("resm:Avalonia.Visuals.UnitTests#MyFont");
var key = new FontFamilyKey(source);
var fontFamily = FontFamily.Parse(source.OriginalString);
Assert.... | @@ -121,18 +121,90 @@ public void Should_Create_FontFamily_From_Uri(string name)
}
[Theory]
- [InlineData("resm:Avalonia.Visuals.UnitTests.Assets.Fonts", "#MyFont")]
- [InlineData("avares://Avalonia.Visuals.UnitTests/Assets/Fonts", "#MyFont")]
+ [InlineData(null, "resm:Avalonia.... | tests/Avalonia.Base.UnitTests/Media/FontFamilyTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | FontLoading adjustments | 19,538 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | Review this pull request change.
Language: C#
File: tests/Avalonia.Base.UnitTests/Media/FontFamilyTests.cs
PR Title: FontLoading adjustments
BEFORE CODE: }
[Fact]
public void Should_Parse_FontFamily_With_Resource_Folder()
{
var source = new Uri("resm:Avalonia.Visuals.Uni... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media;
namespace Avalonia.Headless.UnitTests;
public class LeakTests
{
public static IEnumerable<object[]> TestData { get; } =
Enumerable.Range(0, 50).Select(i => new object[] { i.ToString() ... | No issues found. | using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media;
namespace Avalonia.Headless.UnitTests;
public class LeakTests
{
public static IEnumerable<object[]> TestData { get; } =
Enumerable.Range(0, 50).Select(i => new object[] { i.ToString() ... | @@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Media;
+
+namespace Avalonia.Headless.UnitTests;
+
+public class LeakTests
+{
+ public static IEnumerable<object[]> TestData { get; } =
+ Enumerable.Range(0, ... | tests/Avalonia.Headless.UnitTests/LeakTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fix headless FontManager leak | 19,599 | AvaloniaUI/Avalonia | 24,333 | C# | maxkatz6 | Review this pull request change.
Language: C#
File: tests/Avalonia.Headless.UnitTests/LeakTests.cs
PR Title: Fix headless FontManager leak
BEFORE CODE: using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media;
namespace Avalonia.Headless.UnitTests;
p... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
result[result.Count - 1] = currentBounds;
}
else
{
result.Add(currentBounds);
}
lastBounds = currentBounds;
if(coveredLength <= 0)
{
throw new In... | No issues found. |
result[result.Count - 1] = currentBounds;
}
else
{
result.Add(currentBounds);
}
lastBounds = currentBounds;
if(coveredLength <= 0)
{
throw new In... | @@ -916,7 +916,7 @@ private TextBounds GetTextRunBoundsRightToLeft(int firstRunIndex, int lastRunInd
if (currentRun is ShapedTextRun shapedTextRun)
{
- var runBounds = GetRunBoundsRightToLeft(shapedTextRun, startX, firstTextSourceIndex, remainingLength, currentPosi... | src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | TextLine.GetTextBounds zero width run fixes | 19,602 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs
PR Title: TextLine.GetTextBounds zero width run fixes
BEFORE CODE:
result[result.Count - 1] = currentBounds;
}
else
{
re... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
else
{
result.Add(currentBounds);
}
lastBounds = currentBounds;
if(coveredLength <= 0)
{
throw new InvalidOperationException("Covered length must be greater than zero.");
... | No issues found. | else
{
result.Add(currentBounds);
}
lastBounds = currentBounds;
if(coveredLength <= 0)
{
throw new InvalidOperationException("Covered length must be greater than zero.");
... | @@ -1118,23 +1118,29 @@ private TextRunBounds GetRunBounds(ShapedTextRun currentRun, double currentX, in
}
// Find the start of the hit
- var startHit = currentRun.GlyphRun.GetCharacterHitFromDistance(startOffset, out _);
- var startHitIndex = startHit.FirstCharacterInd... | src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fixes TextLineImpl.GetTextBounds with trailing zero width | 19,616 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs
PR Title: Fixes TextLineImpl.GetTextBounds with trailing zero width
BEFORE CODE: else
{
result.Add(currentBounds);
}
lastBou... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
public BoxShadow Current => _shadows[_index];
public bool MoveNext()
{
_index++;
return _index < _shadows.Count;
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public BoxShadowsEnumerator GetEnumerator() => new... | No issues found. |
public BoxShadow Current => _shadows[_index];
public bool MoveNext()
{
_index++;
return _index < _shadows.Count;
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public BoxShadowsEnumerator GetEnumerator() => new... | @@ -1,42 +1,74 @@
using System;
using System.ComponentModel;
-using Avalonia.Animation.Animators;
using Avalonia.Utilities;
namespace Avalonia.Media
{
+ /// <summary>
+ /// Represents a collection of <see cref="BoxShadow"/>s.
+ /// </summary>
public struct BoxShadows
{
+ private static ... | src/Avalonia.Base/Media/BoxShadows.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Add Boxshadow(s) Documentation Comments | 19,644 | AvaloniaUI/Avalonia | 24,333 | C# | robloo | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Media/BoxShadows.cs
PR Title: Add Boxshadow(s) Documentation Comments
BEFORE CODE:
public BoxShadow Current => _shadows[_index];
public bool MoveNext()
{
_index++;
return _inde... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
{
var target = new TextBlock();
var run = new Run("Hello");
target.Inlines.Add(run);
target.Measure(Size.Infinity);
Assert.True(target.I... | No issues found. | using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
{
var target = new TextBlock();
var run = new Run("Hello");
target.Inlines.Add(run);
target.Measure(Size.Infinity);
Assert.True(target.I... | @@ -348,7 +348,7 @@ public void Changing_Inlines_Should_Reset_InlineUIContainer_VisualParent_On_Meas
}
[Fact]
- public void InlineUIContainer_Child_Schould_Be_Arranged()
+ public void InlineUIContainer_Child_Should_Be_Arranged()
{
using (UnitTestApplication.Start(... | tests/Avalonia.Controls.UnitTests/TextBlockTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Limit InlineUIContainer to available width | 19,651 | AvaloniaUI/Avalonia | 24,333 | C# | miloush | Review this pull request change.
Language: C#
File: tests/Avalonia.Controls.UnitTests/TextBlockTests.cs
PR Title: Limit InlineUIContainer to available width
BEFORE CODE: using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
{
var target = new TextBlock()... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
public void Capture(IInputElement? control)
{
Capture(control, platformInitiated: false);
}
private void Capture(IInputElement? control, bool platformInitiated)
{
if (Captured is Visual v1)
v1.DetachedFromVisualTree -= OnCaptureDetached;
... | No issues found. |
public void Capture(IInputElement? control)
{
Capture(control, platformInitiated: false);
}
private void Capture(IInputElement? control, bool platformInitiated)
{
if (Captured is Visual v1)
v1.DetachedFromVisualTree -= OnCaptureDetached;
... | @@ -32,14 +32,28 @@ protected virtual void PlatformCapture(IInputElement? element)
{
}
-
+
+ internal void PlatformCaptureLost()
+ {
+ if (Captured != null)
+ Capture(null, platformInitiated: true);
+ }
+
public void Capture... | src/Avalonia.Base/Input/Pointer.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Respond to WM_CAPTURECHANGED | 19,685 | AvaloniaUI/Avalonia | 24,333 | C# | miloush | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/Pointer.cs
PR Title: Respond to WM_CAPTURECHANGED
BEFORE CODE:
public void Capture(IInputElement? control)
{
Capture(control, platformInitiated: false);
}
private void Capture(IInputElement? con... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
START_COM_CALL;
if(![NSThread isMainThread])
return COR_E_INVALIDOPERATION;
if (View == NULL)
return E_FAIL;
auto target = [[MetalRenderTarget alloc] initWithDevice: device];
[View setRenderTarget: target];
[target getRenderTarget: ppv];
return S_OK;
}
HRESULT TopLevelImp... | No issues found. | START_COM_CALL;
if(![NSThread isMainThread])
return COR_E_INVALIDOPERATION;
if (View == NULL)
return E_FAIL;
auto target = [[MetalRenderTarget alloc] initWithDevice: device];
[View setRenderTarget: target];
[target getRenderTarget: ppv];
return S_OK;
}
HRESULT TopLevelImp... | @@ -6,6 +6,7 @@
#include "TopLevelImpl.h"
#include "AvnTextInputMethod.h"
#include "AvnView.h"
+#include "common.h"
TopLevelImpl::~TopLevelImpl() {
View = nullptr;
@@ -271,6 +272,54 @@
}
+HRESULT TopLevelImpl::BeginDragAndDropOperation(AvnDragDropEffects effects, AvnPoint point, IAvnClipboard *clipb... | native/Avalonia.Native/src/OSX/TopLevelImpl.mm | 0 | Objective-C++ | 1 | none | 16 | 51 | 51 | true | [OSX] Move Drag and Drop logic to TopLevelImpl | 19,731 | AvaloniaUI/Avalonia | 24,333 | C# | drasticactions | Review this pull request change.
Language: Objective-C++
File: native/Avalonia.Native/src/OSX/TopLevelImpl.mm
PR Title: [OSX] Move Drag and Drop logic to TopLevelImpl
BEFORE CODE: START_COM_CALL;
if(![NSThread isMainThread])
return COR_E_INVALIDOPERATION;
if (View == NULL)
return E_FAI... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
HitTestValues.HTBOTTOMLEFT, HitTestValues.HTBOTTOM, HitTestValues.HTBOTTOMRIGHT
};
var zoneIndex = uRow * 3 + uCol;
return hitZones[zoneIndex];
}
protected virtual IntPtr CustomCaptionProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam, ref boo... | No issues found. | HitTestValues.HTBOTTOMLEFT, HitTestValues.HTBOTTOM, HitTestValues.HTBOTTOMRIGHT
};
var zoneIndex = uRow * 3 + uCol;
return hitZones[zoneIndex];
}
protected virtual IntPtr CustomCaptionProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam, ref boo... | @@ -17,13 +17,34 @@ private HitTestValues HitTestNCA(IntPtr hWnd, IntPtr wParam, IntPtr lParam)
// Get the window rectangle.
GetWindowRect(hWnd, out var rcWindow);
+ var scaling = (uint)(RenderScaling * StandardDpi);
+ var relativeScaling = RenderScaling / PrimaryScreen... | src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Win32 - Fix margins and nc hit test for caption buttons in extend to client windows | 19,773 | AvaloniaUI/Avalonia | 24,333 | C# | emmauss | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs
PR Title: Win32 - Fix margins and nc hit test for caption buttons in extend to client windows
BEFORE CODE: HitTestValues.HTBOTTOMLEFT, HitTestValues.HTBOTTOM, HitTestValues.HTBOTTOMRIGHT
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
Assert.True(!manager.Notifications.Any(x => !x.IsClosing));
}
[Fact]
public void Show_And_Close_All_Notifications()
{
WindowNotificationManager manager = new();
manager.Show("Notification 1");
manager.Show("Notification 2");
... | No issues found. | Assert.True(!manager.Notifications.Any(x => !x.IsClosing));
}
[Fact]
public void Show_And_Close_All_Notifications()
{
WindowNotificationManager manager = new();
manager.Show("Notification 1");
manager.Show("Notification 2");
... | @@ -0,0 +1,116 @@
+using System.Linq;
+using Avalonia.Controls.Notifications;
+using Avalonia.UnitTests;
+using Xunit;
+using Notification = Avalonia.Controls.Notifications.Notification;
+
+namespace Avalonia.Controls.UnitTests
+{
+ public class WindowNotificationManagerTests : ScopedTestBase
+ {
+ [Fact]... | tests/Avalonia.Controls.UnitTests/NotificationsTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fixed ArgumentException when showing multiple notifications with the same content | 19,774 | AvaloniaUI/Avalonia | 24,333 | C# | fgsfds | Review this pull request change.
Language: C#
File: tests/Avalonia.Controls.UnitTests/NotificationsTests.cs
PR Title: Fixed ArgumentException when showing multiple notifications with the same content
BEFORE CODE: Assert.True(!manager.Notifications.Any(x => !x.IsClosing));
}
[Fact]
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
List<IDisposable>? disposables = null;
void Dispose()
{
if (disposables is null)
{
return;
}
foreach (var d in disposables)
{
d.Dispose();
}
... | No issues found. | List<IDisposable>? disposables = null;
void Dispose()
{
if (disposables is null)
{
return;
}
foreach (var d in disposables)
{
d.Dispose();
}
... | @@ -39,38 +39,59 @@ public override async Task<IReadOnlyList<IStorageFile>> OpenFilePickerAsync(File
{
return await await RunOnGlibThread(async () =>
{
- var res = await ShowDialog(options.Title, _window, GtkFileChooserAction.Open,
- options.AllowMult... | src/Avalonia.X11/NativeDialogs/GtkNativeFileDialogs.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Add Impl for SaveFilePickerWithResultAsync API | 19,783 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Review this pull request change.
Language: C#
File: src/Avalonia.X11/NativeDialogs/GtkNativeFileDialogs.cs
PR Title: Add Impl for SaveFilePickerWithResultAsync API
BEFORE CODE: List<IDisposable>? disposables = null;
void Dispose()
{
if (disposables is null)
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
case 3:
[self mouseEvent:event withType:MiddleButtonUp];
break;
case 4:
[self mouseEvent:event withType:XButton1Up];
break;
case 5:
[self mouseEvent:event withType:XButton2Up];
break;
default:
break;
... | No issues found. | case 3:
[self mouseEvent:event withType:MiddleButtonUp];
break;
case 4:
[self mouseEvent:event withType:XButton1Up];
break;
case 5:
[self mouseEvent:event withType:XButton2Up];
break;
default:
break;
... | @@ -943,7 +943,7 @@ - (id _Nullable) accessibilityHitTest:(NSPoint)point
auto window = (AvnWindow*)[self window];
auto peer = [window automationPeer];
- if (!peer->IsRootProvider())
+ if (peer == nullptr || !peer->IsRootProvider())
return nil;
auto clientPoint = [window convertPointFro... | native/Avalonia.Native/src/OSX/AvnView.mm | 0 | Objective-C++ | 1 | none | 16 | 51 | 51 | true | Add parent/automationPeer null guards on AvnWindow | 19,805 | AvaloniaUI/Avalonia | 24,333 | C# | jmacato | Review this pull request change.
Language: Objective-C++
File: native/Avalonia.Native/src/OSX/AvnView.mm
PR Title: Add parent/automationPeer null guards on AvnWindow
BEFORE CODE: case 3:
[self mouseEvent:event withType:MiddleButtonUp];
break;
case 4:
[self mouseEv... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
/// <summary>
/// Gets or sets a value that indicates whether the control is included in tab navigation.
/// </summary>
public bool IsTabStop
{
get => GetValue(IsTabStopProperty);
set => SetValue(IsTabStopProperty, value);
}
/// <inheritdo... | No issues found. | /// <summary>
/// Gets or sets a value that indicates whether the control is included in tab navigation.
/// </summary>
public bool IsTabStop
{
get => GetValue(IsTabStopProperty);
set => SetValue(IsTabStopProperty, value);
}
/// <inheritdo... | @@ -178,6 +178,14 @@ public class InputElement : Interactive, IInputElement
nameof(PointerReleased),
RoutingStrategies.Tunnel | RoutingStrategies.Bubble);
+ /// <summary>
+ /// Defines the <see cref="PointerCaptureChanging"/> routed event.
+ /// </summary>
+ ... | src/Avalonia.Base/Input/InputElement.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Internal PointerCaptureChanging event | 19,833 | AvaloniaUI/Avalonia | 24,333 | C# | miloush | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/InputElement.cs
PR Title: Internal PointerCaptureChanging event
BEFORE CODE: /// <summary>
/// Gets or sets a value that indicates whether the control is included in tab navigation.
/// </summary>
public bool... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
_resizeReason = WindowResizeReason.User;
break;
case WindowsMessage.WM_SHOWWINDOW:
OnShowHideMessage(wParam != default);
break;
case WindowsMessage.WM_SIZE:
{
var... | No issues found. | _resizeReason = WindowResizeReason.User;
break;
case WindowsMessage.WM_SHOWWINDOW:
OnShowHideMessage(wParam != default);
break;
case WindowsMessage.WM_SIZE:
{
var... | @@ -114,9 +114,9 @@ protected virtual unsafe IntPtr AppWndProc(IntPtr hWnd, uint msg, IntPtr wParam,
//Window doesn't exist anymore
_hwnd = IntPtr.Zero;
//Remove root reference to this class, so unmanaged delegate can be collected
- ... | src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Primary mouse device | 19,898 | AvaloniaUI/Avalonia | 24,333 | C# | miloush | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs
PR Title: Primary mouse device
BEFORE CODE: _resizeReason = WindowResizeReason.User;
break;
case WindowsMessage.WM_SHOWWINDOW:
OnShowHi... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
internal enum XiScrollType
{
Vertical = 1,
Horizontal = 2
}
[StructLayout(LayoutKind.Sequential)]
internal struct XITouchClassInfo
{
public int Type;
public int Sourceid;
public int Mode;
public int NumTouches;
};
[StructLayout(Layout... | No issues found. | internal enum XiScrollType
{
Vertical = 1,
Horizontal = 2
}
[StructLayout(LayoutKind.Sequential)]
internal struct XITouchClassInfo
{
public int Type;
public int Sourceid;
public int Mode;
public int NumTouches;
};
[StructLayout(Layout... | @@ -205,7 +205,7 @@ internal unsafe struct XIDeviceChangedEvent
public IntPtr Time;
public int Deviceid; /* id of the device that changed */
public int Sourceid; /* Source for the new classes. */
- public int Reason; /* Reason for the change */
+ public XiDeviceChangeReason Reas... | src/Avalonia.X11/XIStructs.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Added basic Pen support for X11 | 19,910 | AvaloniaUI/Avalonia | 24,333 | C# | flabbet | Review this pull request change.
Language: C#
File: src/Avalonia.X11/XIStructs.cs
PR Title: Added basic Pen support for X11
BEFORE CODE: internal enum XiScrollType
{
Vertical = 1,
Horizontal = 2
}
[StructLayout(LayoutKind.Sequential)]
internal struct XITouchClassInfo
{
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
[DllImport("user32.dll")]
public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32.dll")]
public static extern bool EnableMenuItem(IntPtr hMenu, uint uIDEnableItem, uint uEnable);
[DllImport("user32.dll", SetLastError = true)]
... | No issues found. | }
[DllImport("user32.dll")]
public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32.dll")]
public static extern bool EnableMenuItem(IntPtr hMenu, uint uIDEnableItem, uint uEnable);
[DllImport("user32.dll", SetLastError = true)]
... | @@ -2298,6 +2298,13 @@ public struct TRACKMOUSEEVENT
public int dwHoverTime;
}
+ // TrackMouseEvent flags
+ public const uint TME_HOVER = 0x00000001;
+ public const uint TME_LEAVE = 0x00000002;
+ public const uint TME_NONCLIENT = 0x00000010;
+ public const uint... | src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | [Win] Handle mouse movement in non-client areas of window. | 19,922 | AvaloniaUI/Avalonia | 24,333 | C# | drasticactions | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs
PR Title: [Win] Handle mouse movement in non-client areas of window.
BEFORE CODE: }
[DllImport("user32.dll")]
public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
using Microsoft.CodeAnalysis.Diagnostics;
namespace Avalonia.Generators;
internal static class GeneratorExtensions
{
public static string GetMsBuildProperty(
this AnalyzerConfigOptions options,
string name,
string defaultValue = "")
{
options.TryGetValue($"build_property.{name}... | No issues found. | using Microsoft.CodeAnalysis.Diagnostics;
namespace Avalonia.Generators;
internal static class GeneratorExtensions
{
public static string GetMsBuildProperty(
this AnalyzerConfigOptions options,
string name,
string defaultValue = "")
{
options.TryGetValue($"build_property.{name}... | @@ -1,14 +1,9 @@
-using System;
-using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Avalonia.Generators;
internal static class GeneratorExtensions
{
- private const string UnhandledErrorDescriptorId = "AXN0002";
- private const string InvalidTypeDescriptorId = "AXN0001";
-
... | src/tools/Avalonia.Generators/GeneratorExtensions.cs | 0 | C# | 1 | none | 16 | 16 | 16 | true | Improve `AvaloniaNameIncrementalGenerator` error handling | 19,934 | AvaloniaUI/Avalonia | 24,333 | C# | TomEdwardsEnscape | Review this pull request change.
Language: C#
File: src/tools/Avalonia.Generators/GeneratorExtensions.cs
PR Title: Improve `AvaloniaNameIncrementalGenerator` error handling
BEFORE CODE: using Microsoft.CodeAnalysis.Diagnostics;
namespace Avalonia.Generators;
internal static class GeneratorExtensions
{
public ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
/// <summary>
/// Evaluates the selector for a match.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="parent">
/// The parent style, if the style containing the selector is a nested style.
/// </param>
/// <param name="subsc... | No issues found. |
/// <summary>
/// Evaluates the selector for a match.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="parent">
/// The parent style, if the style containing the selector is a nested style.
/// </param>
/// <param name="subsc... | @@ -47,7 +47,7 @@ internal SelectorMatch Match(StyledElement control, IStyle? parent = null, bool
// right-to-left, so MatchUntilCombinator reverses this order because the type selector
// will be on the left.
var match = MatchUntilCombinator(control, this, parent, subscribe, out ... | src/Avalonia.Base/Styling/Selector.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fixed Selector.ValidateNestingSelector not calling overrides when iterating up through parent selectors | 19,947 | AvaloniaUI/Avalonia | 24,333 | C# | zacfromaustinpowder | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Styling/Selector.cs
PR Title: Fixed Selector.ValidateNestingSelector not calling overrides when iterating up through parent selectors
BEFORE CODE:
/// <summary>
/// Evaluates the selector for a match.
/// </summary>
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
using Avalonia.Utilities;
using Xunit;
namespace Avalonia.Base.UnitTests.Utilities;
public class UriExtensionsTests
{
[Fact]
public void Assembly_Name_From_Query_Parsed()
{
const string key = "assembly";
const string value = "Avalonia.Themes.Simple";
var uri = new Uri($"resm:Avalo... | No issues found. | using Avalonia.Utilities;
using Xunit;
namespace Avalonia.Base.UnitTests.Utilities;
public class UriExtensionsTests
{
[Fact]
public void Assembly_Name_From_Query_Parsed()
{
const string key = "assembly";
const string value = "Avalonia.Themes.Simple";
var uri = new Uri($"resm:Avalo... | @@ -40,4 +40,15 @@ public void Should_Convert_File_Path_To_Uri_And_Back(string path)
Assert.Equal(path, uri.LocalPath);
}
+
+ [Theory]
+
+ [InlineData(@"\\?\D:\abcdefgh\abcdefgh\abcdefabcdefgh\abcdefghabcdefghabcdefgha\bcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcde... | tests/Avalonia.Base.UnitTests/Utilities/UriExtensionsTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Handle long file paths in UriFromFilePath | 19,955 | AvaloniaUI/Avalonia | 24,333 | C# | startewho | Review this pull request change.
Language: C#
File: tests/Avalonia.Base.UnitTests/Utilities/UriExtensionsTests.cs
PR Title: Handle long file paths in UriFromFilePath
BEFORE CODE: using Avalonia.Utilities;
using Xunit;
namespace Avalonia.Base.UnitTests.Utilities;
public class UriExtensionsTests
{
[Fact]
pu... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
new Border { Width = 80, Height = 90 }
}
};
target.Measure(Size.Infinity);
target.Arrange(new Rect(target.DesiredSize));
// Without spacing => width = 160, height = 180
// With rowSpacing=15 => total height = 2*90 + 1*15 =... | No issues found. | new Border { Width = 80, Height = 90 }
}
};
target.Measure(Size.Infinity);
target.Arrange(new Rect(target.DesiredSize));
// Without spacing => width = 160, height = 180
// With rowSpacing=15 => total height = 2*90 + 1*15 =... | @@ -1,6 +1,7 @@
using System;
using Avalonia.Controls.Primitives;
using Avalonia.UnitTests;
+using Avalonia.Utilities;
using Xunit;
namespace Avalonia.Controls.UnitTests.Primitives
@@ -269,6 +270,62 @@ public void Grid_Respects_Spacing_When_Invisible_Child_Exists()
Assert.Equal(new Size(105, 145), ... | tests/Avalonia.Controls.UnitTests/Primitives/UniformGridTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | UniformGrid: Round measured cell sizes when UseLayoutRounding is enabled | 19,959 | AvaloniaUI/Avalonia | 24,333 | C# | Soar360 | Review this pull request change.
Language: C#
File: tests/Avalonia.Controls.UnitTests/Primitives/UniformGridTests.cs
PR Title: UniformGrid: Round measured cell sizes when UseLayoutRounding is enabled
BEFORE CODE: new Border { Width = 80, Height = 90 }
}
};
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
return false;
}
glyphTypeface = new GlyphTypefaceImpl(skTypeface, FontSimulations.None);
return true;
}
private bool TryMatchCharacter(
int codepoint,
FontStyle fontStyle,
FontWeight fontWeight,
FontS... | No issues found. |
return false;
}
glyphTypeface = new GlyphTypefaceImpl(skTypeface, FontSimulations.None);
return true;
}
private bool TryMatchCharacter(
int codepoint,
FontStyle fontStyle,
FontWeight fontWeight,
FontS... | @@ -1,8 +1,11 @@
-using System;
+#nullable enable
+
+using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
+using System.Text.RegularExpressions;
using Avalonia.Media;
using Avalonia.Platform;
using SkiaSharp;
@@ -15,6 +18,7 @@ inter... | src/Skia/Avalonia.Skia/FontManagerImpl.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Cache platform font manager TryMatchCharacter result | 19,987 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | Review this pull request change.
Language: C#
File: src/Skia/Avalonia.Skia/FontManagerImpl.cs
PR Title: Cache platform font manager TryMatchCharacter result
BEFORE CODE:
return false;
}
glyphTypeface = new GlyphTypefaceImpl(skTypeface, FontSimulations.None);
re... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
Assert.NotNull(textLine);
var textBounds = textLine.GetTextBounds(1, 1);
Assert.NotEmpty(textBounds);
textBounds = textLine.GetTextBounds(2, 1);
Assert.NotEmpty(textBounds);
textBounds = textLine.GetTextBounds(4, 1);
... | No issues found. | Assert.NotNull(textLine);
var textBounds = textLine.GetTextBounds(1, 1);
Assert.NotEmpty(textBounds);
textBounds = textLine.GetTextBounds(2, 1);
Assert.NotEmpty(textBounds);
textBounds = textLine.GetTextBounds(4, 1);
... | @@ -2285,6 +2285,29 @@ public void Should_Distribute_Extra_Space_When_LineHeight_Is_Larger_Than_Natural
}
}
+ [Fact]
+ public void Backspace_Should_Treat_CRLF_As_A_Unit()
+ {
+ using (Start())
+ {
+ var typeface = new Typeface(FontFamily.... | tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fixed the issue where a newline character required two backspaces to be deleted in Windows. | 20,073 | AvaloniaUI/Avalonia | 24,333 | C# | Linlccc | Review this pull request change.
Language: C#
File: tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs
PR Title: Fixed the issue where a newline character required two backspaces to be deleted in Windows.
BEFORE CODE: Assert.NotNull(textLine);
var textBounds = textL... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
newWindowProperties.ShowInTaskbar = value;
UpdateWindowProperties(newWindowProperties);
}
public void CanResize(bool value)
{
var newWindowProperties = _windowProperties;
newWindowProperties.IsResizable = value;
UpdateWindowPropert... | No issues found. |
newWindowProperties.ShowInTaskbar = value;
UpdateWindowProperties(newWindowProperties);
}
public void CanResize(bool value)
{
var newWindowProperties = _windowProperties;
newWindowProperties.IsResizable = value;
UpdateWindowPropert... | @@ -111,6 +111,7 @@ internal partial class WindowImpl : IWindowImpl, EglGlPlatformSurface.IEglWindow
private const int MaxPointerHistorySize = 512;
private static readonly PooledList<RawPointerPoint> s_intermediatePointsPooledList = new();
+ private static readonly List<InternalPoint> s_sorte... | src/Windows/Avalonia.Win32/WindowImpl.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fixed intermediate points order for windows | 20,075 | AvaloniaUI/Avalonia | 24,333 | C# | flabbet | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/WindowImpl.cs
PR Title: Fixed intermediate points order for windows
BEFORE CODE:
newWindowProperties.ShowInTaskbar = value;
UpdateWindowProperties(newWindowProperties);
}
public void CanResize(b... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
}
else if (topLevel is { } wtl && wtl.PlatformImpl is IWindowBaseImpl wimpl)
{
SubscribeToEventHandler<ITopLevelImpl, Action>(wimpl, TopLevelLostPlatformFocus,
(x, handler) => x.LostFocus += handler,
(x, handle... | No issues found. | }
}
else if (topLevel is { } wtl && wtl.PlatformImpl is IWindowBaseImpl wimpl)
{
SubscribeToEventHandler<ITopLevelImpl, Action>(wimpl, TopLevelLostPlatformFocus,
(x, handler) => x.LostFocus += handler,
(x, handle... | @@ -536,6 +536,16 @@ public void Open()
(x, handler) => x.Closed -= handler).DisposeWith(handlerCleanup);
}
}
+ else if (topLevel is { } wtl && wtl.PlatformImpl is IWindowBaseImpl wimpl)
+ {
+ SubscribeToEventHandler<ITopLevelIm... | src/Avalonia.Controls/Primitives/Popup.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fix popups not closing when using WinForms Host | 20,090 | AvaloniaUI/Avalonia | 24,333 | C# | emmauss | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Primitives/Popup.cs
PR Title: Fix popups not closing when using WinForms Host
BEFORE CODE: }
}
else if (topLevel is { } wtl && wtl.PlatformImpl is IWindowBaseImpl wimpl)
{
Su... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
throw new InvalidOperationException(
"SurfaceView.Holder was not expected to be null during InvalidationAwareSurfaceView initialization.");
Holder.AddCallback(this);
Holder.SetFormat(global::Android.Graphics.Format.Transparent);
}
protected o... | No issues found. | throw new InvalidOperationException(
"SurfaceView.Holder was not expected to be null during InvalidationAwareSurfaceView initialization.");
Holder.AddCallback(this);
Holder.SetFormat(global::Android.Graphics.Format.Transparent);
}
protected o... | @@ -42,26 +42,26 @@ protected override void Dispose(bool disposing)
public virtual void SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height)
{
- CacheSurfaceProperties(holder);
Logger.TryGet(LogEventLevel.Verbose, LogArea.AndroidPlatform)?
- ... | src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Android - Directly use the surface window handle cached in InvalidationAwareSurfaceView instead of requesting new handles | 20,093 | AvaloniaUI/Avalonia | 24,333 | C# | emmauss | Review this pull request change.
Language: C#
File: src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
PR Title: Android - Directly use the surface window handle cached in InvalidationAwareSurfaceView instead of requesting new handles
BEFORE CODE: throw new InvalidOpe... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
using Xunit;
namespace Avalonia.Controls.UnitTests
{
public class SelectableTextBlockTests : ScopedTestBase
{
[Fact]
public void SelectionForeground_Should_Not_Reset_Run_Typeface_And_Style()
{
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
... | No issues found. | using Xunit;
namespace Avalonia.Controls.UnitTests
{
public class SelectableTextBlockTests : ScopedTestBase
{
[Fact]
public void SelectionForeground_Should_Not_Reset_Run_Typeface_And_Style()
{
using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
... | @@ -0,0 +1,59 @@
+using System.Linq;
+using Avalonia.Controls.Documents;
+using Avalonia.Media;
+using Avalonia.Media.TextFormatting;
+using Avalonia.UnitTests;
+using Xunit;
+
+namespace Avalonia.Controls.UnitTests
+{
+ public class SelectableTextBlockTests : ScopedTestBase
+ {
+ [Fact]
+ public v... | tests/Avalonia.Controls.UnitTests/SelectableTextBlockTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Preserve run formatting when applying SelectionForegroundBrush in SelectableTextBlock | 20,110 | AvaloniaUI/Avalonia | 24,333 | C# | AuroraZiling | Review this pull request change.
Language: C#
File: tests/Avalonia.Controls.UnitTests/SelectableTextBlockTests.cs
PR Title: Preserve run formatting when applying SelectionForegroundBrush in SelectableTextBlock
BEFORE CODE: using Xunit;
namespace Avalonia.Controls.UnitTests
{
public class SelectableTextBlockTes... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
new FuncDataTemplate<string>((t, _) => new ContentControl() { Content = t }, false)
};
target.Content = "foo";
target.UpdateChild();
var foo = target.Child as ContentControl;
Assert.NotNull(foo);
var logicalChildren = targe... | No issues found. | new FuncDataTemplate<string>((t, _) => new ContentControl() { Content = t }, false)
};
target.Content = "foo";
target.UpdateChild();
var foo = target.Child as ContentControl;
Assert.NotNull(foo);
var logicalChildren = targe... | @@ -12,6 +12,7 @@
using Avalonia.Rendering;
using Avalonia.Media;
using Avalonia.Data;
+using Avalonia.Controls.Documents;
namespace Avalonia.Controls.UnitTests.Presenters
{
@@ -333,5 +334,75 @@ public void Should_Create_Child_When_Content_Is_Null_And_Expected_NullableValueT
Assert.NotNull(target.... | tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Standalone.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | [Feature] Move LetterSpacing to TextElement as inherited attached property | 20,141 | AvaloniaUI/Avalonia | 24,333 | C# | jsuarezruiz | Review this pull request change.
Language: C#
File: tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Standalone.cs
PR Title: [Feature] Move LetterSpacing to TextElement as inherited attached property
BEFORE CODE: new FuncDataTemplate<string>((t, _) => new ContentControl() { Con... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
private IInputRoot InputRoot
=> _inputRoot ?? throw new InvalidOperationException($"{nameof(InputRoot)} hasn't been set");
private unsafe void InputThread(IntPtr ctx, LibInputBackendOptions options)
{
var fd = libinput_get_fd(ctx);
IntPtr[] devices... | No issues found. | }
private IInputRoot InputRoot
=> _inputRoot ?? throw new InvalidOperationException($"{nameof(InputRoot)} hasn't been set");
private unsafe void InputThread(IntPtr ctx, LibInputBackendOptions options)
{
var fd = libinput_get_fd(ctx);
IntPtr[] devices... | @@ -1,8 +1,10 @@
using System;
using System.IO;
+using System.Linq;
using System.Threading;
using Avalonia.Input;
using Avalonia.Input.Raw;
+using Avalonia.Platform;
using static Avalonia.LinuxFramebuffer.Input.LibInput.LibInputNativeUnsafeMethods;
namespace Avalonia.LinuxFramebuffer.Input.LibInput
{
@@ -30,9 +... | src/Linux/Avalonia.LinuxFramebuffer/Input/LibInput/LibInputBackend.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Add screen orientation support for Linux DRM | 20,154 | AvaloniaUI/Avalonia | 24,333 | C# | ThadHouse | Review this pull request change.
Language: C#
File: src/Linux/Avalonia.LinuxFramebuffer/Input/LibInput/LibInputBackend.cs
PR Title: Add screen orientation support for Linux DRM
BEFORE CODE: }
private IInputRoot InputRoot
=> _inputRoot ?? throw new InvalidOperationException($"{nameof(Inp... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
};
var testName = $"{nameof(Polyline_FillRule)}_{fillRule}";
await RenderToFile(target, testName);
CompareImages(testName);
}
[Fact]
public async Task Polyline_FillRule_NoFill()
{
var target = new Decorator
... | No issues found. | }
};
var testName = $"{nameof(Polyline_FillRule)}_{fillRule}";
await RenderToFile(target, testName);
CompareImages(testName);
}
[Fact]
public async Task Polyline_FillRule_NoFill()
{
var target = new Decorator
... | @@ -13,6 +13,75 @@ public PolylineTests()
{
}
+ [Theory]
+ [InlineData(FillRule.EvenOdd)]
+ [InlineData(FillRule.NonZero)]
+ public async Task Polyline_FillRule(FillRule fillRule)
+ {
+ var target = new Decorator
+ {
+ Padding =... | tests/Avalonia.RenderTests/Shapes/PolylineTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | [Feature] Add FillRule property for Polyline/Polygon | 20,159 | AvaloniaUI/Avalonia | 24,333 | C# | jsuarezruiz | Review this pull request change.
Language: C#
File: tests/Avalonia.RenderTests/Shapes/PolylineTests.cs
PR Title: [Feature] Add FillRule property for Polyline/Polygon
BEFORE CODE: }
};
var testName = $"{nameof(Polyline_FillRule)}_{fillRule}";
await RenderToFile(ta... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
{
Width = 10,
Height = 10,
ClipToBounds = true,
[Canvas.LeftProperty] = 50,
[Canvas.TopProperty] = 50,
... | No issues found. | {
Width = 10,
Height = 10,
ClipToBounds = true,
[Canvas.LeftProperty] = 50,
[Canvas.TopProperty] = 50,
... | @@ -109,6 +109,45 @@ public void Out_Of_Bounds_Child_Control_Should_Not_Be_Rendered()
}
}
+ [Fact]
+ public void Transformed_Child_Control_With_ClipToBounds_True_Should_Be_Rendered()
+ {
+ using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))... | tests/Avalonia.Base.UnitTests/RenderTests_Culling.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | [Fix] ImmediateRenderer | 20,174 | AvaloniaUI/Avalonia | 24,333 | C# | ds1709 | Review this pull request change.
Language: C#
File: tests/Avalonia.Base.UnitTests/RenderTests_Culling.cs
PR Title: [Fix] ImmediateRenderer
BEFORE CODE: {
Width = 10,
Height = 10,
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// NU × (AL | HL)
if (state.Next(text).LineBreakClass is LineBreakClass.Alphabetic or LineBreakClass.HebrewLetter)
{
return RuleResult.NoBreak;
}
break;
... | No issues found. | // NU × (AL | HL)
if (state.Next(text).LineBreakClass is LineBreakClass.Alphabetic or LineBreakClass.HebrewLetter)
{
return RuleResult.NoBreak;
}
break;
... | @@ -12,15 +12,15 @@ public ref struct LineBreakEnumerator
private static readonly BreakUnit s_eot = new() { EndOfText = true };
public readonly ReadOnlySpan<char> _text;
- private readonly LineBreakState _state;
+ private LineBreakState _state;
public LineBreakEnumerator(Rea... | src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakEnumerator.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Reduce Allocations in Text Rendering | 20,175 | AvaloniaUI/Avalonia | 24,333 | C# | Washi1337 | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Media/TextFormatting/Unicode/LineBreakEnumerator.cs
PR Title: Reduce Allocations in Text Rendering
BEFORE CODE: // NU × (AL | HL)
if (state.Next(text).LineBreakClass is LineBreakClass.Alphabetic or ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
Assert.NotNull(systemFonts);
// Call TryMatchCharacter which should invoke platform TryMatchCharacter and add to cache
Assert.True(systemFonts.TryMatchCharacter('A', FontStyle.Normal, FontWeight.Normal, FontStretch.Normal, null, null, out var match));
va... | No issues found. | Assert.NotNull(systemFonts);
// Call TryMatchCharacter which should invoke platform TryMatchCharacter and add to cache
Assert.True(systemFonts.TryMatchCharacter('A', FontStyle.Normal, FontWeight.Normal, FontStretch.Normal, null, null, out var match));
va... | @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
+using System.IO;
using Avalonia.Media;
using Avalonia.Media.Fonts;
using Avalonia.Platform;
@@ -115,6 +116,61 @@ public void Should_Ignore_FontFamily()
}
}
+ [Fact]
... | tests/Avalonia.Skia.UnitTests/Media/FontCollectionTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | [11.3] SystemFontCollection fixes | 20,207 | AvaloniaUI/Avalonia | 24,333 | C# | Gillibald | Review this pull request change.
Language: C#
File: tests/Avalonia.Skia.UnitTests/Media/FontCollectionTests.cs
PR Title: [11.3] SystemFontCollection fixes
BEFORE CODE: Assert.NotNull(systemFonts);
// Call TryMatchCharacter which should invoke platform TryMatchCharacter and add to ca... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
public void Reset()
{
_current = 0;
}
public Win32Com.IEnumFORMATETC Clone()
{
return new FormatEnumerator(_formats, _current);
}
}
public IDataTransfer? DataTransfer { get; private set; } = dataTransfer;
public bool IsDis... | No issues found. | }
public void Reset()
{
_current = 0;
}
public Win32Com.IEnumFORMATETC Clone()
{
return new FormatEnumerator(_formats, _current);
}
}
public IDataTransfer? DataTransfer { get; private set; } = dataTransfer;
public bool IsDis... | @@ -6,7 +6,6 @@
using System.Runtime.InteropServices.ComTypes;
using Avalonia.Input;
using Avalonia.MicroCom;
-using Avalonia.Platform.Storage;
using static Avalonia.Win32.Interop.UnmanagedMethods;
using FORMATETC = Avalonia.Win32.Interop.UnmanagedMethods.FORMATETC;
using STGMEDIUM = Avalonia.Win32.Interop.Unmana... | src/Windows/Avalonia.Win32/DataTransferToOleDataObjectWrapper.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Win32 - export bitmap in more clipboard formats | 20,209 | AvaloniaUI/Avalonia | 24,333 | C# | emmauss | Review this pull request change.
Language: C#
File: src/Windows/Avalonia.Win32/DataTransferToOleDataObjectWrapper.cs
PR Title: Win32 - export bitmap in more clipboard formats
BEFORE CODE: }
public void Reset()
{
_current = 0;
}
public Win32Com.IEnumFORMATETC Clo... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
#endregion
#region Tests with brackets - should respect bracket pairs
[Theory]
[InlineData("(a)(b,c)", new[] { "(a)(b,c)" })]
[InlineData("a,(),b", new[] { "a", "()", "b" })]
[InlineData("a,(b,c),d", new[] { "a", "(b,c)", "d" })]
[InlineData("a,(b,(c,d)),e", new[] { "a", "(b,(c,d))"... | No issues found. | }
#endregion
#region Tests with brackets - should respect bracket pairs
[Theory]
[InlineData("(a)(b,c)", new[] { "(a)(b,c)" })]
[InlineData("a,(),b", new[] { "a", "()", "b" })]
[InlineData("a,(b,c),d", new[] { "a", "(b,c)", "d" })]
[InlineData("a,(b,(c,d)),e", new[] { "a", "(b,(c,d))"... | @@ -0,0 +1,175 @@
+using System;
+using System.Collections.Generic;
+using Avalonia.Utilities;
+using Xunit;
+
+namespace Avalonia.Base.UnitTests.Utilities;
+
+public class StringSplitterTests
+{
+ #region Tests without brackets - should match string.Split behavior
+
+ [Fact]
+ public void SplitRespectingBrac... | tests/Avalonia.Base.UnitTests/Utilities/StringSplitterTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Add support for parsing BoxShadows with color functions | 20,321 | AvaloniaUI/Avalonia | 24,333 | C# | gehongyan | Review this pull request change.
Language: C#
File: tests/Avalonia.Base.UnitTests/Utilities/StringSplitterTests.cs
PR Title: Add support for parsing BoxShadows with color functions
BEFORE CODE: }
#endregion
#region Tests with brackets - should respect bracket pairs
[Theory]
[InlineData("(a)(b... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
#nullable enable
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;
namespace Avalonia
{
[Flags]
internal enum TestPlatforms
{
Windows = 0x01,
MacOS = 0x02,
Linux = 0x04,
All = Windows | MacOS | Linux,
}
internal ... | No issues found. | #nullable enable
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;
namespace Avalonia
{
[Flags]
internal enum TestPlatforms
{
Windows = 0x01,
MacOS = 0x02,
Linux = 0x04,
All = Windows | MacOS | Linux,
}
internal ... | @@ -1,5 +1,6 @@
#nullable enable
using System;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;
@@ -16,31 +17,22 @@ internal enum TestPlatforms
internal class PlatformFactAttribute : FactAttribute
{
- private readonly string? _reason;
- private s... | tests/Avalonia.IntegrationTests.Appium/PlatformFactAttribute.cs | 0 | C# | 1 | none | 16 | 48 | 48 | true | Update to xunit.v3 | 20,331 | AvaloniaUI/Avalonia | 24,333 | C# | Youssef1313 | Review this pull request change.
Language: C#
File: tests/Avalonia.IntegrationTests.Appium/PlatformFactAttribute.cs
PR Title: Update to xunit.v3
BEFORE CODE: #nullable enable
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;
namespace Avalonia
{
[Flags]
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
Children = { keyframe2, keyframe1 }
};
var border = new Border() { Height = 100d, Width = 50d };
var propertyChangedCount = 0;
border.PropertyChanged += (_, e) =>
{
if (e.Property == Layoutable.WidthProperty)
{
... | No issues found. | Children = { keyframe2, keyframe1 }
};
var border = new Border() { Height = 100d, Width = 50d };
var propertyChangedCount = 0;
border.PropertyChanged += (_, e) =>
{
if (e.Property == Layoutable.WidthProperty)
{
... | @@ -7,7 +7,9 @@
using Avalonia.Animation.Easings;
using System.Threading;
using System.Reactive.Linq;
+using Avalonia.Data;
using Avalonia.Layout;
+using Avalonia.UnitTests;
namespace Avalonia.Base.UnitTests.Animation
{
@@ -604,6 +606,110 @@ public void Single_KeyFrame_Works(double cue)
Assert.Equa... | tests/Avalonia.Base.UnitTests/Animation/AnimationIterationTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Null Reference Check for Animation keyframes | 20,422 | AvaloniaUI/Avalonia | 24,333 | C# | drasticactions | Review this pull request change.
Language: C#
File: tests/Avalonia.Base.UnitTests/Animation/AnimationIterationTests.cs
PR Title: Null Reference Check for Animation keyframes
BEFORE CODE: Children = { keyframe2, keyframe1 }
};
var border = new Border() { Height = 100d, Width ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
return Wrap(peer);
}
}
private IEmbeddedRootProvider EmbeddedRootProvider => GetProvider<IEmbeddedRootProvider>();
private IExpandCollapseProvider ExpandCollapseProvider => GetProvider<IExpandCollapseProvider>();
private IInvokeProvider InvokeProvider => GetP... | No issues found. | return Wrap(peer);
}
}
private IEmbeddedRootProvider EmbeddedRootProvider => GetProvider<IEmbeddedRootProvider>();
private IExpandCollapseProvider ExpandCollapseProvider => GetProvider<IExpandCollapseProvider>();
private IInvokeProvider InvokeProvider => GetP... | @@ -13,13 +13,22 @@ namespace Avalonia.Native
{
internal class AvnAutomationPeer : NativeCallbackBase, IAvnAutomationPeer
{
+ private static readonly Dictionary<AutomationProperty, AvnAutomationProperty> s_propertyMap = new()
+ {
+ { AutomationElementIdentifiers.BoundingRectangleProp... | src/Avalonia.Native/AvnAutomationPeer.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Implemented AutomationProperties.LiveSetting | 20,473 | AvaloniaUI/Avalonia | 24,333 | C# | codecat | Review this pull request change.
Language: C#
File: src/Avalonia.Native/AvnAutomationPeer.cs
PR Title: Implemented AutomationProperties.LiveSetting
BEFORE CODE: return Wrap(peer);
}
}
private IEmbeddedRootProvider EmbeddedRootProvider => GetProvider<IEmbeddedRootProvider... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
ApplyTemplate(target);
Assert.NotEqual(dataContext, tabItem.Content);
}
[Fact]
public void Can_Have_Empty_Tab_Control()
{
using (UnitTestApplication.Start(TestServices.StyledWindow))
{
var xaml = @"
<Window xmlns='https:/... | No issues found. |
ApplyTemplate(target);
Assert.NotEqual(dataContext, tabItem.Content);
}
[Fact]
public void Can_Have_Empty_Tab_Control()
{
using (UnitTestApplication.Start(TestServices.StyledWindow))
{
var xaml = @"
<Window xmlns='https:/... | @@ -9,6 +9,8 @@
using Avalonia.Controls.Templates;
using Avalonia.Controls.Utils;
using Avalonia.Data;
+using Avalonia.Harfbuzz;
+using Avalonia.Headless;
using Avalonia.Input;
using Avalonia.Layout;
using Avalonia.LogicalTree;
@@ -259,51 +261,48 @@ public void TabItem_Templates_Should_Be_Set_Before_TabItem_Apply... | tests/Avalonia.Controls.UnitTests/TabControlTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Fix TabItem's Content inheriting TabControl's DataContext instead of TabItem's | 20,541 | AvaloniaUI/Avalonia | 24,333 | C# | ptasev | Review this pull request change.
Language: C#
File: tests/Avalonia.Controls.UnitTests/TabControlTests.cs
PR Title: Fix TabItem's Content inheriting TabControl's DataContext instead of TabItem's
BEFORE CODE:
ApplyTemplate(target);
Assert.NotEqual(dataContext, tabItem.Content);
}
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
private void ResetText()
{
NativeTextBox.Text = NativeTextBoxInPopup.Text = "Native text box";
}
private void Reset_Click(object? sender, RoutedEventArgs e)
{
ResetText();
ModalResultTextBox.Text = "";
}
private void RunNativeModalSession_OnClick(object? sender, Ro... | No issues found. |
private void ResetText()
{
NativeTextBox.Text = NativeTextBoxInPopup.Text = "Native text box";
}
private void Reset_Click(object? sender, RoutedEventArgs e)
{
ResetText();
ModalResultTextBox.Text = "";
}
private void RunNativeModalSession_OnClick(object? sender, Ro... | @@ -1,10 +1,19 @@
+using System;
+using Avalonia.Automation;
using Avalonia.Controls;
+using Avalonia.Controls.Embedding;
using Avalonia.Interactivity;
+using IntegrationTestApp.Embedding;
+using MonoMac.AppKit;
+using MonoMac.CoreGraphics;
+using MonoMac.ObjCRuntime;
namespace IntegrationTestApp;
public partia... | samples/IntegrationTestApp/Pages/EmbeddingPage.axaml.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Release implicit mouse capture on focus lost | 20,574 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | Review this pull request change.
Language: C#
File: samples/IntegrationTestApp/Pages/EmbeddingPage.axaml.cs
PR Title: Release implicit mouse capture on focus lost
BEFORE CODE:
private void ResetText()
{
NativeTextBox.Text = NativeTextBoxInPopup.Text = "Native text box";
}
private void Rese... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
public enum RawKeyEventType
{
KeyDown,
KeyUp
}
[PrivateApi]
public class RawKeyEventArgs : RawInputEventArgs
{
public RawKeyEventArgs(
IInputDevice device,
ulong timestamp,
IInpu... | No issues found. | using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
public enum RawKeyEventType
{
KeyDown,
KeyUp
}
[PrivateApi]
public class RawKeyEventArgs : RawInputEventArgs
{
public RawKeyEventArgs(
IInputDevice device,
ulong timestamp,
IInpu... | @@ -1,4 +1,3 @@
-using System;
using Avalonia.Metadata;
namespace Avalonia.Input.Raw
@@ -12,21 +11,6 @@ public enum RawKeyEventType
[PrivateApi]
public class RawKeyEventArgs : RawInputEventArgs
{
- [Obsolete("Use the overload that takes a physical key and key symbol instead.")]
- public... | src/Avalonia.Base/Input/Raw/RawKeyEventArgs.cs | 0 | C# | 1 | none | 16 | 47 | 47 | true | Remove obsolete members from various assemblies | 20,628 | AvaloniaUI/Avalonia | 24,333 | C# | MrJul | Review this pull request change.
Language: C#
File: src/Avalonia.Base/Input/Raw/RawKeyEventArgs.cs
PR Title: Remove obsolete members from various assemblies
BEFORE CODE: using Avalonia.Metadata;
namespace Avalonia.Input.Raw
{
public enum RawKeyEventType
{
KeyDown,
KeyUp
}
[PrivateA... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
var viewMenu = Session.FindElementByXPath("//MenuItem[@Name='View']");
Assert.False(buttonTab.Selected);
viewMenu.Click();
var buttonMenu = viewMenu.FindElementByName("Button");
buttonMenu.Click();
Assert.True(buttonTab.Selected);
}
... | No issues found. | var viewMenu = Session.FindElementByXPath("//MenuItem[@Name='View']");
Assert.False(buttonTab.Selected);
viewMenu.Click();
var buttonMenu = viewMenu.FindElementByName("Button");
buttonMenu.Click();
Assert.True(buttonTab.Selected);
}
... | @@ -1,4 +1,6 @@
-using System.Threading;
+using System.Diagnostics;
+using System.IO;
+using System.Threading;
using Xunit;
namespace Avalonia.IntegrationTests.Appium
@@ -18,9 +20,9 @@ public void MacOS_View_Menu_Select_Button_Tab()
var buttonTab = tabs.FindElementByName("Button");
var m... | tests/Avalonia.IntegrationTests.Appium/NativeMenuTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | [macOS] Add NativeDock.Menu API for adding menu items to macOS dock icon | 20,634 | AvaloniaUI/Avalonia | 24,333 | C# | drasticactions | Review this pull request change.
Language: C#
File: tests/Avalonia.IntegrationTests.Appium/NativeMenuTests.cs
PR Title: [macOS] Add NativeDock.Menu API for adding menu items to macOS dock icon
BEFORE CODE: var viewMenu = Session.FindElementByXPath("//MenuItem[@Name='View']");
Assert.False(b... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
[Fact]
public void FindDescendantOfType_Finds_Nested_Visible_Child()
{
Button target;
var root = new TestRoot
{
Child = new StackPanel
{
Children =
{
ne... | No issues found. | }
[Fact]
public void FindDescendantOfType_Finds_Nested_Visible_Child()
{
Button target;
var root = new TestRoot
{
Child = new StackPanel
{
Children =
{
ne... | @@ -22,6 +22,23 @@ public void FindAncestorOfType_Finds_Direct_Parent()
Assert.Equal(root, target.FindAncestorOfType<TestRoot>());
}
+ [Fact]
+ public void FindAncestorOfType_Finds_Visible_Parent()
+ {
+ StackPanel target;
+
+ var root = new TestRoot
+ ... | tests/Avalonia.Base.UnitTests/VisualExtensionsTests.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | FindAncestorOfType and FindDescendantOfType with predicates | 20,661 | AvaloniaUI/Avalonia | 24,333 | C# | miloush | Review this pull request change.
Language: C#
File: tests/Avalonia.Base.UnitTests/VisualExtensionsTests.cs
PR Title: FindAncestorOfType and FindDescendantOfType with predicates
BEFORE CODE: }
[Fact]
public void FindDescendantOfType_Finds_Nested_Visible_Child()
{
Button t... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
public static PopupAnchor Flip(this PopupAnchor edge)
{
if (edge.HasAnyFlag(PopupAnchor.HorizontalMask))
edge ^= PopupAnchor.HorizontalMask;
if (edge.HasAnyFlag(PopupAnchor.VerticalMask))
edge ^= PopupAnchor.VerticalMask;
r... | No issues found. | }
public static PopupAnchor Flip(this PopupAnchor edge)
{
if (edge.HasAnyFlag(PopupAnchor.HorizontalMask))
edge ^= PopupAnchor.HorizontalMask;
if (edge.HasAnyFlag(PopupAnchor.VerticalMask))
edge ^= PopupAnchor.VerticalMask;
r... | @@ -570,16 +570,8 @@ private static Rect CalculateAnchorRect(TopLevel topLevel, PopupPositionRequest
var target = positionRequest.Target;
if (target == null)
throw new InvalidOperationException("Placement mode is not Pointer and PlacementTarget is null");
- Matrix? ... | src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs | 0 | C# | 1 | none | 16 | 51 | 51 | true | Make sure that adorners are actually correctly positioned in visual tree for TransformToVisual and friends | 20,691 | AvaloniaUI/Avalonia | 24,333 | C# | kekekeks | Review this pull request change.
Language: C#
File: src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs
PR Title: Make sure that adorners are actually correctly positioned in visual tree for TransformToVisual and friends
BEFORE CODE: }
public static PopupAnchor Flip(this PopupAnch... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
import React from "react";
import styled from "styled-components";
import toast from "react-hot-toast";
import { useConfig } from "src/hocs/config";
import { ConfigActionType } from "src/reducer/reducer";
import { Modal, ModalProps } from "src/components/Modal";
import { Button } from "src/components/Button";
import {... | change import to absolute path | import React from "react";
import styled from "styled-components";
import toast from "react-hot-toast";
import { useConfig } from "src/hocs/config";
import { ConfigActionType } from "src/reducer/reducer";
import { Modal, ModalProps } from "src/components/Modal";
import { Button } from "src/components/Button";
import {... | @@ -7,6 +7,7 @@ import { ConfigActionType } from "src/reducer/reducer";
import { Modal, ModalProps } from "src/components/Modal";
import { Button } from "src/components/Button";
import { AiOutlineUpload } from "react-icons/ai";
+import useKeyPress from "../../hooks/useKeyPress"; | src/containers/ImportModal/index.tsx | 10 | TypeScript | 0.143 | suggestion | 30 | 35 | 35 | false | Add `useKeyPress` hooks and shortcut in ImportModal | 62 | AykutSarac/jsoncrack.com | 41,851 | TypeScript | AykutSarac | cihat | Review this pull request change.
Language: TypeScript
File: src/containers/ImportModal/index.tsx
PR Title: Add `useKeyPress` hooks and shortcut in ImportModal
BEFORE CODE: import React from "react";
import styled from "styled-components";
import toast from "react-hot-toast";
import { useConfig } from "src/hocs/co... | change import to absolute path | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
setVisible(false);
})
.catch(() => toast.error("Failed to fetch JSON!"))
.finally(() => toast.dismiss("toastFetch"));
}
if (jsonFile) {
const reader = new FileReader();
reader.readAsText(jsonFile, "UTF-8");
reader.onload = function (data) {
dispatch... | reduce condition to single line `if (...) doSomething()` | setVisible(false);
})
.catch(() => toast.error("Failed to fetch JSON!"))
.finally(() => toast.dismiss("toastFetch"));
}
if (jsonFile) {
const reader = new FileReader();
reader.readAsText(jsonFile, "UTF-8");
reader.onload = function (data) {
dispatch(... | @@ -97,6 +98,18 @@ export const ImportModal: React.FC<ModalProps> = ({ visible, setVisible }) => {
}
};
+ const handleEspacePress = useKeyPress("Escape");
+ const handleEnterKeyPress = useKeyPress("Enter");
+ React.useEffect(() => {
+ if (handleEspacePress) { | src/containers/ImportModal/index.tsx | 26 | TypeScript | 0.357 | suggestion | 56 | 51 | 51 | false | Add `useKeyPress` hooks and shortcut in ImportModal | 62 | AykutSarac/jsoncrack.com | 41,851 | TypeScript | AykutSarac | cihat | Review this pull request change.
Language: TypeScript
File: src/containers/ImportModal/index.tsx
PR Title: Add `useKeyPress` hooks and shortcut in ImportModal
BEFORE CODE:
setVisible(false);
})
.catch(() => toast.error("Failed to fetch JSON!"))
.finally(() => toast.dismiss("toast... | reduce condition to single line `if (...) doSomething()` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { useState, useEffect } from "react";
const useKeyPress = (targetKey) => {
const [keyPressed, setKeyPressed] = useState<boolean>(false);
function downHandler({ key }) {
if (key === targetKey) {
setKeyPressed(true);
}
}
const upHandler = ({ key }) => {
if (key === targetKey) {
set... | no need to define type as it is inferred from usage | import React from "react";
const useKeyPress = (targetKey) => {
const [keyPressed, setKeyPressed] = React.useState(false);
function downHandler({ key }) {
if (key === targetKey) setKeyPressed(true);
}
const upHandler = ({ key }) => {
if (key === targetKey) setKeyPressed(false);
};
React.useEffect(... | @@ -0,0 +1,27 @@
+import { useState, useEffect } from "react";
+
+const useKeyPress = (targetKey) => {
+ const [keyPressed, setKeyPressed] = useState<boolean>(false); | src/hooks/useKeyPress.tsx | 4 | TypeScript | 0.357 | suggestion | 51 | 28 | 25 | false | Add `useKeyPress` hooks and shortcut in ImportModal | 62 | AykutSarac/jsoncrack.com | 41,851 | TypeScript | AykutSarac | cihat | Review this pull request change.
Language: TypeScript
File: src/hooks/useKeyPress.tsx
PR Title: Add `useKeyPress` hooks and shortcut in ImportModal
BEFORE CODE: import { useState, useEffect } from "react";
const useKeyPress = (targetKey) => {
const [keyPressed, setKeyPressed] = useState<boolean>(false);
funct... | no need to define type as it is inferred from usage | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Content: ReactComponent;
Controls: React.FC<ControlProps>;
};
export interface ModalProps {
visible: boolean;
setVisible: React.Dispatch<React.SetStateAction<boolean>>;
}
const Header: ReactComponent = ({ children }) => {
return (
<Styled.HeaderWrapper>
<Styled.Title>{children}</Styled.Title>
... | No issues found. | Content: ReactComponent;
Controls: React.FC<ControlProps>;
};
export interface ModalProps {
visible: boolean;
setVisible: React.Dispatch<React.SetStateAction<boolean>>;
}
const Header: ReactComponent = ({ children }) => {
return (
<Styled.HeaderWrapper>
<Styled.Title>{children}</Styled.Title>
... | @@ -2,6 +2,7 @@ import React from "react";
import { ReactComponent } from "src/typings/global";
import { Button } from "src/components/Button";
import * as Styled from "./styles";
+import useKeyPress from "src/hooks/useKeyPress";
type ControlProps = React.PropsWithChildren<{
setVisible: (status: boolean) => vo... | src/components/Modal/index.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Add `useKeyPress` hooks and shortcut in ImportModal | 62 | AykutSarac/jsoncrack.com | 41,851 | TypeScript | cihat | Review this pull request change.
Language: TypeScript
File: src/components/Modal/index.tsx
PR Title: Add `useKeyPress` hooks and shortcut in ImportModal
BEFORE CODE: Content: ReactComponent;
Controls: React.FC<ControlProps>;
};
export interface ModalProps {
visible: boolean;
setVisible: React.Dispatch<Rea... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
rel="noopener"
>
Open Source
</Anchor>
<Anchor
href="https://todiagram.com?utm_source=jsoncrack&utm_medium=footer"
fz="sm"
c="gray.5"
rel="noopener"
>
ToDiagram
<... | No issues found. | rel="noopener"
>
Open Source
</Anchor>
<Anchor
href="https://todiagram.com?utm_source=jsoncrack&utm_medium=footer"
fz="sm"
c="gray.5"
rel="noopener"
>
ToDiagram
<... | @@ -8,7 +8,7 @@ import { JSONCrackLogo } from "../JsonCrackLogo";
export const Footer = () => {
return (
- <Container mt={60} px={60} pb="xl" bg="black" fluid>
+ <Container w="100%" mt={60} px={60} pb="xl" bg="black" fluid>
<Divider color="gray.3" mb="xl" mx={-60} />
<Flex justify="space-betwe... | src/layout/PageLayout/Footer.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix: stick footer to bottom of the page | 469 | AykutSarac/jsoncrack.com | 41,851 | TypeScript | lorenzopalaia | Review this pull request change.
Language: TypeScript
File: src/layout/PageLayout/Footer.tsx
PR Title: fix: stick footer to bottom of the page
BEFORE CODE: rel="noopener"
>
Open Source
</Anchor>
<Anchor
href="https://todiagram.com?utm_sou... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
)
return true;
const originalParameter = getOriginalParameter(obj["$ref"]);
if (
originalParameter?.name === "resourceGroupName" &&
originalParameter?.in === "path" &&
originalParameter?.required === true
)
return true;
} else if (obj["name"] !== undefined) {
if (res... | consider to wrap else to be format consistent | )
return true;
const originalParameter = getOriginalParameter(obj["$ref"]);
if (
originalParameter?.name === "resourceGroupName" &&
originalParameter?.in === "path" &&
originalParameter?.required === true
)
return true;
} else if (obj["name"] !== undefined) {
if (res... | @@ -102,10 +102,12 @@ export function isResourceGroupNameParameter(obj: Record<string, any>) {
return false;
}
-export function getOriginalParameter(refPath: string): OpenAPI2Parameter | undefined {
- const originalDocument = getOriginalDocument();
- if (refPath.startsWith("#/parameters/")) {
- const paramet... | eng/tools/typespec-migration-validation/src/parameter.ts | 26 | TypeScript | 0.143 | suggestion | 45 | 28 | 30 | false | Fix some issues in command tsmv | 40,154 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | live1206 | pshao25 | Review this pull request change.
Language: TypeScript
File: eng/tools/typespec-migration-validation/src/parameter.ts
PR Title: Fix some issues in command tsmv
BEFORE CODE: )
return true;
const originalParameter = getOriginalParameter(obj["$ref"]);
if (
originalParameter?.name === "resourceG... | consider to wrap else to be format consistent | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const mockRunOad = vi.mocked(runOad).mockResolvedValue([]);
for (const data of [
{
runType: BREAKING_CHANGES_CHECK_TYPES.SAME_VERSION,
expectedOadCalls: finalExpectedOadCalls.sameVersion,
},
{
runType: BREAKING_CHANGES_CHECK_TYPES.CROSS_VERSION,
... | If it still fails, why don't we keep original behavior for this case without changing. | },
{
name: "convert two swaggers to one (TSP conversion)",
changedFiles: {
additions: ["specification/bar/data-plane/Bar/stable/2025-03-01/openapi.json"],
deletions: [
"specification/bar/data-plane/Bar/stable/2025-03-01/bar.json",
"specification/bar/data-plane/Bar/stable/2025-03-... | @@ -231,52 +231,121 @@ const cases: TestCase[] = [
changedFiles: {
renames: [
{
- from: "Foo/stable/2025-01-01/foo.json",
- to: "Foo/stable/2025-01-01/openapi.json",
+ from: "Foo/stable/2025-03-01/foo.json",
+ to: "Foo/stable/2025-03-01/openapi.json",
+ },... | eng/tools/openapi-diff-runner/test/commands.test.ts | 26 | TypeScript | 0.214 | bug | 86 | 51 | 51 | false | [openapi-diff-runner] Properly handle renames in same-version check | 40,303 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | raych1 | mikeharder | Review this pull request change.
Language: TypeScript
File: eng/tools/openapi-diff-runner/test/commands.test.ts
PR Title: [openapi-diff-runner] Properly handle renames in same-version check
BEFORE CODE: const mockRunOad = vi.mocked(runOad).mockResolvedValue([]);
for (const data of [
{
... | If it still fails, why don't we keep original behavior for this case without changing. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
rmTypeSpec = false;
/** @type {boolean} */
rmFunctional = false;
/** @type {boolean} */
rmOther = false;
/** @type {boolean} */
other = false;
/**
* A PR is trivial if it contains only:
* - Documentation changes
* - Example changes
* and does NOT contain:
* - Functional spec changes
... | `PullRequestChanges.isTrivial()` now treats `rmTypeSpec` as a trivial change, but the JSDoc above still says trivial PRs contain only documentation/examples. Update the comment to include TypeSpec so the documentation matches the behavior (and avoids misleading future maintainers). | rmTypeSpec = false;
/** @type {boolean} */
rmFunctional = false;
/** @type {boolean} */
rmOther = false;
/** @type {boolean} */
other = false;
/**
* A PR is trivial if it contains only:
* - Documentation changes
* - Example changes
* - TypeSpec file changes (.tsp, tspconfig.yaml)
* an... | @@ -29,7 +32,7 @@ export class PullRequestChanges {
*/
isTrivial() {
const hasNoBlockingChanges = !this.rmFunctional && !this.rmOther && !this.other;
- const hasTrivialChanges = this.rmDocumentation || this.rmExamples;
+ const hasTrivialChanges = this.rmDocumentation || this.rmExamples || this.rmTypeS... | .github/workflows/src/arm-auto-signoff/pr-changes.js | 26 | JavaScript | 0.786 | suggestion | 282 | 46 | 51 | false | Include .tsp files as trivial/non-functional changes for ARM auto sign-off | 40,396 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Copilot | Review this pull request change.
Language: JavaScript
File: .github/workflows/src/arm-auto-signoff/pr-changes.js
PR Title: Include .tsp files as trivial/non-functional changes for ARM auto sign-off
BEFORE CODE: rmTypeSpec = false;
/** @type {boolean} */
rmFunctional = false;
/** @type {boolean} */
rmOth... | `PullRequestChanges.isTrivial()` now treats `rmTypeSpec` as a trivial change, but the JSDoc above still says trivial PRs contain only documentation/examples. Update the comment to include TypeSpec so the documentation matches the behavior (and avoids misleading future maintainers). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
* @param {PullRequestChangesType} changes - Changes object to update
* @returns {Promise<void>}
*/
async function analyzeAndUpdatePullRequestChanges(changedFiles, git, core, changes) {
// Categorize files by type
const documentationFiles = changedFiles.filter(markdown);
const exampleFiles = changedFiles.filter... | With this change, new/deleted `.tsp` or `tspconfig.yaml` files under `resource-manager/` will be classified as `rmTypeSpec` and can make `isTrivial()` return true. However, `hasSignificantFileOperations()` only treats *Swagger JSON* additions/deletions as significant, so adding/removing TypeSpec files won’t flip `rmFun... | `Significant: File renames detected: ${changedFilesStatuses.renames.map((r) => `${r.from} → ${r.to}`).join(", ")}`,
);
return true;
}
// Deletions of docs/examples are OK, but already filtered above
return false;
}
/**
* Analyzes a PR to determine what types of changes it contains and updates the... | @@ -161,12 +162,13 @@ async function analyzeAndUpdatePullRequestChanges(changedFiles, git, core, chang
const documentationFiles = changedFiles.filter(markdown);
const exampleFiles = changedFiles.filter(example);
const specFiles = changedFiles.filter(swagger);
+ const typespecFiles = changedFiles.filter(typesp... | .github/workflows/src/arm-auto-signoff/trivial-changes-check.js | 26 | JavaScript | 0.786 | suggestion | 580 | 51 | 51 | false | Include .tsp files as trivial/non-functional changes for ARM auto sign-off | 40,396 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Copilot | Review this pull request change.
Language: JavaScript
File: .github/workflows/src/arm-auto-signoff/trivial-changes-check.js
PR Title: Include .tsp files as trivial/non-functional changes for ARM auto sign-off
BEFORE CODE: * @param {PullRequestChangesType} changes - Changes object to update
* @returns {Promise<voi... | With this change, new/deleted `.tsp` or `tspconfig.yaml` files under `resource-manager/` will be classified as `rmTypeSpec` and can make `isTrivial()` return true. However, `hasSignificantFileOperations()` only treats *Swagger JSON* additions/deletions as significant, so adding/removing TypeSpec files won’t flip `rmFun... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
multiple: false,
},
owner: {
type: "string",
short: "o",
multiple: false,
},
isDraft: {
type: "boolean",
multiple: false,
default: false,
},
},
allowPositionals: true,
};
const { values: opts } = parseArgs(config);
// ... | ```suggestion
// code in diff-types.ts and impact.ts assumes the file list only contains add/modify/delete, not renames
``` | multiple: false,
},
owner: {
type: "string",
short: "o",
multiple: false,
},
isDraft: {
type: "boolean",
multiple: false,
default: false,
},
},
allowPositionals: true,
};
const { values: opts } = parseArgs(config);
// ... | @@ -77,6 +77,8 @@ export async function main() {
const targetGitRoot = await getRootFolder(targetDirectory);
const fileList = await getChangedFilesStatuses({
cwd: sourceGitRoot,
+ // code in diff-types.ts and impact.ts assumes the file list only contains add/modify/delete, not rename | eng/tools/summarize-impact/src/cli.ts | 26 | TypeScript | 0.929 | suggestion | 127 | 51 | 51 | false | [summarize-impact] Add label "TypeSpec" for *.tsp renames | 40,414 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | mikeharder | Review this pull request change.
Language: TypeScript
File: eng/tools/summarize-impact/src/cli.ts
PR Title: [summarize-impact] Add label "TypeSpec" for *.tsp renames
BEFORE CODE: multiple: false,
},
owner: {
type: "string",
short: "o",
multiple: false,
},
isDr... | ```suggestion
// code in diff-types.ts and impact.ts assumes the file list only contains add/modify/delete, not renames
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
});
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve file for swagger: ${resolve("/fake/invalid.json")}
Problem File: ${resolve("/fake/invalid.json")}
Readme: ${resolve("/fake/readme.md")}
Tag: test-tag
... | @copilot: update test to verify results are sorted, like the test you added to spec-model.test.js | });
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve file for swagger: ${resolve("/fake/invalid.json")}
Problem File: ${resolve("/fake/invalid.json")}
Readme: ${resolve("/fake/readme.md")}
Tag: test-tag
... | @@ -187,6 +187,18 @@ describe("Swagger", () => {
);
});
+ it("sorts refs in toJSONAsync", async () => {
+ // a.json has 2+ refs (nesting/b.json, c.json, etc.) so the sort comparator gets invoked
+ const swagger = new Swagger(
+ resolve(__dirname, "fixtures/getAffectedSwaggers/specification/1/data-... | .github/shared/test/swagger.test.js | 26 | JavaScript | 0.214 | style | 97 | 51 | 51 | false | [.github/shared] Add tests to restore 100% statement coverage | 40,579 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/swagger.test.js
PR Title: [.github/shared] Add tests to restore 100% statement coverage
BEFORE CODE: });
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resol... | @copilot: update test to verify results are sorted, like the test you added to spec-model.test.js | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { describe, expect, it } from "vitest";
import { resolve } from "path";
import { Tag } from "../src/tag.js";
describe("Tag", () => {
it("can be created with mock swaggers", async () => {
const tag = new Tag("tag", ["swagger"]);
expect(tag.name).toBe("tag");
expect(tag.readme).toBeUndefined();
... | @copilot: update test to verify results are sorted, like the test you added to spec-model.test.js | import { describe, expect, it } from "vitest";
import { resolve } from "path";
import { Tag } from "../src/tag.js";
describe("Tag", () => {
it("can be created with mock swaggers", async () => {
const tag = new Tag("tag", ["swagger"]);
expect(tag.name).toBe("tag");
expect(tag.readme).toBeUndefined();
... | @@ -16,4 +16,14 @@ describe("Tag", () => {
await expect(swagger.getRefs()).rejects.toThrowError(/Failed to read file for swagger/i);
});
+
+ it("sorts input files in toJSONAsync", async () => {
+ const tag = new Tag("test-tag", ["b.json", "a.json"]);
+ const json = /** @type {import('../src/tag.js').Ta... | .github/shared/test/tag.test.js | 26 | JavaScript | 0.214 | style | 97 | 30 | 30 | false | [.github/shared] Add tests to restore 100% statement coverage | 40,579 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/tag.test.js
PR Title: [.github/shared] Add tests to restore 100% statement coverage
BEFORE CODE: import { describe, expect, it } from "vitest";
import { resolve } from "path";
import { Tag } from "../src/tag.js";
describe("Tag", () =>... | @copilot: update test to verify results are sorted, like the test you added to spec-model.test.js | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve file for swagger: ${resolve("/fake/invalid.json")}
Problem File: ${resolve("/fake/invalid.json"... | ```suggestion
expect(refs[0].path.localeCompare(refs[1].path)).toBeLessThan(0);
``` | tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve file for swagger: ${resolve("/fake/invalid.json")}
Problem File: ${resolve("/fake/invalid.json"... | @@ -187,6 +187,20 @@ describe("Swagger", () => {
);
});
+ it("sorts refs in toJSONAsync", async () => {
+ // a.json has 2+ refs (nesting/b.json, c.json, etc.) so the sort comparator gets invoked
+ const swagger = new Swagger(
+ resolve(__dirname, "fixtures/getAffectedSwaggers/specification/1/data-... | .github/shared/test/swagger.test.js | 26 | JavaScript | 0.571 | suggestion | 87 | 51 | 51 | false | [.github/shared] Add tests to restore 100% statement coverage | 40,579 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/swagger.test.js
PR Title: [.github/shared] Add tests to restore 100% statement coverage
BEFORE CODE: tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toT... | ```suggestion
expect(refs[0].path.localeCompare(refs[1].path)).toBeLessThan(0);
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve file for swagger: ${resolve("/fake/invalid.json")}
Problem File: ${resolve("/fake/invalid.json"... | ```suggestion
expect(refs.length).toBe(2);
expect(refs[0].path.localeCompare(refs[1].path)).toBeLessThan(0);
``` | tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve file for swagger: ${resolve("/fake/invalid.json")}
Problem File: ${resolve("/fake/invalid.json"... | @@ -187,6 +187,18 @@ describe("Swagger", () => {
);
});
+ it("sorts refs in toJSONAsync", async () => {
+ // a.json has 2+ refs (nesting/b.json, c.json, etc.) so the sort comparator gets invoked
+ const swagger = new Swagger(
+ resolve(__dirname, "fixtures/getAffectedSwaggers/specification/1/data-... | .github/shared/test/swagger.test.js | 26 | JavaScript | 0.714 | suggestion | 120 | 51 | 51 | false | [.github/shared] Add tests to restore 100% statement coverage | 40,579 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/swagger.test.js
PR Title: [.github/shared] Add tests to restore 100% statement coverage
BEFORE CODE: tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toT... | ```suggestion
expect(refs.length).toBe(2);
expect(refs[0].path.localeCompare(refs[1].path)).toBeLessThan(0);
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
import { resolve } from "path";
import { Tag } from "../src/tag.js";
describe("Tag", () => {
it("can be created with mock swaggers", async () => {
const tag = new Tag("tag", ["swagger"]);
expect(tag.name).toBe("tag");
expect(tag.readme).toBeUndefined();
expect(tag.inputFiles.size).toBe(1);
con... | ```suggestion
expect(files.length).toBe(2);
expect(files[0].localeCompare(files[1])).toBeLessThan(0);
``` |
import { resolve } from "path";
import { Tag } from "../src/tag.js";
describe("Tag", () => {
it("can be created with mock swaggers", async () => {
const tag = new Tag("tag", ["swagger"]);
expect(tag.name).toBe("tag");
expect(tag.readme).toBeUndefined();
expect(tag.inputFiles.size).toBe(1);
con... | @@ -16,4 +16,13 @@ describe("Tag", () => {
await expect(swagger.getRefs()).rejects.toThrowError(/Failed to read file for swagger/i);
});
+
+ it("sorts input files in toJSONAsync", async () => {
+ const tag = new Tag("test-tag", ["b.json", "a.json"]);
+ const json = /** @type {import('../src/tag.js').Ta... | .github/shared/test/tag.test.js | 26 | JavaScript | 0.714 | suggestion | 113 | 28 | 29 | false | [.github/shared] Add tests to restore 100% statement coverage | 40,579 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/tag.test.js
PR Title: [.github/shared] Add tests to restore 100% statement coverage
BEFORE CODE:
import { resolve } from "path";
import { Tag } from "../src/tag.js";
describe("Tag", () => {
it("can be created with mock swaggers", as... | ```suggestion
expect(files.length).toBe(2);
expect(files[0].localeCompare(files[1])).toBeLessThan(0);
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
const swagger = new Swagger(resolve(folder, "invalid.json"), {
content: invalidRefContent,
tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve fi... | ```suggestion
expect(refs.length).toBe(4);
``` | const swagger = new Swagger(resolve(folder, "invalid.json"), {
content: invalidRefContent,
tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve fi... | @@ -187,6 +187,19 @@ describe("Swagger", () => {
);
});
+ it("sorts refs in toJSONAsync", async () => {
+ // a.json has 2+ refs (nesting/b.json, c.json, etc.) so the sort comparator gets invoked
+ const swagger = new Swagger(
+ resolve(__dirname, "fixtures/getAffectedSwaggers/specification/1/data-... | .github/shared/test/swagger.test.js | 26 | JavaScript | 0.571 | suggestion | 50 | 51 | 51 | false | [.github/shared] Add tests to restore 100% statement coverage | 40,579 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/swagger.test.js
PR Title: [.github/shared] Add tests to restore 100% statement coverage
BEFORE CODE: const swagger = new Swagger(resolve(folder, "invalid.json"), {
content: invalidRefContent,
tag: new Tag("test-tag", [],... | ```suggestion
expect(refs.length).toBe(4);
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve file for swagger: ${resolve("/fake/invalid.json")}
Problem File: ${resolve("/fake/invalid.json"... | ```suggestion
// ensure at least first two elements are sorted correctly
expect(refs[0].path.localeCompare(refs[1].path)).toBeLessThan(0);
``` | tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toThrowErrorMatchingInlineSnapshot(
`
[SpecModelError: Failed to resolve file for swagger: ${resolve("/fake/invalid.json")}
Problem File: ${resolve("/fake/invalid.json"... | @@ -187,6 +187,19 @@ describe("Swagger", () => {
);
});
+ it("sorts refs in toJSONAsync", async () => {
+ // a.json has 2+ refs (nesting/b.json, c.json, etc.) so the sort comparator gets invoked
+ const swagger = new Swagger(
+ resolve(__dirname, "fixtures/getAffectedSwaggers/specification/1/data-... | .github/shared/test/swagger.test.js | 26 | JavaScript | 0.714 | suggestion | 150 | 51 | 51 | false | [.github/shared] Add tests to restore 100% statement coverage | 40,579 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/swagger.test.js
PR Title: [.github/shared] Add tests to restore 100% statement coverage
BEFORE CODE: tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
await expect(swagger.getRefs()).rejects.toT... | ```suggestion
// ensure at least first two elements are sorted correctly
expect(refs[0].path.localeCompare(refs[1].path)).toBeLessThan(0);
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
total: 2,
});
expect(mockDiff).toHaveBeenCalledWith(["--name-status", "--no-renames", "HEAD^", "HEAD"]);
});
it("should accept multiple gitOptions", async () => {
mockDiff.mockResolvedValue("A\tfile1.json");
const result = await getChangedFilesStatuses({
gitOptions: ["--... | ```suggestion
it("should log categories selectively with a logger (covers false branches of per-category logging)", async () => {
``` | total: 2,
});
expect(mockDiff).toHaveBeenCalledWith(["--name-status", "--no-renames", "HEAD^", "HEAD"]);
});
it("should accept multiple gitOptions", async () => {
mockDiff.mockResolvedValue("A\tfile1.json");
const result = await getChangedFilesStatuses({
gitOptions: ["--... | @@ -439,5 +439,35 @@ describe("changedFiles", () => {
"HEAD",
]);
});
+ it("should log categories selectively with a logger (covers false branches of per-category logging)", async () => { | .github/shared/test/changed-files.test.js | 26 | JavaScript | 0.786 | suggestion | 138 | 51 | 51 | false | [.github/shared] Enforce 100% for all coverage metrics | 40,584 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/changed-files.test.js
PR Title: [.github/shared] Enforce 100% for all coverage metrics
BEFORE CODE: total: 2,
});
expect(mockDiff).toHaveBeenCalledWith(["--name-status", "--no-renames", "HEAD^", "HEAD"]);
});
... | ```suggestion
it("should log categories selectively with a logger (covers false branches of per-category logging)", async () => {
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
/**
* Writes markdown content to GitHub Actions job summary
* Handles the 1MB limit and truncation if necessary
*/
async function writeToJobSummary(markdownContent: string): Promise<void> {
if (!process.env.GITHUB_STEP_SUMMARY) {
logMessage("GitHub Actions job summary not available, skipping summary output.")... | @copilot: only call summary.addRaw().write(), if process.env.GITHUB_STEP_SUMMARY is defined. | /**
* Writes markdown content to GitHub Actions job summary
* Handles the 1MB limit and truncation if necessary
*/
async function writeToJobSummary(markdownContent: string): Promise<void> {
if (!process.env.GITHUB_STEP_SUMMARY) {
logMessage("GitHub Actions job summary not available, skipping summary output.");... | @@ -284,6 +285,6 @@ async function writeToJobSummary(markdownContent: string): Promise<void> {
);
}
- addToSummary(finalContent);
+ await core.summary.addRaw(finalContent).write(); | eng/tools/openapi-diff-runner/src/generate-report.ts | 26 | TypeScript | 0.214 | suggestion | 92 | 29 | 28 | false | [openapi-diff-runner] Re-implement helpers using @actions/core | 40,612 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: TypeScript
File: eng/tools/openapi-diff-runner/src/generate-report.ts
PR Title: [openapi-diff-runner] Re-implement helpers using @actions/core
BEFORE CODE:
/**
* Writes markdown content to GitHub Actions job summary
* Handles the 1MB limit and truncation if necessary
*... | @copilot: only call summary.addRaw().write(), if process.env.GITHUB_STEP_SUMMARY is defined. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
break;
}
case LogLevel.Warn: {
console.log(`::warning::${message}`);
break;
}
case LogLevel.Notice: {
console.log(`::notice::${message}`);
break;
}
case LogLevel.Info:
default: {
console.log(message);
break;
}
}
}
/**
* Logs a message to the ... | The JSDoc for `logMessageAsync()` says it "Automatically prefixes messages with LOG_PREFIX", but the implementation writes `message` verbatim (no `LOG_PREFIX` concatenation). Either update the docs to reflect caller-provided prefixes, or implement the prefixing inside `logMessageAsync()` for consistency with the commen... | break;
}
case LogLevel.Warn: {
console.log(`::warning::${message}`);
break;
}
case LogLevel.Notice: {
console.log(`::notice::${message}`);
break;
}
case LogLevel.Info:
default: {
console.log(message);
break;
}
}
}
/**
* Logs a message to the ... | @@ -55,6 +56,48 @@ export function logMessage(message: string, level?: LogLevel): void {
}
}
+/**
+ * Logs a message to the console with GitHub Actions workflow commands.
+ * Uses the async, backpressure-aware log() from .github/shared/src/console.js instead of console.log(),
+ * to ensure all messages written de... | eng/tools/openapi-diff-runner/src/log.ts | 26 | TypeScript | 0.571 | style | 322 | 51 | 51 | false | [openapi-diff-runner] Use async log() to avoid dropping messages under stdout backpressure | 40,618 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Copilot | Review this pull request change.
Language: TypeScript
File: eng/tools/openapi-diff-runner/src/log.ts
PR Title: [openapi-diff-runner] Use async log() to avoid dropping messages under stdout backpressure
BEFORE CODE: break;
}
case LogLevel.Warn: {
console.log(`::warning::${message}`);
break;... | The JSDoc for `logMessageAsync()` says it "Automatically prefixes messages with LOG_PREFIX", but the implementation writes `message` verbatim (no `LOG_PREFIX` concatenation). Either update the docs to reflect caller-provided prefixes, or implement the prefixing inside `logMessageAsync()` for consistency with the commen... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
/**
* Create a deterministic key for an OAD message to enable deduplication
*/
export function createMessageKey(message: OadMessage): string {
// Create a deterministic key based on message properties that define uniqueness
// Adjust these properties based on what makes an OadMessage unique
return JSON.strin... | ```suggestion
fs.appendFileSync(logFilePath, msg);
fs.appendFileSync(logFilePath, "\n");
``` | }
/**
* Create a deterministic key for an OAD message to enable deduplication
*/
export function createMessageKey(message: OadMessage): string {
// Create a deterministic key based on message properties that define uniqueness
// Adjust these properties based on what makes an OadMessage unique
return JSON.strin... | @@ -108,39 +108,38 @@ export function createMessageKey(message: OadMessage): string {
/**
* Append a message to the log file
*/
-export function appendToLogFile(logFilePath: string, msg: string): void {
- fs.appendFileSync(logFilePath, msg);
- fs.appendFileSync(logFilePath, "\n");
- logMessageSafe("oad-message-... | eng/tools/openapi-diff-runner/src/utils/oad-message-processor.ts | 26 | TypeScript | 0.714 | suggestion | 101 | 51 | 51 | false | [openapi-diff-runner] Use async log() to avoid dropping messages under stdout backpressure | 40,618 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Copilot | Review this pull request change.
Language: TypeScript
File: eng/tools/openapi-diff-runner/src/utils/oad-message-processor.ts
PR Title: [openapi-diff-runner] Use async log() to avoid dropping messages under stdout backpressure
BEFORE CODE: }
/**
* Create a deterministic key for an OAD message to enable deduplicati... | ```suggestion
fs.appendFileSync(logFilePath, msg);
fs.appendFileSync(logFilePath, "\n");
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
}
function processParameter(parameter: Refable<OpenAPI2Parameter>): Refable<OpenAPI2Parameter> {
const newParameter: Refable<OpenAPI2Parameter> = deepCopy(parameter);
if ((parameter as Ref<OpenAPI2Parameter>).$ref) {
const refPath = (parameter as Ref<OpenAPI2Parameter>).$ref;
const originalParameter = getO... | No issues found. | }
function processParameter(parameter: Refable<OpenAPI2Parameter>): Refable<OpenAPI2Parameter> {
const newParameter: Refable<OpenAPI2Parameter> = deepCopy(parameter);
if ((parameter as Ref<OpenAPI2Parameter>).$ref) {
const refPath = (parameter as Ref<OpenAPI2Parameter>).$ref;
const originalParameter = getO... | @@ -44,6 +44,9 @@ export function processDocument(document: OpenAPI2Document): OpenAPI2Document {
if (document.securityDefinitions) {
delete newDocument.securityDefinitions;
}
+ if (document.tags) {
+ delete newDocument.tags;
+ }
if (document.info && document.info["x-typespec-generated"]) {
dele... | eng/tools/typespec-migration-validation/src/document.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Fix some issues in command tsmv | 40,154 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | pshao25 | Review this pull request change.
Language: TypeScript
File: eng/tools/typespec-migration-validation/src/document.ts
PR Title: Fix some issues in command tsmv
BEFORE CODE: }
function processParameter(parameter: Refable<OpenAPI2Parameter>): Refable<OpenAPI2Parameter> {
const newParameter: Refable<OpenAPI2Parameter... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
expect(mockGetChangedFilesStatuses).toHaveBeenCalledWith({
baseCommitish: undefined,
cwd: undefined,
headCommitish: undefined,
paths: ["specification"],
});
});
it("should handle renames by adding them to additions and deletions", async () => {
const mockResult... | No issues found. | expect(mockGetChangedFilesStatuses).toHaveBeenCalledWith({
baseCommitish: undefined,
cwd: undefined,
headCommitish: undefined,
paths: ["specification"],
});
});
it("should handle renames by adding them to additions and deletions", async () => {
const mockResult... | @@ -347,16 +347,16 @@ describe("command-helpers", () => {
headCommitish: TEST_CONSTANTS.COMMITS.HEAD,
});
- // Expected result should have renames added to additions and deletions, and no renames property
const expectedResult = {
- additions: [...mockResult.additions, ...mockResult.... | eng/tools/openapi-diff-runner/test/command-helpers.test.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | [openapi-diff-runner] Properly handle renames in same-version check | 40,303 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Review this pull request change.
Language: TypeScript
File: eng/tools/openapi-diff-runner/test/command-helpers.test.ts
PR Title: [openapi-diff-runner] Properly handle renames in same-version check
BEFORE CODE: expect(mockGetChangedFilesStatuses).toHaveBeenCalledWith({
baseCommitish: undefined,
... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
];
const oldJson = JSON.stringify({
info: { title: "Service API", version: "1.0" },
paths: {
"/test": {
get: {
summary: "Test endpoint",
description: "Gets test data",
operationId: "Test_Get",
},
},
},
});
const ... | No issues found. | ];
const oldJson = JSON.stringify({
info: { title: "Service API", version: "1.0" },
paths: {
"/test": {
get: {
summary: "Test endpoint",
description: "Gets test data",
operationId: "Test_Get",
},
},
},
});
const ... | @@ -44,6 +44,7 @@ describe("checkTrivialChanges", () => {
expect(result).toMatchObject({
rmDocumentation: false,
rmExamples: false,
+ rmTypeSpec: false,
rmFunctional: false,
rmOther: false,
other: false,
@@ -71,6 +72,7 @@ describe("checkTrivialChanges", () => {
expect(r... | .github/workflows/test/arm-auto-signoff/trivial-changes-check.test.js | 0 | JavaScript | 1 | none | 16 | 51 | 51 | true | Include .tsp files as trivial/non-functional changes for ARM auto sign-off | 40,396 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Review this pull request change.
Language: JavaScript
File: .github/workflows/test/arm-auto-signoff/trivial-changes-check.test.js
PR Title: Include .tsp files as trivial/non-functional changes for ARM auto sign-off
BEFORE CODE: ];
const oldJson = JSON.stringify({
info: { title: "Service API", version... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
"not-spec/contosowidgetmanager/resource-manager/Microsoft.Contoso/stable/2021-11-01/contoso.json",
"specification/contosowidgetmanager/resource-manager/readme.md",
"specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-12-01-preview/contoso.json",
"specification/cont... | No issues found. | "not-spec/contosowidgetmanager/resource-manager/Microsoft.Contoso/stable/2021-11-01/contoso.json",
"specification/contosowidgetmanager/resource-manager/readme.md",
"specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/preview/2021-12-01-preview/contoso.json",
"specification/cont... | @@ -60,6 +60,30 @@ describe("changedFiles", () => {
expect(mockDiff).toHaveBeenCalledWith(["--name-only", "HEAD^", "HEAD"]);
});
+ it("getChangedFiles accepts gitOptions parameter", async () => {
+ const files = ["file1.json", "file2.json"];
+ mockDiff.mockResolvedValue(files.join("\n"));
+
+ await ... | .github/shared/test/changed-files.test.js | 0 | JavaScript | 1 | none | 16 | 51 | 51 | true | [summarize-impact] Add label "TypeSpec" for *.tsp renames | 40,414 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | mikeharder | Review this pull request change.
Language: JavaScript
File: .github/shared/test/changed-files.test.js
PR Title: [summarize-impact] Add label "TypeSpec" for *.tsp renames
BEFORE CODE: "not-spec/contosowidgetmanager/resource-manager/Microsoft.Contoso/stable/2021-11-01/contoso.json",
"specification/contoso... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
import { log } from "../src/console.js";
describe("console", () => {
describe("log", () => {
/** @type {import("vitest").MockInstance<typeof process.stdout.write>} */
let writeSpy;
beforeEach(() => {
writeSpy = vi.spyOn(process.stdout, "write").mockReturnValue(true);
});
afterEach(() => {... | No issues found. | import { log } from "../src/console.js";
describe("console", () => {
describe("log", () => {
/** @type {import("vitest").MockInstance<typeof process.stdout.write>} */
let writeSpy;
beforeEach(() => {
writeSpy = vi.spyOn(process.stdout, "write").mockReturnValue(true);
});
afterEach(() => {... | @@ -0,0 +1,51 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { log } from "../src/console.js";
+
+describe("console", () => {
+ describe("log", () => {
+ /** @type {import("vitest").MockInstance<typeof process.stdout.write>} */
+ let writeSpy;
+
+ beforeEach(() => {
+ ... | .github/shared/test/console.test.js | 0 | JavaScript | 1 | none | 16 | 51 | 51 | true | [.github/shared] Add async backpressure-aware log() helper to console.js | 40,568 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/console.test.js
PR Title: [.github/shared] Add async backpressure-aware log() helper to console.js
BEFORE CODE: import { log } from "../src/console.js";
describe("console", () => {
describe("log", () => {
/** @type {import("vites... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
await expect(
specModel.getAffectedReadmeTags(resolve(folder, "data-plane/a.json")),
).rejects.toThrowError(/Failed to read file for swagger/i);
});
it("throws when an input-file is invalid JSON", async () => {
const folder = resolve(
__dirname,
"fixtures/getAffectedR... | No issues found. |
await expect(
specModel.getAffectedReadmeTags(resolve(folder, "data-plane/a.json")),
).rejects.toThrowError(/Failed to read file for swagger/i);
});
it("throws when an input-file is invalid JSON", async () => {
const folder = resolve(
__dirname,
"fixtures/getAffectedR... | @@ -127,6 +127,21 @@ describe("SpecModel", () => {
).toBeDefined();
});
+ it("sorts readmes in toJSONAsync", async () => {
+ const folder = resolve(__dirname, "fixtures/getSpecModel/specification/multi-readme");
+
+ const specModel = new SpecModel(folder, options);
+ const json = /** @type {import('... | .github/shared/test/spec-model.test.js | 0 | JavaScript | 1 | none | 16 | 51 | 51 | true | [.github/shared] Add tests to restore 100% statement coverage | 40,579 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/spec-model.test.js
PR Title: [.github/shared] Add tests to restore 100% statement coverage
BEFORE CODE:
await expect(
specModel.getAffectedReadmeTags(resolve(folder, "data-plane/a.json")),
).rejects.toThrowError(/Fa... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
content: `{"paths": "invalid"}`,
tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
// getRefs() shouldn't throw, since it doesn't care about the zod schema
// ensures we are evaluating each data method lazily
await expect(swagger.getRefs().then((m) => new Set(m.ke... | No issues found. | content: `{"paths": "invalid"}`,
tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
// getRefs() shouldn't throw, since it doesn't care about the zod schema
// ensures we are evaluating each data method lazily
await expect(swagger.getRefs().then((m) => new Set(m.ke... | @@ -243,6 +243,15 @@ describe("Swagger", () => {
);
});
+ it("returns cached examples on second call", async () => {
+ const swagger = new Swagger(resolve(__dirname, "fixtures/swagger/ignoreExamples/swagger.json"));
+ const examples1 = await swagger.getExamples();
+ const examples2 = await swagger.g... | .github/shared/test/swagger.test.js | 0 | JavaScript | 1 | none | 16 | 51 | 51 | true | [.github/shared] Enforce 100% for all coverage metrics | 40,584 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Review this pull request change.
Language: JavaScript
File: .github/shared/test/swagger.test.js
PR Title: [.github/shared] Enforce 100% for all coverage metrics
BEFORE CODE: content: `{"paths": "invalid"}`,
tag: new Tag("test-tag", [], { readme: new Readme("/fake/readme.md") }),
});
// getRefs(... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
// otherwise we just depend upon the summary report to show the error
if (error.line && error.column) {
core.error(msg, { file: error.file, startLine: error.line, startColumn: error.column });
}
});
}
export async function outputSuccessSummary(swaggerFiles: string[], reportName: string) {
const b... | No issues found. | // otherwise we just depend upon the summary report to show the error
if (error.line && error.column) {
core.error(msg, { file: error.file, startLine: error.line, startColumn: error.column });
}
});
}
export async function outputSuccessSummary(swaggerFiles: string[], reportName: string) {
const b... | @@ -1,4 +1,4 @@
-import { annotateFileError, setSummary } from "@azure-tools/specs-shared/error-reporting";
+import * as core from "@actions/core";
export interface ReportableOavError {
message: string;
@@ -19,12 +19,12 @@ export function outputAnnotatedErrors(errors: ReportableOavError[]) {
// we only attem... | eng/tools/oav-runner/src/formatting.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | [.github/shared] Replace error-reporting.js with @actions/core | 40,587 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Review this pull request change.
Language: TypeScript
File: eng/tools/oav-runner/src/formatting.ts
PR Title: [.github/shared] Replace error-reporting.js with @actions/core
BEFORE CODE: // otherwise we just depend upon the summary report to show the error
if (error.line && error.column) {
core.error(ms... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
}
case LogLevel.Info:
default: {
console.log(message);
break;
}
}
}
/**
* Log an error with file location information for GitHub Actions
* Automatically prefixes messages with LOG_PREFIX.
* @param message Error message
* @param file File path (optional)
* @param line Line number (opt... | No issues found. | }
case LogLevel.Info:
default: {
console.log(message);
break;
}
}
}
/**
* Log an error with file location information for GitHub Actions
* Automatically prefixes messages with LOG_PREFIX.
* @param message Error message
* @param file File path (optional)
* @param line Line number (opt... | @@ -1,4 +1,4 @@
-import { appendFileSync } from "node:fs";
+import * as core from "@actions/core";
/**
* Log prefix for all messages from openapi-diff-runner
@@ -97,40 +97,20 @@ export function logWarning(message: string, file?: string, line?: number, col?:
* @param value Output parameter value
*/
export func... | eng/tools/openapi-diff-runner/src/log.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | [openapi-diff-runner] Re-implement helpers using @actions/core | 40,612 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Review this pull request change.
Language: TypeScript
File: eng/tools/openapi-diff-runner/src/log.ts
PR Title: [openapi-diff-runner] Re-implement helpers using @actions/core
BEFORE CODE: }
case LogLevel.Info:
default: {
console.log(message);
break;
}
}
}
/**
* Log an error with file ... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
const oadMessages: OadMessage[] = [createTestOadMessage()];
const result = await applyRules(oadMessages, "CrossVersion", ApiVersionLifecycleStage.STABLE);
expect(result).toHaveLength(1);
expect(result[0].type).toBe("Error");
expect(result[0].groupName).toBe(ApiVersionLifecycleStage.STABL... | No issues found. | const oadMessages: OadMessage[] = [createTestOadMessage()];
const result = await applyRules(oadMessages, "CrossVersion", ApiVersionLifecycleStage.STABLE);
expect(result).toHaveLength(1);
expect(result[0].type).toBe("Error");
expect(result[0].groupName).toBe(ApiVersionLifecycleStage.STABL... | @@ -17,6 +17,7 @@ vi.mock("../../src/command-helpers.js", () => ({
// Mock the log module
vi.mock("../../src/log.js", () => ({
logMessage: vi.fn(),
+ logMessageAsync: vi.fn(),
logWarning: vi.fn(),
LogLevel: {
Info: "Info",
@@ -74,10 +75,10 @@ describe("apply-rules", () => {
});
describe("applyR... | eng/tools/openapi-diff-runner/test/utils/apply-rules.test.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | [openapi-diff-runner] Use async log() to avoid dropping messages under stdout backpressure | 40,618 | Azure/azure-rest-api-specs | 2,667 | TypeSpec | Copilot | Review this pull request change.
Language: TypeScript
File: eng/tools/openapi-diff-runner/test/utils/apply-rules.test.ts
PR Title: [openapi-diff-runner] Use async log() to avoid dropping messages under stdout backpressure
BEFORE CODE: const oadMessages: OadMessage[] = [createTestOadMessage()];
const re... | No issues found. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. | |
assert full_peak is not None
state_change_summary = StateChangeSummary(peak, uint32(max(peak.height - 1, 0)), [], [], [], [])
# Must be called under priority_mutex
ppp_result: PeakPostProcessingResult = await self.peak_post_processing(
... | is this comment still applicable?
```suggestion
``` | assert full_peak is not None
state_change_summary = StateChangeSummary(peak, uint32(max(peak.height - 1, 0)), [], [], [], [])
# Must be called under priority_mutex
ppp_result: PeakPostProcessingResult = await self.peak_post_processing(
... | @@ -345,56 +345,55 @@ async def manage(self) -> AsyncIterator[None]:
self.wallet_sync_task = create_referenced_task(self._wallets_sync_task_handler())
self.initialized = True
+
+ # TODO: this is the place the code needs juicing up | chia/full_node/full_node.py | 26 | Python | 0.571 | question | 55 | 51 | 51 | false | [CHIA-2615] Add ContextManager to FullNodePeers | 19,427 | Chia-Network/chia-blockchain | 10,822 | Python | altendky | matt-o-how | Review this pull request change.
Language: Python
File: chia/full_node/full_node.py
PR Title: [CHIA-2615] Add ContextManager to FullNodePeers
BEFORE CODE: assert full_peak is not None
state_change_summary = StateChangeSummary(peak, uint32(max(peak.height - 1, 0)), [], [], [],... | is this comment still applicable?
```suggestion
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
from chia.util.safe_cancel_task import cancel_task_safe
from chia.util.task_referencer import create_referenced_task
MAX_PEERS_RECEIVED_PER_REQUEST = 1000
MAX_TOTAL_PEERS_RECEIVED = 3000
MAX_CONCURRENT_OUTBOUND_CONNECTIONS = 70
NETWORK_ID_DEFAULT_PORTS = {
"mainnet": 8444,
"testnet7": 58444,
"testnet10": 5... | i tend away from using `init=False`, personally. if someone wants to set it they can just assign after creating the instance anyways so it doesn't really protect against anything. | from chia.util.safe_cancel_task import cancel_task_safe
from chia.util.task_referencer import create_referenced_task
MAX_PEERS_RECEIVED_PER_REQUEST = 1000
MAX_TOTAL_PEERS_RECEIVED = 3000
MAX_CONCURRENT_OUTBOUND_CONNECTIONS = 70
NETWORK_ID_DEFAULT_PORTS = {
"mainnet": 8444,
"testnet7": 58444,
"testnet10": 5... | @@ -40,56 +42,49 @@
}
+@dataclass
class FullNodeDiscovery:
- resolver: Optional[dns.asyncresolver.Resolver]
- enable_private_networks: bool
-
- def __init__(
- self,
- server: ChiaServer,
- target_outbound_count: int,
- peers_file_path: Path,
- introducer_info: Optional... | chia/server/node_discovery.py | 26 | Python | 0.5 | suggestion | 180 | 51 | 51 | false | [CHIA-2615] Add ContextManager to FullNodePeers | 19,427 | Chia-Network/chia-blockchain | 10,822 | Python | altendky | matt-o-how | Review this pull request change.
Language: Python
File: chia/server/node_discovery.py
PR Title: [CHIA-2615] Add ContextManager to FullNodePeers
BEFORE CODE: from chia.util.safe_cancel_task import cancel_task_safe
from chia.util.task_referencer import create_referenced_task
MAX_PEERS_RECEIVED_PER_REQUEST = 1000
MAX... | i tend away from using `init=False`, personally. if someone wants to set it they can just assign after creating the instance anyways so it doesn't really protect against anything. | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
target_outbound_count: int
peers_file_path: Path
dns_servers: list[str]
peer_connect_interval: int
selected_network: str
log: Logger
introducer_info: Optional[dict[str, Any]] = None
default_port: Optional[int] = None
resolver: Optional[dns.asyncresolver.Resolver] = field(default=None... | i tend away from `.__post_init__()` and towards `.create()` or `.managed()` classmethods. this both allows you to directly instantiate with complete control when you want to and also makes it clear when you are doing calculations to create the instance. also, a classmethod can be used consistently for both sync or as... | target_outbound_count: int
peers_file_path: Path
dns_servers: list[str]
peer_connect_interval: int
selected_network: str
log: Logger
introducer_info: Optional[dict[str, Any]] = None
default_port: Optional[int] = None
resolver: Optional[dns.asyncresolver.Resolver] = field(default=None... | @@ -40,56 +42,49 @@
}
+@dataclass
class FullNodeDiscovery:
- resolver: Optional[dns.asyncresolver.Resolver]
- enable_private_networks: bool
-
- def __init__(
- self,
- server: ChiaServer,
- target_outbound_count: int,
- peers_file_path: Path,
- introducer_info: Optional... | chia/server/node_discovery.py | 26 | Python | 0.643 | suggestion | 357 | 51 | 51 | false | [CHIA-2615] Add ContextManager to FullNodePeers | 19,427 | Chia-Network/chia-blockchain | 10,822 | Python | altendky | matt-o-how | Review this pull request change.
Language: Python
File: chia/server/node_discovery.py
PR Title: [CHIA-2615] Add ContextManager to FullNodePeers
BEFORE CODE: target_outbound_count: int
peers_file_path: Path
dns_servers: list[str]
peer_connect_interval: int
selected_network: str
log: Logger
... | i tend away from `.__post_init__()` and towards `.create()` or `.managed()` classmethods. this both allows you to directly instantiate with complete control when you want to and also makes it clear when you are doing calculations to create the instance. also, a classmethod can be used consistently for both sync or as... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
now = int(math.floor(time.time()))
chance = 1.0
since_last_try = max(now - self.last_try, 0)
# deprioritize very recent attempts away
if since_last_try < 60 * 10:
chance *= 0.01
# deprioritize 66% after each failed attempt,
# but at most 1/28th to... | ```suggestion
key: int = field(default_factory=lambda: randbits(256))
```
or
```suggestion
key: int = field(default_factory=functools.partial(randbits, 256))
```
depending your preference | if now is None:
now = int(math.floor(time.time()))
chance = 1.0
since_last_try = max(now - self.last_try, 0)
# deprioritize very recent attempts away
if since_last_try < 60 * 10:
chance *= 0.01
# deprioritize 66% after each failed attempt,
... | @@ -159,26 +160,32 @@ def get_selection_chance(self, now: Optional[int] = None) -> float:
return chance
+def create_tried_matrix() -> list[list[int]]:
+ return [[-1 for x in range(BUCKET_SIZE)] for y in range(TRIED_BUCKET_COUNT)]
+
+
+def create_new_matrix() -> list[list[int]]:
+ return [[-1 for x in... | chia/server/address_manager.py | 26 | Python | 0.857 | suggestion | 202 | 51 | 51 | false | [CHIA-2615] Add ContextManager to FullNodePeers | 19,427 | Chia-Network/chia-blockchain | 10,822 | Python | altendky | matt-o-how | Review this pull request change.
Language: Python
File: chia/server/address_manager.py
PR Title: [CHIA-2615] Add ContextManager to FullNodePeers
BEFORE CODE: now = int(math.floor(time.time()))
chance = 1.0
since_last_try = max(now - self.last_try, 0)
# deprioritize very recent at... | ```suggestion
key: int = field(default_factory=lambda: randbits(256))
```
or
```suggestion
key: int = field(default_factory=functools.partial(randbits, 256))
```
depending your preference | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
block: Union[BlockInfo, FullBlock]
if verify_signatures:
block = FullBlock.from_bytes_unchecked(zstd.decompress(r[2]))
else:
block = block_info_from_block(zstd.decompress(r[2]))
if block.transactions_generator is None:
sys.stderr.write(f" no-generator... | Oh, looks like this is wrong, this disables Keccak as well when not using MEMPOOL_MODE.
| block: Union[BlockInfo, FullBlock]
if verify_signatures:
block = FullBlock.from_bytes_unchecked(zstd.decompress(r[2]))
else:
block = block_info_from_block(zstd.decompress(r[2]))
if block.transactions_generator is None:
sys.stderr.write(f" no-generator... | @@ -118,9 +119,9 @@ def main(
ref_lookup_time = time() - start_time
- flags: int
+ flags = ENABLE_KECCAK
if mempool_mode:
- flags = MEMPOOL_MODE
+ flags |= MEMPOOL_MODE
else:
flags = 0 | tools/analyze-chain.py | 26 | Python | 0.214 | bug | 89 | 51 | 51 | false | Enable Keccak for 2.5.4 | 19,563 | Chia-Network/chia-blockchain | 10,822 | Python | emlowe | emlowe | Review this pull request change.
Language: Python
File: tools/analyze-chain.py
PR Title: Enable Keccak for 2.5.4
BEFORE CODE: block: Union[BlockInfo, FullBlock]
if verify_signatures:
block = FullBlock.from_bytes_unchecked(zstd.decompress(r[2]))
else:
block = block_inf... | Oh, looks like this is wrong, this disables Keccak as well when not using MEMPOOL_MODE.
| You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
min_value = 1 << (3 + 8 + 8 + 8)
elif (b & 0b11111110) == 0b11111100:
# 1 + 8 + 8 + 8 + 8 + 8 bits length prefix
mask = 0b00000001
prefix_len = 5
min_value = 1 << (2 + 8 + 8 + 8 + 8)
atom_len = b & mask
for i in range(prefix_len):
atom_len <<= 8
offse... | This is invalid. Wouldn't canonical representations be required to be valid? | min_value = 1 << (3 + 8 + 8 + 8)
elif (b & 0b11111110) == 0b11111100:
# 1 + 8 + 8 + 8 + 8 + 8 bits length prefix
mask = 0b00000001
prefix_len = 5
min_value = 1 << (2 + 8 + 8 + 8 + 8)
atom_len = b & mask
for i in range(prefix_len):
atom_len <<= 8
offse... | @@ -150,6 +150,93 @@ class NewPeakItem:
QUOTE_EXECUTION_COST = 20
+def is_atom_canonical(clvm_buffer: bytes, offset: int) -> tuple[int, bool]:
+ b = clvm_buffer[offset]
+ if (b & 0b11000000) == 0b10000000:
+ # 6 bits length prefix
+ mask = 0b00111111
+ prefix_len = 0
+ min_value =... | chia/full_node/mempool_manager.py | 26 | Python | 0.214 | question | 76 | 51 | 51 | false | Improve dedup | 19,565 | Chia-Network/chia-blockchain | 10,822 | Python | richardkiss | arvidn | Review this pull request change.
Language: Python
File: chia/full_node/mempool_manager.py
PR Title: Improve dedup
BEFORE CODE: min_value = 1 << (3 + 8 + 8 + 8)
elif (b & 0b11111110) == 0b11111100:
# 1 + 8 + 8 + 8 + 8 + 8 bits length prefix
mask = 0b00000001
prefix_len = 5
... | This is invalid. Wouldn't canonical representations be required to be valid? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
# 1 + 8 + 8 + 8 + 8 + 8 bits length prefix
mask = 0b00000001
prefix_len = 5
min_value = 1 << (2 + 8 + 8 + 8 + 8)
atom_len = b & mask
for i in range(prefix_len):
atom_len <<= 8
offset += 1
atom_len |= clvm_buffer[offset]
return 1 + prefix_len + atom_l... | What is a token? Maybe "leaf" or "atom"? | # 1 + 8 + 8 + 8 + 8 + 8 bits length prefix
mask = 0b00000001
prefix_len = 5
min_value = 1 << (2 + 8 + 8 + 8 + 8)
atom_len = b & mask
for i in range(prefix_len):
atom_len <<= 8
offset += 1
atom_len |= clvm_buffer[offset]
return 1 + prefix_len + atom_l... | @@ -150,6 +150,93 @@ class NewPeakItem:
QUOTE_EXECUTION_COST = 20
+def is_atom_canonical(clvm_buffer: bytes, offset: int) -> tuple[int, bool]:
+ b = clvm_buffer[offset]
+ if (b & 0b11000000) == 0b10000000:
+ # 6 bits length prefix
+ mask = 0b00111111
+ prefix_len = 0
+ min_value =... | chia/full_node/mempool_manager.py | 26 | Python | 0.071 | question | 40 | 51 | 51 | false | Improve dedup | 19,565 | Chia-Network/chia-blockchain | 10,822 | Python | richardkiss | arvidn | Review this pull request change.
Language: Python
File: chia/full_node/mempool_manager.py
PR Title: Improve dedup
BEFORE CODE: # 1 + 8 + 8 + 8 + 8 + 8 bits length prefix
mask = 0b00000001
prefix_len = 5
min_value = 1 << (2 + 8 + 8 + 8 + 8)
atom_len = b & mask
for i in range(... | What is a token? Maybe "leaf" or "atom"? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
and will make this function return false
"""
if clvm_buffer == b"":
return True
offset = 0
tokens_left = 1
while True:
b = clvm_buffer[offset]
# pair
if b == 0xFF:
tokens_left += 1
offset += 1
continue
# back referenc... | I don't see a check for `offset > len(clvm_buffer)` anywhere, which suggest ill-formed clvm will raise. But maybe you never pass in ill-formed clvm (in which case, you don't need the `clvm_buffer == b''` case either). | and will make this function return false
"""
assert clvm_buffer != b""
offset = 0
tokens_left = 1
while True:
b = clvm_buffer[offset]
# pair
if b == 0xFF:
tokens_left += 1
offset += 1
continue
# back references cannot be cons... | @@ -150,6 +150,93 @@ class NewPeakItem:
QUOTE_EXECUTION_COST = 20
+def is_atom_canonical(clvm_buffer: bytes, offset: int) -> tuple[int, bool]:
+ b = clvm_buffer[offset]
+ if (b & 0b11000000) == 0b10000000:
+ # 6 bits length prefix
+ mask = 0b00111111
+ prefix_len = 0
+ min_value =... | chia/full_node/mempool_manager.py | 26 | Python | 0.571 | suggestion | 217 | 51 | 51 | false | Improve dedup | 19,565 | Chia-Network/chia-blockchain | 10,822 | Python | richardkiss | arvidn | Review this pull request change.
Language: Python
File: chia/full_node/mempool_manager.py
PR Title: Improve dedup
BEFORE CODE: and will make this function return false
"""
if clvm_buffer == b"":
return True
offset = 0
tokens_left = 1
while True:
b = clvm_buffer[offset]
... | I don't see a check for `offset > len(clvm_buffer)` anywhere, which suggest ill-formed clvm will raise. But maybe you never pass in ill-formed clvm (in which case, you don't need the `clvm_buffer == b''` case either). | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
created_coins=[[(singleton_spend.coin.puzzle_hash, 1, None)], []],
cost=1337,
)
bundle_add_info2 = await mempool_manager.add_spend_bundle(sb2, sb2_conds, sb2.name(), uint32(1))
assert bundle_add_info2.status == MempoolInclusionStatus.SUCCESS
assert mempool_manager.peak is not None
bl... | `add_spend_bundle()` was failing for the wrong reason previously (`UNKNOWN_UNSPENT`) | created_coins=[[(singleton_spend.coin.puzzle_hash, 1, None)], []],
cost=1337,
)
bundle_add_info2 = await mempool_manager.add_spend_bundle(sb2, sb2_conds, sb2.name(), uint32(1))
assert bundle_add_info2.status == MempoolInclusionStatus.SUCCESS
assert mempool_manager.peak is not None
bl... | @@ -2641,14 +2641,16 @@ async def test_check_removals_with_block_creation(flags: int) -> None:
@pytest.mark.anyio
async def test_dedup_not_canonical() -> None:
- # this is 1, but with a non-canonical encoding
- coin_spend = mk_coin_spend(TEST_COIN, solution="c00101")
- coins = TestCoins(coins=[], lineage={... | chia/_tests/core/mempool/test_mempool_manager.py | 26 | Python | 0.357 | bug | 84 | 51 | 51 | false | amendment to Dedup patch #19565 | 19,569 | Chia-Network/chia-blockchain | 10,822 | Python | arvidn | arvidn | Review this pull request change.
Language: Python
File: chia/_tests/core/mempool/test_mempool_manager.py
PR Title: amendment to Dedup patch #19565
BEFORE CODE: created_coins=[[(singleton_spend.coin.puzzle_hash, 1, None)], []],
cost=1337,
)
bundle_add_info2 = await mempool_manager.add_spend_b... | `add_spend_bundle()` was failing for the wrong reason previously (`UNKNOWN_UNSPENT`) | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
_, status, error = await add_spendbundle(mempool_manager, sb, sb.name())
assert (status, error) == (expected_status, expected_error)
except ValidationError as e:
assert expected_status == mis.FAILED
assert expected_error == e.code
def test_optional_min() -> None:
assert optiona... | ```suggestion
SerializedProgram.fromhex(solution if solution is not None else "80"),
``` | _, status, error = await add_spendbundle(mempool_manager, sb, sb.name())
assert (status, error) == (expected_status, expected_error)
except ValidationError as e:
assert expected_status == mis.FAILED
assert expected_error == e.code
def test_optional_min() -> None:
assert optiona... | @@ -834,7 +834,7 @@ def mk_coin_spend(coin: Coin, solution: Optional[str] = None) -> CoinSpend:
return make_spend(
coin,
SerializedProgram.to(None),
- SerializedProgram.to(bytes.fromhex(solution) if solution is not None else None),
+ SerializedProgram.from_bytes(bytes.fromhex(soluti... | chia/_tests/core/mempool/test_mempool_manager.py | 26 | Python | 0.571 | suggestion | 98 | 51 | 51 | false | amendment to Dedup patch #19565 | 19,569 | Chia-Network/chia-blockchain | 10,822 | Python | AmineKhaldi | arvidn | Review this pull request change.
Language: Python
File: chia/_tests/core/mempool/test_mempool_manager.py
PR Title: amendment to Dedup patch #19565
BEFORE CODE: _, status, error = await add_spendbundle(mempool_manager, sb, sb.name())
assert (status, error) == (expected_status, expected_error)
exc... | ```suggestion
SerializedProgram.fromhex(solution if solution is not None else "80"),
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
async def create(
wallet_state_manager: Any,
db_wrapper: DBWrapper2,
name: Optional[str] = None,
) -> TradeManager:
self = TradeManager()
if name:
self.log = logging.getLogger(name)
else:
self.log = logging.getLogger(__name__)
self... | While in here, might as well fix "treade" too | async def create(
wallet_state_manager: Any,
db_wrapper: DBWrapper2,
name: Optional[str] = None,
) -> TradeManager:
self = TradeManager()
if name:
self.log = logging.getLogger(name)
else:
self.log = logging.getLogger(__name__)
self... | @@ -122,7 +122,7 @@ async def get_coins_of_interest(
) -> set[bytes32]:
"""
Returns list of coins we want to check if they are included in filter,
- These will include coins that belong to us and coins that that on other side of treade
+ These will include coins that belong to us an... | chia/wallet/trade_manager.py | 26 | Python | 0.071 | suggestion | 45 | 51 | 51 | false | chore: fix some typos in comment | 19,594 | Chia-Network/chia-blockchain | 10,822 | Python | hoffmang9 | yetyear | Review this pull request change.
Language: Python
File: chia/wallet/trade_manager.py
PR Title: chore: fix some typos in comment
BEFORE CODE: async def create(
wallet_state_manager: Any,
db_wrapper: DBWrapper2,
name: Optional[str] = None,
) -> TradeManager:
self = TradeManager... | While in here, might as well fix "treade" too | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
return await self.get_terminal_node(kid, vid, store_id)
async def get_terminal_nodes_by_hashes(
self,
node_hashes: list[bytes32],
store_id: bytes32,
root_hash: Union[bytes32, Unspecified] = unspecified,
) -> list[TerminalNode]:
resolved_root_hash: Optional[bytes3... | looks like duplicate loops that could be combined and avoid recalling `.get_node_by_hash()`? I didn't dig into the details of the table blobs here but it seems like something that could be built along the way. maybe? | return await self.get_terminal_node(kid, vid, store_id)
async def get_terminal_nodes_by_hashes(
self,
node_hashes: list[bytes32],
store_id: bytes32,
root_hash: Union[bytes32, Unspecified] = unspecified,
) -> list[TerminalNode]:
resolved_root_hash: Optional[bytes3... | @@ -654,6 +654,34 @@ async def get_terminal_node_by_hash(
kid, vid = merkle_blob.get_node_by_hash(node_hash)
return await self.get_terminal_node(kid, vid, store_id)
+ async def get_terminal_nodes_by_hashes(
+ self,
+ node_hashes: list[bytes32],
+ store_id: bytes32,
+ r... | chia/data_layer/data_store.py | 26 | Python | 0.643 | refactor | 218 | 51 | 51 | false | Optimize DL functions for get keys/values. | 19,609 | Chia-Network/chia-blockchain | 10,822 | Python | altendky | fchirica | Review this pull request change.
Language: Python
File: chia/data_layer/data_store.py
PR Title: Optimize DL functions for get keys/values.
BEFORE CODE: return await self.get_terminal_node(kid, vid, store_id)
async def get_terminal_nodes_by_hashes(
self,
node_hashes: list[bytes32],
... | looks like duplicate loops that could be combined and avoid recalling `.get_node_by_hash()`? I didn't dig into the details of the table blobs here but it seems like something that could be built along the way. maybe? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
) -> TerminalNode:
key = self.get_blob_from_table_blob(table_blobs[KeyOrValueId(kid.raw)], store_id)
value = self.get_blob_from_table_blob(table_blobs[KeyOrValueId(vid.raw)], store_id)
return TerminalNode(hash=leaf_hash(key, value), key=key, value=value)
async def get_keys_values(
... | if `.get_table_blobs()` took an iterable rather than a list then we could avoid generating this list. it already does `kv_ids = list(set(kv_ids))` right away inside. i wrote up a way to avoid that with islice too, but threw it away.
anyways, probably none of this is actually a big deal but i figured i'd mention it... | key = self.get_blob_from_table_blob(table_blobs[KeyOrValueId(kid.raw)], store_id)
value = self.get_blob_from_table_blob(table_blobs[KeyOrValueId(vid.raw)], store_id)
return TerminalNode(hash=leaf_hash(key, value), key=key, value=value)
async def get_keys_values(
self,
store_... | @@ -1017,11 +1052,12 @@ async def get_keys_values(
return []
kv_ids = merkle_blob.get_keys_values()
+ kv_ids_unpacked = [KeyOrValueId(id.raw) for pair in kv_ids.items() for id in pair]
+ table_blobs = await self.get_table_blobs(kv_ids_unpacked, store_id) | chia/data_layer/data_store.py | 26 | Python | 0.857 | suggestion | 558 | 51 | 51 | false | Optimize DL functions for get keys/values. | 19,609 | Chia-Network/chia-blockchain | 10,822 | Python | altendky | fchirica | Review this pull request change.
Language: Python
File: chia/data_layer/data_store.py
PR Title: Optimize DL functions for get keys/values.
BEFORE CODE: ) -> TerminalNode:
key = self.get_blob_from_table_blob(table_blobs[KeyOrValueId(kid.raw)], store_id)
value = self.get_blob_from_table_blob(table... | if `.get_table_blobs()` took an iterable rather than a list then we could avoid generating this list. it already does `kv_ids = list(set(kv_ids))` right away inside. i wrote up a way to avoid that with islice too, but threw it away.
anyways, probably none of this is actually a big deal but i figured i'd mention it... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
store_id: bytes32,
root_hash: Union[bytes32, Unspecified] = unspecified,
) -> dict[bytes, bytes]:
pairs = await self.get_keys_values(store_id=store_id, root_hash=root_hash)
return {node.key: node.value for node in pairs}
async def get_keys(
self,
store_id: bytes3... | maybe worth changing to `async def get_table_blobs(self, kv_ids: list[Union[KeyOrValueId, KeyId, ValueId]]` to avoid the conversions? though i can't say i know offhand what sqlite does with a `KeyId` directly... anyways, maybe close this after reading and we'll consider this separately. just seems like it would be n... | root_hash: Union[bytes32, Unspecified] = unspecified,
) -> dict[bytes, bytes]:
pairs = await self.get_keys_values(store_id=store_id, root_hash=root_hash)
return {node.key: node.value for node in pairs}
async def get_keys(
self,
store_id: bytes32,
root_hash: Union... | @@ -1206,11 +1250,11 @@ async def get_keys(
return []
kv_ids = merkle_blob.get_keys_values()
+ raw_key_ids = [KeyOrValueId(id.raw) for id in kv_ids.keys()]
+ table_blobs = await self.get_table_blobs(raw_key_ids, store_id) | chia/data_layer/data_store.py | 26 | Python | 0.643 | suggestion | 376 | 51 | 51 | false | Optimize DL functions for get keys/values. | 19,609 | Chia-Network/chia-blockchain | 10,822 | Python | altendky | fchirica | Review this pull request change.
Language: Python
File: chia/data_layer/data_store.py
PR Title: Optimize DL functions for get keys/values.
BEFORE CODE: store_id: bytes32,
root_hash: Union[bytes32, Unspecified] = unspecified,
) -> dict[bytes, bytes]:
pairs = await self.get_keys_values(sto... | maybe worth changing to `async def get_table_blobs(self, kv_ids: list[Union[KeyOrValueId, KeyId, ValueId]]` to avoid the conversions? though i can't say i know offhand what sqlite does with a `KeyId` directly... anyways, maybe close this after reading and we'll consider this separately. just seems like it would be n... | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
else:
resolved_root_hash = root_hash
merkle_blob = await self.get_merkle_blob(store_id=store_id, root_hash=resolved_root_hash)
kid, vid = merkle_blob.get_node_by_hash(node_hash)
return await self.get_terminal_node(kid, vid, store_id)
async def get_first_generation(self,... | ```suggestion
kv_ids_unpacked = (
KeyOrValueId(id.raw)
for node_hash in node_hashes
for id in merkle_blob.get_node_by_hash(node_hash)
)
``` | else:
resolved_root_hash = root_hash
merkle_blob = await self.get_merkle_blob(store_id=store_id, root_hash=resolved_root_hash)
kid, vid = merkle_blob.get_node_by_hash(node_hash)
return await self.get_terminal_node(kid, vid, store_id)
async def get_terminal_nodes_by_hash... | @@ -654,6 +654,33 @@ async def get_terminal_node_by_hash(
kid, vid = merkle_blob.get_node_by_hash(node_hash)
return await self.get_terminal_node(kid, vid, store_id)
+ async def get_terminal_nodes_by_hashes(
+ self,
+ node_hashes: list[bytes32],
+ store_id: bytes32,
+ r... | chia/data_layer/data_store.py | 26 | Python | 0.714 | suggestion | 197 | 51 | 51 | false | Optimize DL functions for get keys/values. | 19,609 | Chia-Network/chia-blockchain | 10,822 | Python | altendky | fchirica | Review this pull request change.
Language: Python
File: chia/data_layer/data_store.py
PR Title: Optimize DL functions for get keys/values.
BEFORE CODE: else:
resolved_root_hash = root_hash
merkle_blob = await self.get_merkle_blob(store_id=store_id, root_hash=resolved_root_hash)
... | ```suggestion
kv_ids_unpacked = (
KeyOrValueId(id.raw)
for node_hash in node_hashes
for id in merkle_blob.get_node_by_hash(node_hash)
)
``` | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
log.info(
"Not skipping peak, don't have. Maybe we are not the fastest timelord "
f"height: {new_peak.reward_chain_block.height} weight:"
f"{new_peak.reward_chain_block.weight} "
)
self.timelord.new_peak = new_pe... | we would expect this unfinished block to be removed later, when `_handle_new_peak()` is called, right? | return
log.info(
"Not skipping peak, don't have. Maybe we are not the fastest timelord "
f"height: {new_peak.reward_chain_block.height} weight:"
f"{new_peak.reward_chain_block.weight} rh {new_peak.reward_chain_block.get_has... | @@ -99,13 +101,22 @@ async def new_peak_timelord(self, new_peak: timelord_protocol.NewPeakTimelord) -
self.timelord.state_changed("skipping_peak", {"height": new_peak.reward_chain_block.height})
def check_orphaned_unfinished_block(self, new_peak: NewPeakTimelord):
+ new_peak_unf_rh = new_peak... | chia/timelord/timelord_api.py | 26 | Python | 0.714 | question | 102 | 51 | 51 | false | dont skip same peak if in unfinished cache | 19,626 | Chia-Network/chia-blockchain | 10,822 | Python | arvidn | almogdepaz | Review this pull request change.
Language: Python
File: chia/timelord/timelord_api.py
PR Title: dont skip same peak if in unfinished cache
BEFORE CODE: log.info(
"Not skipping peak, don't have. Maybe we are not the fastest timelord "
f"height: {new_peak.reward... | we would expect this unfinished block to be removed later, when `_handle_new_peak()` is called, right? | You are an expert software engineer and code reviewer. Review pull requests carefully for correctness, bugs, security issues, performance problems, maintainability, and unnecessary complexity. Only raise actionable issues supported by the code. Explain why an issue matters and suggest a concrete fix when appropriate. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.