Skip to content
New issue

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

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

Already on GitHub? # to your account

[Failed] Auto refactor by Resharper CLT #892

Merged
merged 63 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
b22abed
Merge remote-tracking branch 'remotes/origin/master' into auto-refact…
kreghek Nov 14, 2020
ad77a68
Add constant naming into resharper config
kreghek Nov 14, 2020
05ba185
Add autorefactor via ReSharper CLT
kreghek Nov 14, 2020
5757865
[Bot] Automated ReSharper update
kreghek Nov 14, 2020
322dd54
Revert "Add autorefactor via ReSharper CLT"
kreghek Nov 14, 2020
035fc8c
Configure cleanup settings in DotNetSettings
kreghek Nov 14, 2020
6a52072
Use Resharper Cleanup linter
kreghek Nov 14, 2020
106c687
[Bot] Automated ReSharper update
kreghek Nov 14, 2020
2cd41af
Revert "Use Resharper Cleanup linter"
kreghek Nov 14, 2020
328af52
Use Resharper linter with custom profile
kreghek Nov 14, 2020
9134353
[Bot] Automated ReSharper update
kreghek Nov 14, 2020
e100fd7
Configure R# CleanUp via DotSettings
kreghek Nov 14, 2020
ff4c60f
[Bot] Automated dotnet-format update
kreghek Nov 14, 2020
6230b4a
Configure R# Code Cleanup - XML Doc
kreghek Nov 14, 2020
4585d7a
[Bot] Automated ReSharper update
kreghek Nov 14, 2020
3664524
Configure R# Code Cleanup
kreghek Nov 14, 2020
94b1666
[Bot] Automated dotnet-format update
kreghek Nov 14, 2020
dec8295
Configure R3 Code Cleanup
kreghek Nov 14, 2020
1a79e9b
[Bot] Automated ReSharper update
kreghek Nov 14, 2020
a1da99a
Configure R# - do not remove argument names
kreghek Nov 14, 2020
1286ba3
[Bot] Automated dotnet-format update
kreghek Nov 14, 2020
313af42
Config R# - try to sort members
kreghek Nov 14, 2020
c70ac1d
[Bot] Automated ReSharper update
kreghek Nov 14, 2020
aba68ea
Revert "Config R# - try to sort members"
kreghek Nov 14, 2020
1083311
[Bot] Automated ReSharper update
kreghek Nov 14, 2020
7e14c55
Fix Codacy issue
kreghek Nov 14, 2020
b140303
[Bot] Automated dotnet-format update
kreghek Nov 14, 2020
dd05edb
Auto sort members
kreghek Nov 15, 2020
ce2dc7a
Restore dotnet format linter via matrix
kreghek Nov 15, 2020
1a74c23
[Bot] Automated ReSharper CLT update
kreghek Nov 15, 2020
eb4ff99
[Bot] Automated dotnet-format update
kreghek Nov 15, 2020
e737694
[Bot] Automated ReSharper CLT update
kreghek Nov 15, 2020
4eede70
Fix Sonar Issues
kreghek Nov 15, 2020
feed875
[Bot] Automated dotnet-format update
kreghek Nov 15, 2020
2da493e
[Bot] Automated ReSharper CLT update
kreghek Nov 15, 2020
2b3dd0a
Solve conflict between dotnet-format and R# + Sort method and props a…
kreghek Nov 15, 2020
f896119
[Bot] Automated dotnet-format update
kreghek Nov 15, 2020
5eab571
[Bot] Automated ReSharper CLT update
kreghek Nov 15, 2020
88fff73
Revert "[Bot] Automated ReSharper CLT update" but File Layout saved
kreghek Nov 16, 2020
ddf17d3
[Bot] Automated dotnet-format update
kreghek Nov 16, 2020
a8e6632
[Bot] Automated ReSharper CLT update
kreghek Nov 16, 2020
9e988ce
Fix Codacy issues
kreghek Nov 16, 2020
817f431
[Bot] Automated dotnet-format update
kreghek Nov 16, 2020
8c907f8
[Bot] Automated ReSharper CLT update
kreghek Nov 16, 2020
7589633
Configure object initializer to prevent formatter war
kreghek Nov 16, 2020
3c3af31
[Bot] Automated dotnet-format update
kreghek Nov 16, 2020
da6215c
[Bot] Automated ReSharper CLT update
kreghek Nov 16, 2020
db5c3f5
Fix Codacy issues - remove direct Console logging
kreghek Nov 16, 2020
bd374c6
[Bot] Automated dotnet-format update
kreghek Nov 16, 2020
0cdd166
[Bot] Automated ReSharper CLT update
kreghek Nov 16, 2020
d391ef2
Set BotMassLaucher workload class as iternal
kreghek Nov 16, 2020
48b4469
Stop dotnet-format and R# war in case blocks
kreghek Nov 16, 2020
280ed20
[Bot] Automated dotnet-format update
kreghek Nov 16, 2020
7454ae3
[Bot] Automated ReSharper CLT update
kreghek Nov 16, 2020
30548fc
Fix Codacy Issues - static vars in non static methods
kreghek Nov 16, 2020
ac81780
[Bot] Automated dotnet-format update
kreghek Nov 16, 2020
4399bb0
[Bot] Automated ReSharper CLT update
kreghek Nov 16, 2020
6109b5a
Fix Codacy Issues
kreghek Nov 16, 2020
8ebf468
[Bot] Automated dotnet-format update
kreghek Nov 16, 2020
d3e53b7
[Bot] Automated ReSharper CLT update
kreghek Nov 16, 2020
def1e11
Revent branch
kreghek Nov 17, 2020
e13a271
Revert branch
kreghek Nov 17, 2020
db2da76
Revent branch 3
kreghek Nov 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
70 changes: 59 additions & 11 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,78 @@ on: push
jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
lint:
client-lint:
# Name the Job
name: Lint C# code base
name: Lint client code base
# Set the type of machine to run on
runs-on: ubuntu-latest
env:
working-directory : ./
strategy:
matrix:
codebasePath:
- Zilon.Client/Assets/Zilon/Scripts
- Zilon.Core/
fail-fast: false
working-directory : ./Zilon.Client/

