Skip to content
Open
  •  
  •  
  •  
142 changes: 113 additions & 29 deletions .github/workflows/pr-comment-warnings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
---
name: Comment Warning Ratchet on PR

# Runs in the trusted base-repo context after the (possibly fork) "Unity Test"
# run completes, so it can comment with write permissions without exposing them
# to the untrusted lint job. Mirrors pr-comment-artifact-url.yml.
# Runs in the trusted base-repo context alongside the (possibly fork) "Unity Test"
# workflow, so it can comment with write permissions without exposing them to the
# untrusted lint job. Mirrors pr-comment-artifact-url.yml.
#
# 'requested' -> post a "Lint pending" banner the moment Unity Test starts, so a
# stale Passed/Blocked banner from a previous run never lingers.
# 'completed' -> ALWAYS refresh the banner: Passed / Blocked / Skipped (no C#
# changes) / Unavailable (lint did not finish). Keyed on the hidden
# <!-- warning-ratchet --> marker so every state edits the same comment.
on:
workflow_run:
types:
- "requested"
- "completed"
workflows:
- "Unity Test"
Expand All @@ -18,7 +25,50 @@ permissions:
pull-requests: write

jobs:
pending:
if: github.event.action == 'requested' && github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Resolve PR number
id: pr
env:
WORKFLOW_RUN_EVENT_OBJ: ${{ toJSON(github.event.workflow_run) }}
run: |
PR_NUMBER=$(jq -r '.pull_requests[0].number' <<< "$WORKFLOW_RUN_EVENT_OBJ")
echo "PR number: $PR_NUMBER"
if [[ -z "$PR_NUMBER" || "$PR_NUMBER" == "null" ]]; then
echo "No PR associated with this run, skipping."
echo "pr-number=" >> "$GITHUB_OUTPUT"
else
echo "pr-number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
fi

- name: Find existing comment
if: steps.pr.outputs.pr-number != ''
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ steps.pr.outputs.pr-number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- warning-ratchet -->'

- name: Upsert pending banner
if: steps.pr.outputs.pr-number != ''
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ steps.pr.outputs.pr-number }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: |-
<!-- warning-ratchet -->
![badge] <img src="https://ui.decentraland.org/decentraland_256x256.png" width="30">

Lint in progress, come back later!

[badge]: https://img.shields.io/badge/Lint-Pending!-ffff00?logo=github&style=for-the-badge

comment:
if: github.event.action == 'completed'
runs-on: ubuntu-latest
steps:
- name: Resolve PR number
Expand Down Expand Up @@ -50,7 +100,7 @@ jobs:
id: result
run: |
if [ ! -f warning-result.json ]; then
echo "No warning-result.json found, skipping."
echo "No warning-result.json found, treating as absent."
echo "found=false" >> "$GITHUB_OUTPUT"
exit 0
fi
Expand All @@ -62,52 +112,86 @@ jobs:
echo "baseline=$baseline" >> "$GITHUB_OUTPUT"
echo "allow-equal=$allow_equal" >> "$GITHUB_OUTPUT"

