Skip to content

Commit

Permalink
feat: uncommented sonar cloud (#147)
Browse files Browse the repository at this point in the history
* feat: uncommented sonar cloud

* Removed code smells

---------

Co-authored-by: Tom Whittington <[email protected]>
  • Loading branch information
ThomasWhittington and Tom Whittington authored Aug 23, 2024
1 parent cd816e3 commit 168db3d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
47 changes: 23 additions & 24 deletions .github/workflows/code-pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ jobs:
distribution: "microsoft"
java-version: "17"

# - name: Start SonarCloud scanner
# run: |
# dotnet-sonarscanner begin \
# /k:"DFE-Digital_sts-content-support" \
# /o:"dfe-digital" \
# /d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
# /d:sonar.host.url="https://sonarcloud.io" \
# /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml \
# /d:sonar.coverage.exclusions=**/Program.cs,**/wwwroot/** \
# /d:sonar.issue.ignore.multicriteria=e1 \
# /d:sonar.issue.ignore.multicriteria.e1.ruleKey=csharpsquid:S6602 \
# /d:sonar.issue.ignore.multicriteria.e1.resourceKey=src/**/*.cs
- name: Start SonarCloud scanner
run: |
dotnet-sonarscanner begin \
/k:"DFE-Digital_sts-content-support" \
/o:"dfe-digital" \
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" \
/d:sonar.host.url="https://sonarcloud.io" \
/d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml \
/d:sonar.coverage.exclusions=**/Program.cs,**/wwwroot/** \
/d:sonar.issue.ignore.multicriteria=e1 \
/d:sonar.issue.ignore.multicriteria.e1.ruleKey=csharpsquid:S6602 \
/d:sonar.issue.ignore.multicriteria.e1.resourceKey=src/**/*.cs
- name: Build web app
uses: ./.github/actions/build-dotnet-app
Expand All @@ -71,15 +71,14 @@ jobs:
with:
solution_filename: sts-contentsupport.sln

# - name: Merge test results
# run: dotnet-coverage merge -f xml -o "coverage.xml" -s "coverage.settings.xml" -r coverage.cobertura.xml
#
# - name: End SonarCloud Scanner
# run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
#
# - name: Archive code coverage results
# uses: actions/upload-artifact@v4
# with:
# name: code-coverage-report
# path: coverage.xml
#
- name: Merge test results
run: dotnet-coverage merge -f xml -o "coverage.xml" -s "coverage.settings.xml" -r coverage.cobertura.xml

- name: End SonarCloud Scanner
run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: coverage.xml
6 changes: 3 additions & 3 deletions src/Dfe.ContentSupport.Web/Services/ModelMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public CsPage MapToCsPage(ContentSupportPage incoming)
return result;
}

private List<string> FlattenMetadata(ContentfulMetadata item)
private static List<string> FlattenMetadata(ContentfulMetadata item)
{
if (item is null) return new();
if (item is null) return [];

return item.Tags.Select(_ => _.Sys.Id).ToList();
return item.Tags.Select(o => o.Sys.Id).ToList();
}

private List<CsContentItem> MapEntriesToContent(List<Entry> entries)
Expand Down

0 comments on commit 168db3d

Please sign in to comment.