Skip to content

Commit

Permalink
Separate src and test project. Fix a few warnings. (#171)
Browse files Browse the repository at this point in the history
* Separate src and test project. Fix a few warnings.
* Turn off doc gen for test project
* Add SA0001 to NoWarn
* Use PascalCase for a few named placeholders
  • Loading branch information
SandGrainOne authored Aug 19, 2024
1 parent 8b56eec commit a683dcd
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 105 deletions.
19 changes: 14 additions & 5 deletions Altinn.Profile.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution items", "Solution
README.md = README.md
EndProjectSection
EndProject

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0CCDE9AB-15C9-4B1C-97A8-21F49262BDE3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{00F4FF62-D447-4DE4-902D-CB1FB98FBECF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -28,10 +31,6 @@ Global
{D32C4EE9-E827-467A-B116-8EF0BA08A11F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D32C4EE9-E827-467A-B116-8EF0BA08A11F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D32C4EE9-E827-467A-B116-8EF0BA08A11F}.Release|Any CPU.Build.0 = Release|Any CPU
{85BF7FD9-90C1-4A4E-BDCC-F89F0BA65218}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85BF7FD9-90C1-4A4E-BDCC-F89F0BA65218}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85BF7FD9-90C1-4A4E-BDCC-F89F0BA65218}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85BF7FD9-90C1-4A4E-BDCC-F89F0BA65218}.Release|Any CPU.Build.0 = Release|Any CPU
{46B6764A-0DCF-47E6-86B8-09A1CFC3CF80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46B6764A-0DCF-47E6-86B8-09A1CFC3CF80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46B6764A-0DCF-47E6-86B8-09A1CFC3CF80}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -40,10 +39,20 @@ Global
{8DF9A6F4-AF02-4B36-B199-78883FC51631}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8DF9A6F4-AF02-4B36-B199-78883FC51631}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8DF9A6F4-AF02-4B36-B199-78883FC51631}.Release|Any CPU.Build.0 = Release|Any CPU
{85BF7FD9-90C1-4A4E-BDCC-F89F0BA65218}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85BF7FD9-90C1-4A4E-BDCC-F89F0BA65218}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85BF7FD9-90C1-4A4E-BDCC-F89F0BA65218}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85BF7FD9-90C1-4A4E-BDCC-F89F0BA65218}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D32C4EE9-E827-467A-B116-8EF0BA08A11F} = {0CCDE9AB-15C9-4B1C-97A8-21F49262BDE3}
{46B6764A-0DCF-47E6-86B8-09A1CFC3CF80} = {0CCDE9AB-15C9-4B1C-97A8-21F49262BDE3}
{8DF9A6F4-AF02-4B36-B199-78883FC51631} = {0CCDE9AB-15C9-4B1C-97A8-21F49262BDE3}
{85BF7FD9-90C1-4A4E-BDCC-F89F0BA65218} = {00F4FF62-D447-4DE4-902D-CB1FB98FBECF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0BE3D36E-14FA-4A8E-A968-DE322F5A381E}
EndGlobalSection
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ cd altinn-profile

- Start Altinn Profile docker container run the command

```cmd
podman compose up -d --build
```
```cmd
podman compose up -d --build
```

- To stop the container running Altinn Profile run the command

```cmd
podman stop altinn-profile
```
```cmd
podman stop altinn-profile
```


### Running the application with .NET
Expand All @@ -73,10 +73,10 @@ The Profile components can be run locally when developing/debugging. Follow the

- Navigate to _src/Profile, and build and run the code from there, or run the solution using you selected code editor

```cmd
cd src/Profile
dotnet run
```
```cmd
cd src/Profile
dotnet run
```

The profile solution is now available locally at http://localhost:5030/.
To access swagger use http://localhost:5030/swagger.
1 change: 1 addition & 0 deletions src/Altinn.Profile.Core/Altinn.Profile.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ProjectGuid>{7BA8E238-C930-45C0-BB5D-28AE4D89669B}</ProjectGuid>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Altinn.Profile.Integrations.SblBridge;