# Always compose a body, even when the artifact is absent (lint skipped or the
# Unity Test run failed before counting), so the banner never goes stale.
- name: Compose comment body
if: steps.result.outputs.found == 'true'
if: steps.pr.outputs.pr-number != ''
id: body
env:
FOUND: ${{ steps.result.outputs.found }}
COUNT: ${{ steps.result.outputs.count }}
BASELINE: ${{ steps.result.outputs.baseline }}
ALLOW_EQUAL: ${{ steps.result.outputs.allow-equal }}
CONCLUSION: ${{ github.event.workflow_run.conclusion }}
RUN_URL: ${{ github.event.workflow_run.html_url }}
run: |
DELIM="EOF_$(uuidgen)"
{
echo "body<<$DELIM"
echo "<!-- warning-ratchet -->"
blocked=false
LOGO='<img src="https://ui.decentraland.org/decentraland_256x256.png" width="30">'
BADGE_STYLE="?logo=github&style=for-the-badge"
DETAILS=""

if [ "$FOUND" != "true" ]; then
if [ "$CONCLUSION" = "success" ]; then
BADGE="https://img.shields.io/badge/Lint-Skipped-lightgrey${BADGE_STYLE}"
MSG="No C# files changed — lint ratchet skipped."
elif [ "$CONCLUSION" = "skipped" ]; then
BADGE="https://img.shields.io/badge/Lint-Skipped-lightgrey${BADGE_STYLE}"
MSG="Lint ratchet not evaluated for this run."
else
BADGE="https://img.shields.io/badge/Lint-Unavailable-ff0000${BADGE_STYLE}"
MSG="Lint did not finish (\`${CONCLUSION}\`) — the warning ratchet could not be evaluated. [See logs](${RUN_URL})."
fi
else
if [ -z "$BASELINE" ]; then
echo "**Warnings counted: $COUNT** (no baseline established yet)"
MSG="**Warnings counted: $COUNT** (no baseline established yet)"
BADGE="https://img.shields.io/badge/Lint-Passed!-3fb950${BADGE_STYLE}"
elif [ "$COUNT" -lt "$BASELINE" ]; then
echo "**Warnings count reduced: $BASELINE => $COUNT**"
MSG="**Warnings count reduced: $BASELINE => $COUNT**"
BADGE="https://img.shields.io/badge/Lint-Passed!-3fb950${BADGE_STYLE}"
elif [ "$ALLOW_EQUAL" = "true" ] && [ "$COUNT" -eq "$BASELINE" ]; then
echo "**Warnings unchanged: $BASELINE => $COUNT** — allowed on release/hotfix branches."
MSG="**Warnings unchanged: $BASELINE => $COUNT** — allowed on release/hotfix branches."
BADGE="https://img.shields.io/badge/Lint-Passed!-3fb950${BADGE_STYLE}"
else
echo "**Warnings not reduced: $BASELINE => $COUNT** — remove at least one warning to merge."
blocked=true
MSG="**Warnings not reduced: $BASELINE => $COUNT** — remove at least one warning to merge."
BADGE="https://img.shields.io/badge/Lint-Blocked!-ff0000${BADGE_STYLE}"
fi

# Always list the warnings/errors in files this PR changed, collapsed by default.
# List the warnings/errors in files this PR changed, collapsed by default.
total=$(jq -r '.pr_findings_total // 0' warning-result.json)
if [ "$total" -gt 0 ]; then
echo ""
echo "<details><summary>Warnings/errors in files changed by this PR ($total)</summary>"
echo ""
echo '```'
jq -r '.pr_findings[] | "\(.file):\(.line) \(.rule) \(.message | gsub("[\r\n]"; " "))"' warning-result.json
shown=$(jq -r '.pr_findings | length' warning-result.json)
if [ "$total" -gt "$shown" ]; then
{
echo ""
echo "…and $((total - shown)) more (see the csharp-lint-reports artifact)."
fi
echo '```'
echo ""
echo "</details>"
echo "<details><summary>Warnings/errors in files changed by this PR ($total)</summary>"
echo ""
echo '```'
jq -r '.pr_findings[] | "\(.file):\(.line) \(.rule) \(.message | gsub("[\r\n]"; " "))"' warning-result.json
shown=$(jq -r '.pr_findings | length' warning-result.json)
if [ "$total" -gt "$shown" ]; then
echo ""
echo "…and $((total - shown)) more (see the csharp-lint-reports artifact)."
fi
echo '```'
echo ""
echo "</details>"
} > details.md
DETAILS="details.md"
fi
fi

{
echo "body<<$DELIM"
echo "<!-- warning-ratchet -->"
echo "![badge] $LOGO"
echo ""
echo "$MSG"
[ -n "$DETAILS" ] && cat "$DETAILS"
echo ""
echo "[badge]: $BADGE"
echo "$DELIM"
} >> "$GITHUB_OUTPUT"

- name: Find existing comment
if: steps.result.outputs.found == 'true'
if: steps.pr.outputs.pr-number != ''
uses: peter-evans/find-comment@v2
id: find-comment
with:
Expand All @@ -116,7 +200,7 @@ jobs:
body-includes: '<!-- warning-ratchet -->'

- name: Upsert comment
if: steps.result.outputs.found == 'true'
if: steps.pr.outputs.pr-number != ''
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ steps.pr.outputs.pr-number }}
Expand Down
1 change: 0 additions & 1 deletion Explorer/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ dotnet_naming_rule.interfaces_should_be_pascal_case_with_i_prefix.symbols = inte
dotnet_naming_rule.interfaces_should_be_pascal_case_with_i_prefix.style = i_prefix_pascal_case_style
dotnet_naming_rule.interfaces_should_be_pascal_case_with_i_prefix.severity = warning


