Skip to content

Commit

Permalink
Added Qodana to CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
Somfic committed Aug 10, 2023
1 parent c5b1d2c commit da65114
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 5 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- dev
- main

jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
4 changes: 2 additions & 2 deletions EliteAPI.Tests/Conventions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void Properties(PropertyInfo property)
static IImmutableList<PropertyInfo> GetProperties()

Check notice on line 81 in EliteAPI.Tests/Conventions.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Use explicit or implicit modifier definition for type members

Inconsistent modifiers style: missing 'private' modifier
{
var eventParser = new EventParser(Mock.Of<IServiceProvider>());
eventParser.Use<LocalisedConverter>();;
eventParser.Use<LocalisedConverter>();
var events = new Events.Events(Mock.Of<ILogger<Events.Events>>(), eventParser);
events.Register();

Expand All @@ -102,7 +102,7 @@ static IImmutableList<Type> GetTypes()
{
var eventParser = new EventParser(Mock.Of<IServiceProvider>());
eventParser.Use<LocalisedConverter>();
;

var events = new Events.Events(Mock.Of<ILogger<Events.Events>>(), eventParser);
events.Register();

Expand Down
2 changes: 1 addition & 1 deletion EliteAPI.Tests/JournalManual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class JournalManual
public void Setup()
{
var eventParser = new EventParser(Mock.Of<IServiceProvider>());
eventParser.Use<LocalisedConverter>();;
eventParser.Use<LocalisedConverter>();
_events = new Events.Events(Mock.Of<ILogger<Events.Events>>(), eventParser);
_events.Register();
}
Expand Down
16 changes: 14 additions & 2 deletions Examples/Example.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,20 @@
.GetRequiredService<SpanshApi>();

Console.WriteLine("Getting route ... ");
var response = await spansh.Routes.Neutron(new NeutronRequest("Sol", "Colonia"));
var response = await spansh.Routes.Trade(new TradeRequest("Shinrarta Dezhra", "Jameson Memorial", 50, 720));

response.On(
ok: r => Console.WriteLine(string.Join(" > ", r.SystemJumps.Select(x => x.System))),
ok: route =>
{
foreach (var stop in route)
{
Console.WriteLine(stop.System.Name + " - " + stop.System.Station);
foreach (var commodity in stop.Commodities)
{
Console.WriteLine($" - {commodity.Name} {commodity.Amount}x (+{commodity.TotalProfit:N0}cr)");
}
Console.WriteLine();
}
},
error: e => Console.WriteLine(e.Message));
29 changes: 29 additions & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"

#Specify inspection profile for code analysis
profile:
name: qodana.starter

#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>

#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>

#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh

#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)

#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-dotnet:latest

0 comments on commit da65114

Please sign in to comment.