steps:
- uses: actions/checkout@v2
- run: git pull
- run: dotnet tool install -g dotnet-format
- name: format
run: dotnet-format -f Assets/Zilon/Scripts -v d
working-directory: ${{env.working-directory}}
- name: Commit changes
uses: EndBug/add-and-commit@v5
with:
message: "[Bot] Automated dotnet-format update"
add: "*.cs"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Set the job key. The key is displayed as the job name
# when a job name is not provided
core-lint:
# Name the Job
name: Lint core code base
# Set the type of machine to run on
runs-on: ubuntu-latest
env:
working-directory : ./Zilon.Core/

steps:
- uses: actions/checkout@v2
- run: git pull
- run: dotnet tool install -g dotnet-format
- name: format codebase ${{ matrix.codebasePath }}
run: dotnet-format -f ${{ matrix.codebasePath }} -v d
- name: format
run: dotnet-format Zilon.Core.sln -v d
working-directory: ${{env.working-directory}}
- name: Commit changes
uses: EndBug/add-and-commit@v5
with:
message: "[Bot] Automated dotnet-format update"
add: "*.cs"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Set the job key. The key is displayed as the job name
# when a job name is not provided
resharper-core-lint:
# Name the Job
name: Lint core code base
# Set the type of machine to run on
runs-on: ubuntu-latest
env:
working-directory : ./Zilon.Core/

steps:
- uses: actions/checkout@v2
- run: git pull
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Setup ReSharper Command Line Tools
run: dotnet tool install -g JetBrains.ReSharper.GlobalTools
- name: Clean up code
run: jb cleanupcode --profile="Full Cleanup" Zilon.Core.sln
working-directory: ${{env.working-directory}}
- name: Commit changes
uses: EndBug/add-and-commit@v5
with:
message: "[Bot] Automated ReSharper update"
add: "*.cs"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