#### CAPITALS_SNAKE_CASE ####
dotnet_naming_style.capital_snake_case_style.capitalization = all_upper

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class ApplicationBlocklistGuard
{
public static async UniTask<GetBanStatusData> IsUserBlocklistedAsync(IWebRequestController webRequestController, IDecentralandUrlsSource urlsSource, string userID, ModerationDataProvider moderationDataProvider, CancellationToken ct)
{
if (FeaturesRegistry.Instance.IsEnabled(FeatureId.REPORT_USER))
if (FeaturesRegistry.Instance.IsEnabled(FeatureId.ReportUser))
{
var result = await moderationDataProvider.GetBanStatusAsync(userID, ct)
.SuppressToResultAsync(ReportCategory.STARTUP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class BlockedScreenController : ControllerBase<BlockedScreenView, Blocked
private readonly UnityAppWebBrowser webBrowser;
private readonly StringBuilder infoTextBuilder = new ();

public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.OVERLAY;
public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay;

public BlockedScreenController(ViewFactoryMethod viewFactory, UnityAppWebBrowser webBrowser) : base(viewFactory)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ namespace DCL.ApplicationGuards
{
public enum SpecCategory
{
OS,
CPU,
GPU,
VRAM,
RAM,
Os,
Cpu,
Gpu,
Vram,
Ram,
Storage,
ComputeShaders
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ private List<SpecResult> Evaluate()

// OS
string os = systemInfoProvider.OperatingSystem;
results.Add(new SpecResult(SpecCategory.OS, profile.OsCheck(os), profile.OsRequirement, os));
results.Add(new SpecResult(SpecCategory.Os, profile.OsCheck(os), profile.OsRequirement, os));

// CPU
string cpu = systemInfoProvider.ProcessorType;
results.Add(new SpecResult(SpecCategory.CPU, profile.CpuCheck(cpu), profile.CpuRequirement, cpu));
results.Add(new SpecResult(SpecCategory.Cpu, profile.CpuCheck(cpu), profile.CpuRequirement, cpu));

// GPU
string gpuName = systemInfoProvider.GraphicsDeviceName;
Expand All @@ -93,7 +93,7 @@ private List<SpecResult> Evaluate()
string actualGpuDisplayString = $"{gpuName}".Trim();

results.Add(new SpecResult(
SpecCategory.GPU,
SpecCategory.Gpu,
isGpuSpecMet,
gpuRequirementMessage,
actualGpuDisplayString
Expand All @@ -106,7 +106,7 @@ private List<SpecResult> Evaluate()

// NOTE: e.g., shows "16 GB" not "15.7 GB"
string actualVramDisplay = $"{roundedActualVramGB} GB";
results.Add(new SpecResult(SpecCategory.VRAM, isVramMet, profile.VramRequirement, actualVramDisplay));
results.Add(new SpecResult(SpecCategory.Vram, isVramMet, profile.VramRequirement, actualVramDisplay));

// RAM
int actualRamMB = systemInfoProvider.SystemMemorySize;
Expand All @@ -115,7 +115,7 @@ private List<SpecResult> Evaluate()

// NOTE: e.g., shows "16 GB" not "15.7 GB"
string actualRamDisplay = $"{roundedActualRamGB} GB";
results.Add(new SpecResult(SpecCategory.RAM, isRamMet, profile.RamRequirement, actualRamDisplay));
results.Add(new SpecResult(SpecCategory.Ram, isRamMet, profile.RamRequirement, actualRamDisplay));

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace DCL.ApplicationGuards
public class InsufficientDiskSpaceScreenController : ControllerBase<InsufficientDiskSpaceScreenView>
{

public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.OVERLAY;
public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay;

public InsufficientDiskSpaceScreenController(ViewFactoryMethod viewFactory) : base(viewFactory) { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class MinimumSpecsScreenController : ControllerBase<MinimumSpecsScreenVie
private readonly UnityAppWebBrowser webBrowser;
private readonly IAnalyticsController analytics;
private readonly IReadOnlyList<SpecResult> specResult;
public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.OVERLAY;
public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay;
public readonly UniTaskCompletionSource HoldingTask;

private MinimumSpecsTablePresenter specsTablePresenter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class LauncherRedirectionScreenController : ControllerBase<LauncherRedire
private readonly string current;
private readonly string latest;

public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.OVERLAY;
public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay;

public LauncherRedirectionScreenController(ApplicationVersionGuard versionGuard, ViewFactoryMethod viewFactory, string current, string latest) : base(viewFactory)
{
Expand Down
18 changes: 9 additions & 9 deletions Explorer/Assets/DCL/AssetsProvision/AssetSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,44 @@ namespace AssetManagement
[Flags]
public enum AssetSource
{
NONE = 0,
None = 0,

/// <summary>
/// From the resources bundled at build time
/// </summary>
EMBEDDED = 1,
Embedded = 1,

/// <summary>
/// Downloaded over network
/// </summary>
WEB = 1 << 1,
Web = 1 << 1,

/// <summary>
/// Downloaded over Addressables
/// </summary>
ADDRESSABLE = 1 << 2,
Addressable = 1 << 2,

/// <summary>
/// All sources
/// </summary>
ALL = EMBEDDED | WEB | ADDRESSABLE,
All = Embedded | Web | Addressable,
}

public static class AssetSourceEnumExtensions
{
private static readonly Dictionary<AssetSource, string> CURRENT_SOURCE_STRINGS = new ()
{
{
AssetSource.ADDRESSABLE, "ADDRESSABLE"
AssetSource.Addressable, "ADDRESSABLE"
},
{
AssetSource.EMBEDDED, "EMBEDDED"
AssetSource.Embedded, "EMBEDDED"
},
{
AssetSource.WEB, "WEB"
AssetSource.Web, "WEB"
},
{
AssetSource.NONE, "NONE"
AssetSource.None, "NONE"
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public JsCodeResolver(IWebRequestController webRequestController)
{
providers = new Dictionary<AssetSource, WebJsCodeProvider>
{
{ AssetSource.WEB, new WebJsCodeProvider(webRequestController) },
{ AssetSource.Web, new WebJsCodeProvider(webRequestController) },
};
}

public UniTask<string> GetCodeContent(URLAddress contentUrl, CancellationToken ct) =>
providers[AssetSource.WEB].GetJsCodeAsync(contentUrl, ct);
providers[AssetSource.Web].GetJsCodeAsync(contentUrl, ct);
}
}
Loading
Loading