/// <summary>
/// Represents an implementation of <see cref="IUnitContactPointClient"/> using SBLBridge to obtain unit profile information.
/// Represents an implementation of <see cref="IUnitProfileClient"/> using SBLBridge to obtain unit profile information.
/// </summary>
public class UnitProfileClient : IUnitProfileClient
{
Expand Down
10 changes: 5 additions & 5 deletions src/Altinn.Profile.Integrations/SblBridge/UserProfileClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace Altinn.Profile.Integrations.SblBridge;

/// <summary>
/// Represents an implementation of <see cref="IUserProfiles"/> using SBLBridge to obtain profile information.
/// Represents an implementation of <see cref="IUserProfileClient"/> using SBLBridge to obtain profile information.
/// </summary>
public class UserProfileClient : IUserProfileClient
{
Expand Down Expand Up @@ -73,7 +73,7 @@ public async Task<Result<UserProfile, bool>> GetUser(string ssn)

if (!response.IsSuccessStatusCode)
{
_logger.LogError("Getting user by SSN failed with statuscode {statusCode}", response.StatusCode);
_logger.LogError("Getting user by SSN failed with statuscode {StatusCode}", response.StatusCode);
return false;
}

Expand All @@ -92,7 +92,7 @@ public async Task<Result<UserProfile, bool>> GetUserByUuid(Guid userUuid)

if (!response.IsSuccessStatusCode)
{
_logger.LogError("Getting user {userUuid} failed with {statusCode}", userUuid, response.StatusCode);
_logger.LogError("Getting user {userUuid} failed with {StatusCode}", userUuid, response.StatusCode);

Check warning on line 95 in src/Altinn.Profile.Integrations/SblBridge/UserProfileClient.cs

View workflow job for this annotation

GitHub Actions / Build, test & analyze

Use PascalCase for named placeholders. (https://rules.sonarsource.com/csharp/RSPEC-6678)
return false;
}

Expand All @@ -112,7 +112,7 @@ public async Task<Result<List<UserProfile>, bool>> GetUserListByUuid(List<Guid>

if (!response.IsSuccessStatusCode)
{
_logger.LogError("Getting users failed with {statusCode}", response.StatusCode);
_logger.LogError("Getting users failed with {StatusCode}", response.StatusCode);
return false;
}

Expand All @@ -131,7 +131,7 @@ public async Task<Result<UserProfile, bool>> GetUserByUsername(string username)

if (!response.IsSuccessStatusCode)
{
_logger.LogError("Getting user {username} failed with {statusCode}", HttpUtility.HtmlEncode(username), response.StatusCode);
_logger.LogError("Getting user {Username} failed with {StatusCode}", HttpUtility.HtmlEncode(username), response.StatusCode);
return false;
}

Expand Down
18 changes: 1 addition & 17 deletions src/Altinn.Profile/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:58874",
"sslPort": 44339
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "profile/swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Altinn.Profile": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "profile/swagger",
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5030",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
Expand Down
56 changes: 0 additions & 56 deletions stylecop.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
// ACTION REQUIRED: This file was automatically added to your project, but it
// will not take effect until additional steps are taken to enable it. See the
// following page for additional information:
//
// https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md

"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"documentationRules": {
Expand All @@ -14,56 +8,6 @@
"usingDirectivesPlacement": "outsideNamespace",
"systemUsingDirectivesFirst": true,
"blankLinesBetweenUsingGroups": "allow"
},
"namingRules": {
"allowCommonHungarianPrefixes": true,
"allowedHungarianPrefixes": [
"as",
"d",
"db",
"dn",
"do",
"dr",
"ds",
"dt",
"e",
"e2",
"er",
"f",
"fs",
"go",
"id",
"if",
"in",
"ip",
"is",
"js",
"li",
"my",
"no",
"ns",
"on",
"or",
"pi",
"pv",
"sa",
"sb",
"se",
"si",
"so",
"sp",
"tc",
"to",
"tr",
"ui",
"un",
"wf",
"ws",
"x",
"y",
"j",
"js"
]
}
}
}
4 changes: 1 addition & 3 deletions test/Altinn.Profile.Tests/Altinn.Profile.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down Expand Up @@ -37,8 +36,7 @@
</ItemGroup>

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<NoWarn>$(NoWarn);SA0001;CS1591;SA1600</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 0 additions & 8 deletions test/Altinn.Profile.Tests/GlobalSuppressions.cs

This file was deleted.

0 comments on commit a683dcd

Please sign in to comment.