namespace Zilon.Bot.Players.DevelopmentTests
{
class AutoplayEngine : AutoplayEngineBase
internal class AutoplayEngine : AutoplayEngineBase
{
private readonly Startup _startup;

public AutoplayEngine(Startup startup, BotSettings botSettings, IGlobeInitializer globeInitializer) : base(botSettings, globeInitializer)
public AutoplayEngine(Startup startup, BotSettings botSettings, IGlobeInitializer globeInitializer) : base(
botSettings, globeInitializer)
{
_startup = startup;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using NUnit.Framework;

using Zilon.Bot.Sdk;
using Zilon.Core.Localization;
using Zilon.Core.PersonModules;
using Zilon.Core.Persons;
using Zilon.Core.Players;
Expand All @@ -32,7 +33,10 @@ public async Task GetActorTasksTestAsync(string mode)
startUp.RegisterServices(serviceContainer);
var serviceProvider = serviceContainer.BuildServiceProvider();

var botSettings = new BotSettings { Mode = mode };
var botSettings = new BotSettings
{
Mode = mode
};

var globeInitializer = serviceProvider.GetRequiredService<IGlobeInitializer>();
var player = serviceProvider.GetRequiredService<IPlayer>();
Expand All @@ -55,7 +59,8 @@ public async Task GetActorTasksTestAsync(string mode)
private static void PrintPersonBacklog(IPerson humanPerson)
{
Console.WriteLine("Build In Traits:");
var buildinTraits = humanPerson.GetModule<IEvolutionModule>().Perks.Where(x => x.Scheme.IsBuildIn).ToArray();
var buildinTraits = humanPerson.GetModule<IEvolutionModule>().Perks.Where(x => x.Scheme.IsBuildIn)
.ToArray();
foreach (var buildInTrait in buildinTraits)
{
Console.WriteLine(buildInTrait.Scheme.Name.En);
Expand Down Expand Up @@ -117,7 +122,7 @@ private static void PrintResult(ServiceProvider serviceProvider)
{
var deathReason = deathReasonService.GetDeathReasonSummary(
lastEvent,
Core.Localization.Language.En);
Language.En);

Console.WriteLine($"Death Reason: {deathReason}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters", Justification = "<Pending>", Scope = "member", Target = "~M:Zilon.Bot.Players.DevelopmentTests.BotActorTaskSourceTests.PrintPersonBacklog(Zilon.Core.Persons.IPerson)")]
[assembly:
SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters", Justification = "<Pending>",
Scope = "member",
Target =
"~M:Zilon.Bot.Players.DevelopmentTests.BotActorTaskSourceTests.PrintPersonBacklog(Zilon.Core.Persons.IPerson)")]
4 changes: 2 additions & 2 deletions Zilon.Core/Zilon.Bot.Players.DevelopmentTests/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace Zilon.Bot.Players.DevelopmentTests
{
class Startup : InitializationBase
internal class Startup : InitializationBase
{
public override void ConfigureAux(IServiceProvider serviceProvider)
{
Expand All @@ -27,7 +27,7 @@ protected override void RegisterBot(IServiceCollection container)

container.AddSingleton<HumanBotActorTaskSource<ISectorTaskSourceContext>>();
container.AddSingleton<IActorTaskSource<ISectorTaskSourceContext>>(serviceProvider =>
serviceProvider.GetRequiredService<HumanBotActorTaskSource<ISectorTaskSourceContext>>());
serviceProvider.GetRequiredService<HumanBotActorTaskSource<ISectorTaskSourceContext>>());

container.AddSingleton<IPlayer, HumanPlayer>();
container.AddSingleton<IScoreManager, ScoreManager>();
Expand Down
143 changes: 75 additions & 68 deletions Zilon.Core/Zilon.Bot.Players.Tests/Logics/SelectActHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

using NUnit.Framework;

using Zilon.Core.Common;
using Zilon.Core.Components;
using Zilon.Core.Persons;
using Zilon.Core.Props;
using Zilon.Core.Schemes;
using Zilon.Core.Tests.Common.Schemes;

namespace Zilon.Bot.Players.Logics.Tests
Expand All @@ -21,46 +24,48 @@ public void SelectBestAct_HasResourceRequireActAndHasNoResource_SelectsDefault()
{
// ARRANGE

var acts = new ITacticalAct[] {
new TacticalAct(new TestTacticalActScheme{
Sid = "default",
Stats = new TestTacticalActStatsSubScheme{
Effect = Core.Schemes.TacticalActEffectType.Damage,
Efficient = new Core.Common.Roll(3,1),
Offence = new TestTacticalActOffenceSubScheme
var acts = new ITacticalAct[]
{
new TacticalAct(
new TestTacticalActScheme
{
Sid = "default",
Stats = new TestTacticalActStatsSubScheme
{
ApRank = 1,
Impact = Core.Common.ImpactType.Kinetic,
Type = Core.Components.OffenseType.Tactical
Effect = TacticalActEffectType.Damage,
Efficient = new Roll(3, 1),
Offence = new TestTacticalActOffenceSubScheme
{
ApRank = 1, Impact = ImpactType.Kinetic, Type = OffenseType.Tactical
}
}
}
},
new Core.Common.Roll(3,1),
new Core.Common.Roll(3,3),
equipment: null
},
new Roll(3, 1),
new Roll(3, 3),
null
),
new TacticalAct(new TestTacticalActScheme{
Sid = "resource-required",
Stats = new TestTacticalActStatsSubScheme{
Effect = Core.Schemes.TacticalActEffectType.Damage,
Efficient = new Core.Common.Roll(3,3),
Offence = new TestTacticalActOffenceSubScheme
new TacticalAct(
new TestTacticalActScheme
{
Sid = "resource-required",
Stats = new TestTacticalActStatsSubScheme
{
ApRank = 1,
Impact = Core.Common.ImpactType.Kinetic,
Type = Core.Components.OffenseType.Tactical
Effect = TacticalActEffectType.Damage,
Efficient = new Roll(3, 3),
Offence = new TestTacticalActOffenceSubScheme
{
ApRank = 1, Impact = ImpactType.Kinetic, Type = OffenseType.Tactical
}
},
Constrains = new TestTacticalActConstrainsSubScheme
{
PropResourceType = "resource", PropResourceCount = 1
}
},
Constrains = new TestTacticalActConstrainsSubScheme
{
PropResourceType = "resource",
PropResourceCount = 1
}
},
new Core.Common.Roll(3,1),
new Core.Common.Roll(3,3),
equipment: null
),
new Roll(3, 1),
new Roll(3, 3),
null
)
};

var inventoryMock = new Mock<IPropStore>();
Expand All @@ -79,46 +84,48 @@ public void SelectBestAct_HasResourceRequireActAndHasNoInventory_SelectsDefault(
{
// ARRANGE

var acts = new ITacticalAct[] {
new TacticalAct(new TestTacticalActScheme{
Sid = "default",
Stats = new TestTacticalActStatsSubScheme{
Effect = Core.Schemes.TacticalActEffectType.Damage,
Efficient = new Core.Common.Roll(3,1),
Offence = new TestTacticalActOffenceSubScheme
var acts = new ITacticalAct[]
{
new TacticalAct(
new TestTacticalActScheme
{
Sid = "default",
Stats = new TestTacticalActStatsSubScheme
{
ApRank = 1,
Impact = Core.Common.ImpactType.Kinetic,
Type = Core.Components.OffenseType.Tactical
Effect = TacticalActEffectType.Damage,
Efficient = new Roll(3, 1),
Offence = new TestTacticalActOffenceSubScheme
{
ApRank = 1, Impact = ImpactType.Kinetic, Type = OffenseType.Tactical
}
}
}
},
new Core.Common.Roll(3,1),
new Core.Common.Roll(3,3),
null
},
new Roll(3, 1),
new Roll(3, 3),
null
),
new TacticalAct(new TestTacticalActScheme{
Sid = "resource-required",
Stats = new TestTacticalActStatsSubScheme{
Effect = Core.Schemes.TacticalActEffectType.Damage,
Efficient = new Core.Common.Roll(3,3),
Offence = new TestTacticalActOffenceSubScheme
new TacticalAct(
new TestTacticalActScheme
{
Sid = "resource-required",
Stats = new TestTacticalActStatsSubScheme
{
ApRank = 1,
Impact = Core.Common.ImpactType.Kinetic,
Type = Core.Components.OffenseType.Tactical
Effect = TacticalActEffectType.Damage,
Efficient = new Roll(3, 3),
Offence = new TestTacticalActOffenceSubScheme
{
ApRank = 1, Impact = ImpactType.Kinetic, Type = OffenseType.Tactical
}
},
Constrains = new TestTacticalActConstrainsSubScheme
{
PropResourceType = "resource", PropResourceCount = 1
}
},
Constrains = new TestTacticalActConstrainsSubScheme
{
PropResourceType = "resource",
PropResourceCount = 1
}
},
new Core.Common.Roll(3,1),
new Core.Common.Roll(3,3),
null
),
new Roll(3, 1),
new Roll(3, 3),
null
)
};

// ACT
Expand Down
Loading