Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update visual design and compatibility for SonarQube 10.8 / Community Build 24.12 #78

Merged
merged 6 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

* Support for the rule taxonomy mode selection in SonarQube 10.8.
* Support for INFO and BLOCKER severity impacts when using the multi-quality-rule mode.

### Changed

* Highlight.js has been updated to 11.10.0, improving rule description syntax highlighting for numeric literals
and character strings.
* The default SonarDelphi version is now [1.12.1](https://github.com/integrated-application-development/sonar-delphi/releases/tag/v1.12.1).
* Icons, styling, and the rule description user interface have been updated to mirror SonarQube 10.8.

### Fixed

Expand All @@ -20,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Unhandled exception when retrieval of rules from a remote SonarQube server fails.
* Plugin information in Help > About persisting after the plugin is disabled.
* Incorrect detection of project file (.dproj) when another .dproj file is included as a resource.
* Rule descriptions not loading from a Connected Mode SonarQube 10.8+ / Community Build 24.12+ instance.

## [1.2.0] - 2024-10-14

Expand Down
38 changes: 31 additions & 7 deletions client/BuildAdditionalResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param(
[string]$ProjectName
)

$AssetsDir = Join-Path $PSScriptRoot "assets\resources"
$ResourceFile = "${ProjectName}Additional.rc"

function Invoke-Webpack {
Expand All @@ -16,13 +17,34 @@ function Invoke-Webpack {
}
}

function Add-Resources {
function Get-Hash([string]$Text) {
$Stream = [System.IO.MemoryStream]::new([byte[]][char[]]$Text)
Get-FileHash -InputStream $Stream -Algorithm SHA256
}

function Get-AssetResources {
$RcData = @{}

Push-Location $AssetsDir
try {
Get-ChildItem . -Recurse -File | ForEach-Object {
$RelativePath = ((Resolve-Path -Relative $_.FullName) -replace "^\.\\").ToUpper()
$Key = "DL_ASSET_" + (Get-Hash $RelativePath).Hash
$RcData[$Key] = $_.FullName
}
}
finally {
Pop-Location
}

$RcData
}

function New-Rc([hashtable]$RcData) {
Write-Host "Generating additional .rc file..."
@{
"DL_HTML_SCRIPT" = "..\jslib\dist\compiled.js"
}.GetEnumerator() |
ForEach-Object { "$($_.Key) RCDATA `"$($_.Value)`"" } |
Out-File $ResourceFile -Encoding ascii
$RcData.GetEnumerator() | ForEach-Object {
"$($_.Key) RCDATA `"$($_.Value)`""
} | Out-File $ResourceFile -Encoding ascii
}

function Invoke-Brcc32 {
Expand All @@ -31,5 +53,7 @@ function Invoke-Brcc32 {
}

Invoke-Webpack
Add-Resources
New-Rc (@{
"DL_GENERATED_JS" = Join-Path $PSScriptRoot "jslib\dist\compiled.js"
} + (Get-AssetResources))
Invoke-Brcc32
Binary file removed client/assets/issueicons/impactseverity/high.png
Binary file not shown.
Binary file removed client/assets/issueicons/impactseverity/low.png
Binary file not shown.
Binary file removed client/assets/issueicons/impactseverity/medium.png
Binary file not shown.
Binary file removed client/assets/issueicons/severity/blocker.png
Binary file not shown.
Binary file removed client/assets/issueicons/severity/critical.png
Binary file not shown.
Binary file removed client/assets/issueicons/severity/info.png
Binary file not shown.
Binary file removed client/assets/issueicons/severity/major.png
Binary file not shown.
Binary file removed client/assets/issueicons/severity/minor.png
Binary file not shown.
Binary file removed client/assets/issueicons/type/bug.png
Binary file not shown.
Binary file removed client/assets/issueicons/type/code_smell.png
Binary file not shown.
Binary file removed client/assets/issueicons/type/hotspot.png
Binary file not shown.
Binary file removed client/assets/issueicons/type/vulnerability.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ body::-webkit-scrollbar {
width: 17px;
}

.tab-buttons {
user-select: none;
margin-top: 12px;
border-bottom: 1px solid;
}

.tab-btn {
display: inline-block;
padding: 6px 10px;
cursor: pointer;
user-select: initial;
font-weight: bold;
}

.tab-content {
display: none;
}

.tab-content.active {
display: block;
}

.content {
margin: 8px;
}
Expand Down Expand Up @@ -74,8 +96,9 @@ code {
}

.impacts {
font-size: 11px;
margin-bottom: 0;
font-size: 12px;
margin-bottom: 8px;
margin-top: 4px;
}

p {
Expand All @@ -85,30 +108,67 @@ p {
.impact {
display: inline-block;
margin-right: 5px;
padding: 3px 5px;
padding: 4px 6px 4px 9px;
border-radius: 12px;
border: 1px solid black;
font-weight: bold;
cursor: default;
}

.impact.standard img:first-child, .impact.hotspot img:first-child {
margin-right: 4px;
}

.impact img {
display: inline;
vertical-align: middle;
margin-top: -4px;
margin-left: 4px;
}

.impact.low {
.impact.info {
color: rgb(49, 108, 146);
background-color: rgb(233, 244, 251);
border-color: rgb(143, 202, 234);
background-color: rgb(245, 251, 255);
}

.impact.medium {
.impact.low {
color: rgb(140, 94, 30);
background-color: rgb(254, 245, 208);
border-color: rgb(250, 220, 121);
background-color: rgb(252, 245, 228);
}

.impact.medium {
color: rgb(147, 55, 13);
border-color: rgb(254, 150, 75);
background-color: rgb(255, 240, 235);
}

.impact.high {
color: rgb(180, 35, 24);
border-color: rgb(217, 45, 32);
background-color: rgb(254, 243, 242);
}

.impact.blocker {
color: rgb(128, 27, 20);
border-color: rgb(128, 27, 20);
background-color: rgb(254, 228, 226);
}

.impact.standard {
padding-left: 4px;
background-color: white;
}

.impact.hotspot {
padding-left: 4px;
padding-right: 10px;
border-color: rgb(35, 106, 151);
color: rgb(35, 106, 151);
background-color: white;
}

.code-added, .code-removed {
padding: 0 0.5em;
margin: 0 -0.5em;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Icons from SonarLint IntelliJ
Copyright (C) 2015-2023 SonarSource
Copyright (C) 2015-2024 SonarSource

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/assets/resources/sonar_icon/bug/bugHigh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/assets/resources/sonar_icon/bug/bugInfo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/assets/resources/sonar_icon/bug/bugLow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/assets/resources/sonar_icon/bug/bugMedium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/assets/resources/sonar_icon/hotspot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/assets/resources/sonar_icon/impact/high.png
Binary file added client/assets/resources/sonar_icon/impact/info.png
Binary file added client/assets/resources/sonar_icon/impact/low.png
Binary file added client/assets/resources/sonar_icon/impact/medium.png
14 changes: 14 additions & 0 deletions client/jslib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,25 @@ function generateExampleDiffs() {
}
}


function registerTabs() {
for(const tabBtn of document.querySelectorAll(".tab-btn")) {
tabBtn.addEventListener("click", e => {
document.querySelectorAll(".tab-btn.active").forEach(c => c.classList.remove("active"));
document.querySelectorAll(".tab-content.active").forEach(c => c.classList.remove("active"));

e.target.classList.add("active");
document.getElementById(e.target.dataset.contentId).classList.add("active");
});
}
}

function main() {
hljs.registerLanguage("delphi", delphi);
highlightTag("pre");
highlightTag("code");
generateExampleDiffs();
registerTabs();
}

main();
Loading
Loading