Skip to content
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
16 changes: 9 additions & 7 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- name: 🔍 Qodana Scan
id: qodana
uses: JetBrains/qodana-action@4861e015da555e86a72b862892aba6c2b93e6891
continue-on-error: true
Comment on lines 28 to +31

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Qodana step id added but never referenced

The id: qodana was added at .github/workflows/code-quality.yml:29 alongside continue-on-error: true, but no subsequent step references steps.qodana.outcome/conclusion. With continue-on-error: true, the Qodana job will now report success even when the scan finds issues above --fail-threshold,0, so the quality-summary table (needs.qodana.result) will show success rather than failure. This aligns with the stated intent to prevent baseline/threshold failures from blocking the pipeline, but the added step id is currently unused.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
with:
Expand Down Expand Up @@ -88,21 +90,21 @@ jobs:

- name: 🔍 Prepare analysis on SonarQube
env:
SONAR_TOKEN: ${{ secrets.SONNAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN || secrets.SONAR_TOKEN }}
run: |
echo "🔍 Checking SonarQube configuration..."
if [ -z "$SONAR_TOKEN" ]; then
echo "❌ SONNAR_TOKEN is not set or empty"
echo "❌ SONAR_TOKEN is not set or empty"
echo "⚠️ Skipping SonarQube analysis"
exit 0
fi

echo "✅ SONNAR_TOKEN is configured"
echo "✅ SONAR_TOKEN is configured"
dotnet sonarscanner begin \
/o:"afonsoft" \
/k:"afonsoft_QRCoder.Core" \
/d:sonar.host.url="https://sonarcloud.io" \
/d:sonar.login="$SONAR_TOKEN" \
/d:sonar.token="$SONAR_TOKEN" \
/d:sonar.scm.provider=git \
/d:sonar.coverage.exclusions="**Test*.cs"

Expand All @@ -111,15 +113,15 @@ jobs:

- name: 🔍 Run Code Analysis
env:
SONAR_TOKEN: ${{ secrets.SONNAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN || secrets.SONAR_TOKEN }}
run: |
echo "🔍 Finalizing SonarQube analysis..."
if [ -z "$SONAR_TOKEN" ]; then
echo "⚠️ SONNAR_TOKEN not configured, skipping analysis"
echo "⚠️ SONAR_TOKEN not configured, skipping analysis"
exit 0
fi

dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN"
dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"

# Snyk Security Analysis
snyk:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/delete-branch-on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 🗑️ Delete Branch on Merge

on:
pull_request:
types: [closed]
branches: [main]

jobs:
delete-merged-branch:
name: 🗑️ Delete merged branch
runs-on: ubuntu-latest
if: |
github.event.pull_request.merged == true &&
github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write

steps:
- name: 📥 Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7

- name: 🗑️ Delete merged branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"

Check failure on line 26 in .github/workflows/delete-branch-on-merge.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

The expression github.event.pull_request.head.ref can be set by an external actor to a specially crafted value, enabling script injection. Change this workflow to not use user-controlled data directly in a run block, for example by assigning this expression to an environment variable.

See more on https://sonarcloud.io/project/issues?id=afonsoft_QRCoder.Core&issues=AZ93_kirCc1P49Fnxw1C&open=AZ93_kirCc1P49Fnxw1C&pullRequest=93

