Skip to content

Commit bc50cd0

Browse files
authored
Added code quality updates (#298)
1 parent 202666d commit bc50cd0

12 files changed

Lines changed: 94 additions & 41 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Please search the existing issues before filing new issues to avoid duplicates.
1818
- For new issues, file your bug or feature request as a new [issue].
1919
- For help, discussion, and support questions about using this project, join or start a [discussion].
2020

21-
If you have any problems with the [PSDocs][engine] engine, please check the project GitHub [issues](https://github.com/BernieWhite/PSDocs/issues) page instead.
21+
If you have any problems with the [PSDocs][engine] engine, please check the project GitHub [issues](https://github.com/microsoft/PSDocs/issues) page instead.
2222

2323
Support for this project/ product is limited to the resources listed above.
2424

docs/install-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ You can also use this option to install on CI workers that are not natively supp
2121
The following platforms are supported:
2222

2323
- Windows PowerShell 5.1 with .NET Framework 4.7.2 or greater.
24-
- PowerShell 7.1 or greater on MacOS, Linux, and Windows.
24+
- PowerShell 7.3 or greater on MacOS, Linux, and Windows.
2525

2626
PSDocs for Azure requires the PSDocs PowerShell module.
2727
The required version of PSDocs will automatically be installed along-side PSDocs for Azure.
2828

2929
### Installing PowerShell
3030

3131
PowerShell 7.x can be installed on MacOS, Linux, and Windows but is not installed by default.
32-
For a list of platforms that PowerShell 7.1 is supported on and install instructions see [Get PowerShell][3].
32+
For a list of platforms that PowerShell 7.3 is supported on and install instructions see [Get PowerShell][3].
3333

3434
[3]: https://github.com/PowerShell/PowerShell#get-powershell
3535

docs/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ PSDocs for Azure includes pre-built functions and templates that make it easy to
1616
- **:octicons-people-24: Consumable** — Transform infrastructure code into presentable documentation.
1717
Use standard documentation that make it easier to deploy Azure resources.
1818

19-
[1]: https://github.com/BernieWhite/PSDocs
19+
[1]: https://github.com/microsoft/PSDocs
2020

2121
## Ready to go
2222

src/PSDocs.Azure/Configuration/OutputOption.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public sealed class OutputOption : IEquatable<OutputOption>
1313
{
1414
private const OutputEncoding DEFAULT_ENCODING = OutputEncoding.Default;
1515

16-
internal static readonly OutputOption Default = new OutputOption
16+
internal static readonly OutputOption Default = new()
1717
{
1818
Encoding = DEFAULT_ENCODING
1919
};
@@ -49,7 +49,7 @@ public override int GetHashCode()
4949
{
5050
unchecked // Overflow is fine
5151
{
52-
int hash = 17;
52+
var hash = 17;
5353
hash = hash * 23 + (Encoding.HasValue ? Encoding.Value.GetHashCode() : 0);
5454
hash = hash * 23 + (Path != null ? Path.GetHashCode() : 0);
5555
return hash;

src/PSDocs.Azure/Configuration/PSDocumentOption.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation.
1+
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

44
using System.Diagnostics;
@@ -12,9 +12,12 @@ namespace PSDocs.Azure.Configuration
1212
/// </summary>
1313
internal delegate string PathDelegate();
1414

15+
/// <summary>
16+
/// The base class for configuring options within PSDocs.
17+
/// </summary>
1518
public sealed class PSDocumentOption
1619
{
17-
internal static readonly PSDocumentOption Default = new PSDocumentOption
20+
internal static readonly PSDocumentOption Default = new()
1821
{
1922
Output = OutputOption.Default
2023
};
@@ -24,6 +27,9 @@ public sealed class PSDocumentOption
2427
/// </summary>
2528
private static PathDelegate _GetWorkingPath = () => Directory.GetCurrentDirectory();
2629

30+
/// <summary>
31+
/// Create an instance of options.
32+
/// </summary>
2733
public PSDocumentOption()
2834
{
2935
// Set defaults
@@ -52,6 +58,9 @@ public static void UseExecutionContext(EngineIntrinsics executionContext)
5258
_GetWorkingPath = () => executionContext.SessionState.Path.CurrentFileSystemLocation.Path;
5359
}
5460

61+
/// <summary>
62+
/// Get the current working path.
63+
/// </summary>
5564
public static string GetWorkingPath()
5665
{
5766
return _GetWorkingPath();

src/PSDocs.Azure/PSDocs.Azure.csproj

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,72 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<OutputType>Library</OutputType>
66
<ProjectGuid>{1DF0509F-4D84-445F-BB98-CEA69EDD68FE}</ProjectGuid>
7-
<!-- <DebugType>portable</DebugType> -->
7+
<LangVersion>9.0</LangVersion>
88
<NeutralLanguage>en-US</NeutralLanguage>
99
<DebugSymbols>true</DebugSymbols>
10+
<DebugType>portable</DebugType>
11+
<IncludeSymbols>true</IncludeSymbols>
12+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
13+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
14+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1015
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
11-
<!-- <TreatWarningsAsErrors>true</TreatWarningsAsErrors> -->
12-
<Authors>Bernie White</Authors>
13-
<AssemblyTitle>PSDocs</AssemblyTitle>
16+
<PackageId>Microsoft.PSDocs.Azure.Core</PackageId>
17+
<EnableNuget>false</EnableNuget>
18+
<IsPackable>false</IsPackable>
19+
<PackageReadmeFile>README.md</PackageReadmeFile>
20+
</PropertyGroup>
21+
22+
<!-- Package metadata -->
23+
<PropertyGroup>
24+
<Authors>Microsoft</Authors>
25+
<AssemblyTitle>PSDocs for Azure</AssemblyTitle>
1426
<RepositoryUrl>https://github.com/Azure/PSDocs.Azure</RepositoryUrl>
15-
<PackageLicenseExpression>https://github.com/Azure/PSDocs.Azure/blob/main/LICENSE</PackageLicenseExpression>
27+
<RepositoryType>git</RepositoryType>
28+
<PackageProjectUrl>https://aka.ms/ps-docs-azure</PackageProjectUrl>
29+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
30+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
31+
<PackageTags>PSDocs;Azure;Bicep;IaC;markdown;documentation;</PackageTags>
1632
<Version>0.0.1</Version>
17-
<Copyright>Copyright (c) Microsoft Corporation. Licensed under the MIT License.</Copyright>
33+
<Company>Microsoft Corporation</Company>
34+
<Copyright>&#169; Microsoft Corporation. All rights reserved.</Copyright>
1835
<Description>Generate markdown from Azure infrastructure as code (IaC) artifacts.
1936

20-
This project uses GitHub Issues to track bugs and feature requests. See GitHub project for more information.</Description>
21-
</PropertyGroup>
22-
23-
<PropertyGroup>
24-
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
25-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
37+
This project uses GitHub Issues to track bugs and feature requests. See GitHub project for
38+
more information.</Description>
39+
<PackageReleaseNotes>For a list of changes see https://aka.ms/ps-rule-docs.</PackageReleaseNotes>
40+
<PackageIcon>package_icon.png</PackageIcon>
2641
</PropertyGroup>
2742

2843
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
2944
<DefineConstants>Windows</DefineConstants>
3045
</PropertyGroup>
3146

47+
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
48+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
49+
</PropertyGroup>
50+
51+
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
52+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
53+
</PropertyGroup>
54+
55+
<ItemGroup>
56+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
57+
</ItemGroup>
58+
59+
<ItemGroup>
60+
<None Include="..\..\docs\assets\package_icon.png">
61+
<Pack>True</Pack>
62+
<PackagePath>\</PackagePath>
63+
</None>
64+
</ItemGroup>
65+
66+
<ItemGroup Condition="'$(PackageReadmeFile)' != ''">
67+
<None Include="README.md">
68+
<Pack>True</Pack>
69+
<PackagePath>\</PackagePath>
70+
</None>
71+
</ItemGroup>
72+
3273
<ItemGroup>
3374
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4">
3475
<PrivateAssets>all</PrivateAssets>

src/PSDocs.Azure/Pipeline/Output/PSPipelineWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using PSDocs.Azure.Configuration;
54
using System;
65
using System.Management.Automation;
6+
using PSDocs.Azure.Configuration;
77

88
namespace PSDocs.Azure.Pipeline.Output
99
{

src/PSDocs.Azure/Pipeline/PathBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using PSDocs.Azure.Configuration;
54
using System.Collections.Generic;
65
using System.Diagnostics;
76
using System.IO;
7+
using PSDocs.Azure.Configuration;
88

99
namespace PSDocs.Azure.Pipeline
1010
{
@@ -61,7 +61,7 @@ private void FindFiles(string path)
6161
if (TryAddFile(path))
6262
return;
6363

64-
var pathLiteral = GetSearchParameters(path, out string searchPattern, out SearchOption searchOption);
64+
var pathLiteral = GetSearchParameters(path, out var searchPattern, out var searchOption);
6565
if (TryAddFile(pathLiteral))
6666
return;
6767

@@ -100,7 +100,7 @@ private string GetRootedPath(string path)
100100
private string GetSearchParameters(string path, out string searchPattern, out SearchOption searchOption)
101101
{
102102
searchOption = SearchOption.AllDirectories;
103-
var pathLiteral = SplitSearchPath(TrimPath(path, out bool relativeAnchor), out searchPattern);
103+
var pathLiteral = SplitSearchPath(TrimPath(path, out var relativeAnchor), out searchPattern);
104104
if (string.IsNullOrEmpty(searchPattern))
105105
searchPattern = _DefaultSearchPattern;
106106

src/PSDocs.Azure/Pipeline/PipelineBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using PSDocs.Azure.Configuration;
5-
using PSDocs.Azure.Pipeline.Output;
64
using System;
75
using System.Management.Automation;
6+
using PSDocs.Azure.Configuration;
7+
using PSDocs.Azure.Pipeline.Output;
88

99
namespace PSDocs.Azure.Pipeline
1010
{

src/PSDocs.Azure/Pipeline/PipelineWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using PSDocs.Azure.Configuration;
54
using System;
65
using System.Collections.Generic;
76
using System.Management.Automation;
87
using System.Threading;
8+
using PSDocs.Azure.Configuration;
99

1010
namespace PSDocs.Azure.Pipeline
1111
{

0 commit comments

Comments
 (0)