# Protect default and release branches
case "$BRANCH_NAME" in
main|develop|master|releases/*)
echo "⚠️ Protected branch '$BRANCH_NAME' will not be deleted."
exit 0
;;
esac

echo "🗑️ Deleting merged branch: $BRANCH_NAME"
gh api "repos/${{ github.repository }}/git/refs/heads/${BRANCH_NAME}" --method DELETE \
|| echo "⚠️ Could not delete branch '$BRANCH_NAME' (already removed or from a fork)."
echo "✅ Branch '$BRANCH_NAME' cleanup completed."
26 changes: 15 additions & 11 deletions .github/workflows/security-scan.yml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: SonarQube result not reflected in security-summary despite skipped detection attempt

The security-summary job only depends on needs: [codeql, snyk] (.github/workflows/security-scan.yml:155), so needs.*.result at .github/workflows/security-scan.yml:167 can never include the SonarQube job's result. The SonarQube column will therefore always render as N/A (never skipped), regardless of whether the SonarQube job ran or was skipped. This is pre-existing and unchanged by this PR, but the token changes in the same job make it worth confirming the summary reporting is as intended.

(Refers to line 167)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Original file line number Diff line number Diff line change
Expand Up @@ -114,41 +114,45 @@ jobs:
run: chmod 777 sonar/ -R || true

- name: 🔍 Prepare analysis on SonarQube
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN || secrets.SONAR_TOKEN }}
run: |
echo "🔍 Checking SonarQube configuration..."
if [ -z "${{ secrets.SONNAR_TOKEN }}" ]; then
echo "❌ SONNAR_TOKEN is not set or empty"
if [ -z "$SONAR_TOKEN" ]; then
echo "❌ SONAR_TOKEN is not set or empty"
echo "⚠️ Skipping SonarQube analysis"
exit 0
fi

echo "✅ SONNAR_TOKEN is configured"
echo "✅ SONAR_TOKEN is configured"
dotnet sonarscanner begin \
/o:"afonsoft" \
/k:"afonsoft_QRCoder.Core" \
/d:sonar.host.url="https://sonarcloud.io" \
/d:sonar.login="${{ secrets.SONNAR_TOKEN }}" \
/d:sonar.token="$SONAR_TOKEN" \
/d:sonar.scm.provider=git \
/d:sonar.coverage.exclusions="**Test*.cs"

- name: 🏗️ Build
run: dotnet build QRCoder.Core.sln --configuration release

- name: 🔍 Run Code Analysis
env:
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN || secrets.SONAR_TOKEN }}
run: |
echo "🔍 Finalizing SonarQube analysis..."
if [ -z "${{ secrets.SONNAR_TOKEN }}" ]; then
echo "⚠️ SONNAR_TOKEN not configured, skipping analysis"
if [ -z "$SONAR_TOKEN" ]; then
echo "⚠️ SONAR_TOKEN not configured, skipping analysis"
exit 0
fi

dotnet sonarscanner end /d:sonar.login="${{ secrets.SONNAR_TOKEN }}"
dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"

# Security Summary
security-summary:
name: 📋 Security Summary
runs-on: ubuntu-latest
needs: [codeql, snyk]
needs: [codeql, snyk, sonarqube]
if: always()

steps:
Expand All @@ -160,17 +164,17 @@ jobs:
echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| 🔍 CodeQL | ${{ needs.codeql.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| 🛡️ Snyk | ${{ needs.snyk.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| 📊 SonarQube | ${{ contains(needs.*.result, 'skipped') && 'skipped' || 'N/A' }} |" >> $GITHUB_STEP_SUMMARY
echo "| 📊 SonarQube | ${{ needs.sonarqube.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [[ "${{ needs.codeql.result }}" == "failure" || "${{ needs.snyk.result }}" == "failure" ]]; then
if [[ "${{ needs.codeql.result }}" == "failure" || "${{ needs.snyk.result }}" == "failure" || "${{ needs.sonarqube.result }}" == "failure" ]]; then
echo "❌ **Security issues detected! Please review the scan results.**" >> $GITHUB_STEP_SUMMARY
else
echo "✅ **All security scans passed successfully!**" >> $GITHUB_STEP_SUMMARY
fi

- name: 🚨 Security Alert
if: needs.codeql.result == 'failure' || needs.snyk.result == 'failure'
if: needs.codeql.result == 'failure' || needs.snyk.result == 'failure' || needs.sonarqube.result == 'failure'
run: |
echo "🚨 SECURITY ISSUES DETECTED!"
echo "Please review the security scan results immediately."
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# QRCoder.Core - QR Code Generator Library

[![Build status](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml)
[![License](https://img.shields.io/github/license/afonsoft/QRCoder.Core)](https://github.com/afonsoft/QRCoder.Core/blob/main/LICENSE.txt)
[![Build](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml)
[![Code Quality](https://github.com/afonsoft/QRCoder.Core/actions/workflows/code-quality.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/code-quality.yml)
[![Security Scan](https://github.com/afonsoft/QRCoder.Core/actions/workflows/security-scan.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/security-scan.yml)
[![codecov](https://codecov.io/gh/afonsoft/QRCoder.Core/graph/badge.svg?token=N8RED1A0D7)](https://codecov.io/gh/afonsoft/QRCoder.Core)
[![NuGet Badge](https://img.shields.io/nuget/v/QRCoder.Core.svg)](https://www.nuget.org/packages/QRCoder.Core/)
[![Code Quality](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=alert_status)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![NuGet](https://img.shields.io/nuget/v/QRCoder.Core.svg)](https://www.nuget.org/packages/QRCoder.Core/)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=alert_status)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=security_rating)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=coverage)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![GitHub issues](https://img.shields.io/github/issues/afonsoft/QRCoder.Core)](https://github.com/afonsoft/QRCoder.Core/issues)
![GitHub top language](https://img.shields.io/github/languages/top/afonsoft/QRCoder.Core)

> **[Leia em Portugues (pt-BR)](README.pt-br.md)**

Expand Down Expand Up @@ -337,7 +343,7 @@ reportgenerator \

## Star History

[![Star History Chart](https://api.star-history.com/chart?repos=afonsoft/QRCoder.Core&type=date&legend=top-left&sealed_token=a1KQPztifboHTq3RlLRkwvvPGw3dtFbndqZQpJxDeVkKCiIiJQyi1kuTEocyVlxTQ_wR7U0f6lQ1gBk00x7MNA3wOhureCKWKGRw0nT27SQSXMsSECsH8w)](https://www.star-history.com/?repos=afonsoft%2FQRCoder.Core&type=date&legend=top-left)
[![Star History Chart](https://api.star-history.com/svg?repos=afonsoft/qrcoder.core&type=Date)](https://star-history.com/#afonsoft/qrcoder.core&Date)

## StarMapper

Expand Down
14 changes: 10 additions & 4 deletions README.pt-br.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# QRCoder.Core - Biblioteca Geradora de QR Code

[![Build status](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml)
[![Licenca](https://img.shields.io/github/license/afonsoft/QRCoder.Core)](https://github.com/afonsoft/QRCoder.Core/blob/main/LICENSE.txt)
[![Build](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml)
[![Code Quality](https://github.com/afonsoft/QRCoder.Core/actions/workflows/code-quality.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/code-quality.yml)
[![Security Scan](https://github.com/afonsoft/QRCoder.Core/actions/workflows/security-scan.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/security-scan.yml)
[![codecov](https://codecov.io/gh/afonsoft/QRCoder.Core/graph/badge.svg?token=N8RED1A0D7)](https://codecov.io/gh/afonsoft/QRCoder.Core)
[![NuGet Badge](https://img.shields.io/nuget/v/QRCoder.Core.svg)](https://www.nuget.org/packages/QRCoder.Core/)
[![Code Quality](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=alert_status)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![NuGet](https://img.shields.io/nuget/v/QRCoder.Core.svg)](https://www.nuget.org/packages/QRCoder.Core/)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=alert_status)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=security_rating)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![Cobertura](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=coverage)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![GitHub issues](https://img.shields.io/github/issues/afonsoft/QRCoder.Core)](https://github.com/afonsoft/QRCoder.Core/issues)
![GitHub top language](https://img.shields.io/github/languages/top/afonsoft/QRCoder.Core)

> **[Read in English (en-US)](README.md)**

Expand Down Expand Up @@ -361,7 +367,7 @@ reportgenerator \

## Historico de Estrelas

[![Star History Chart](https://api.star-history.com/chart?repos=afonsoft/QRCoder.Core&type=date&legend=top-left&sealed_token=a1KQPztifboHTq3RlLRkwvvPGw3dtFbndqZQpJxDeVkKCiIiJQyi1kuTEocyVlxTQ_wR7U0f6lQ1gBk00x7MNA3wOhureCKWKGRw0nT27SQSXMsSECsH8w)](https://www.star-history.com/?repos=afonsoft%2FQRCoder.Core&type=date&legend=top-left)
[![Star History Chart](https://api.star-history.com/svg?repos=afonsoft/qrcoder.core&type=Date)](https://star-history.com/#afonsoft/qrcoder.core&Date)

## StarMapper

Expand Down
12 changes: 9 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@

# QRCoder.Core - QR Code Generator Library

[![Build status](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml)
[![License](https://img.shields.io/github/license/afonsoft/QRCoder.Core)](https://github.com/afonsoft/QRCoder.Core/blob/main/LICENSE.txt)
[![Build](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/ci-build-test.yml)
[![Code Quality](https://github.com/afonsoft/QRCoder.Core/actions/workflows/code-quality.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/code-quality.yml)
[![Security Scan](https://github.com/afonsoft/QRCoder.Core/actions/workflows/security-scan.yml/badge.svg?branch=main)](https://github.com/afonsoft/QRCoder.Core/actions/workflows/security-scan.yml)
[![codecov](https://codecov.io/gh/afonsoft/QRCoder.Core/graph/badge.svg?token=N8RED1A0D7)](https://codecov.io/gh/afonsoft/QRCoder.Core)
[![NuGet Badge](https://img.shields.io/nuget/v/QRCoder.Core.svg)](https://www.nuget.org/packages/QRCoder.Core/)
[![Code Quality](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=alert_status)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![NuGet](https://img.shields.io/nuget/v/QRCoder.Core.svg)](https://www.nuget.org/packages/QRCoder.Core/)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=alert_status)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=security_rating)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=afonsoft_QRCoder.Core&metric=coverage)](https://sonarcloud.io/project/overview?id=afonsoft_QRCoder.Core)
[![GitHub issues](https://img.shields.io/github/issues/afonsoft/QRCoder.Core)](https://github.com/afonsoft/QRCoder.Core/issues)
![GitHub top language](https://img.shields.io/github/languages/top/afonsoft/QRCoder.Core)

## Project Description / Descrição do Projeto

Expand Down
Loading