Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 51 additions & 33 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 9 * * 5'
- cron: "0 9 * * 5"

jobs:
analyze:
Expand All @@ -19,39 +19,57 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['csharp']
language: ["csharp"]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

- name: Install dependencies
run: cd src && dotnet restore

- name: .Net Version
run: cd src && dotnet --version

- name: Build
run: cd src && dotnet build --configuration Release --no-restore

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
75 changes: 42 additions & 33 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,54 @@ name: .NET Core

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.405

- name: Install dependencies
run: cd src && dotnet restore

- name: Build
run: cd src && dotnet build --configuration Release --no-restore

- name: Linting code with dotnet-format
run: cd src && ./run-dotnet-format.sh

- name: Test
run: cd src && ./codeclimate_code_coverage.sh
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

- name: docfx-action
uses: nikeee/[email protected]
with:
args: docs/docfx.json

- name: Update Library DocFx documentation
run: cd src && ./release-docfx-github.sh
env:
BYTEDECODER_COMMON_GITHUB_CI_ACTIONS: ${{ secrets.BYTEDECODER_COMMON_GITHUB_CI_ACTIONS }}
DOCFX_GITHUB_EMAIL: ${{ secrets.DOCFX_GITHUB_EMAIL }}
- uses: actions/checkout@v2

- name: Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

- name: Install dependencies
run: cd src && dotnet restore

- name: .Net Version
run: cd src && dotnet --version

- name: Build
run: cd src && dotnet build --configuration Release --no-restore

- name: Security Code Scan
run: cd src && ./run-security-code-scan.sh

- name: Linting code with dotnet-format
run: cd src && ./run-dotnet-format.sh

- name: Test
run: cd src && ./codeclimate_code_coverage.sh
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

- name: docfx-action
uses: nikeee/[email protected]
with:
args: docs/docfx.json

- name: Update Library DocFx documentation
run: cd src && ./release-docfx-github.sh
env:
BYTEDECODER_COMMON_GITHUB_CI_ACTIONS: ${{ secrets.BYTEDECODER_COMMON_GITHUB_CI_ACTIONS }}
DOCFX_GITHUB_EMAIL: ${{ secrets.DOCFX_GITHUB_EMAIL }}
60 changes: 41 additions & 19 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,38 +1,60 @@
# Changelog

## Version Changes

### 1.0.0 - 2022-01-02

- C# 10 adopted
- .Net Standard support deprecated
- Support from .Net6 onwards
- New CSA tools added into the build pipeline

### 0.3.6 - 2021-01-25
* Added ToCamelCase string extension methods.

- Added ToCamelCase string extension methods.

### 0.3.5 - 2021-01-20
* Added ToEnum string extension methods.
* Added DateTimeOffset extensions methods.

- Added ToEnum string extension methods.
- Added DateTimeOffset extensions methods.

### 0.3.4 - 2020-08-19
* Transparent favicon added

- Transparent favicon added

### 0.3.3 - 2020-08-19
* Library logos added in the DocFX documentation


- Library logos added in the DocFX documentation

### 0.3.2 - 2020-08-18
* DocFX documentation completed
* Official documentation url https://bytedecoder.me/ByteDecoder.Common/


- DocFX documentation completed
- Official documentation url <https://bytedecoder.me/ByteDecoder.Common/>

### 0.3.1 - 2020-08-13
* Guard interface implementation refactored
* StyleCop and FxCop analyzers added as part of the development workflow
* Violating the analyzers rules will throw errors on compile, until they are fix
* All methods, classes and interfaces consumables for third parties in the Library has now documentation

- Guard interface implementation refactored
- StyleCop and FxCop analyzers added as part of the development workflow
- Violating the analyzers rules will throw errors on compile, until they are fix
- All methods, classes and interfaces consumables for third parties in the Library has now documentation

### 0.3.0 - 2020-07-29
* Added MathComparisonExtensions extensions methods for math comparisions
* Added IfArgumentOutOfRange Guard clause

- Added MathComparisonExtensions extensions methods for math comparisions
- Added IfArgumentOutOfRange Guard clause

### 0.2.3 - 2020-07-28
* Fixed problem with Possible multiple enumeration of IEnumerable using with Resharper with JETBRAINS_ANNOTATIONS compilation symbol

- Fixed problem with Possible multiple enumeration of IEnumerable using with Resharper with JETBRAINS_ANNOTATIONS compilation symbol

### 0.2.1 - 2020-07-28
* Added AllowedOutputExtensionsInPackageBuildOutputFolder in ByteDecoder.Common project

- Added AllowedOutputExtensionsInPackageBuildOutputFolder in ByteDecoder.Common project

### 0.2.0 - 2020-07-27
* Added Jetbrains Annotations for avoding false positive: Possible multiple enumeration of IEnumerable

- Added Jetbrains Annotations for avoding false positive: Possible multiple enumeration of IEnumerable

### 0.1.0 - 2020-07-27
* Initial release

- Initial release
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Common utility classes, guard clauses, and more.

Targeted to .Net Standard 2.0
Targeted to .Net6 onwards

## Installation

Expand Down Expand Up @@ -36,7 +36,7 @@ All the documentation can be found on the [github page](https://bytedecoder.me/B

They are a piece of code in charge of protecting params at the top of methods against undesirable values.

Supported *Guard Clauses*:
Supported _Guard Clauses_:

- IfArgumentIsNull
- IfArgumentIsNullOrEmpty
Expand All @@ -51,15 +51,15 @@ using ByteDecoder.Common.GuardClauses;
public void MethodOne(IEnumerable<string> collection)
{
Guard.Break.IfArgumentIsNull(collection, nameof(collection));

// More logic code if the param is suitable after the guard evaluates the condition.
}

// String is NUll or Empty Guard check
public void MethodTwo(string word)
{
Guard.Break.IfArgumentIsNull(word, nameof(word));

// More logic code if the param is suitable after the guard evaluates the condition.
}

Expand Down
14 changes: 14 additions & 0 deletions src/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": 1,
"isRoot": true,
"tools": {
"security-scan": {
"version": "5.6.0",
"commands": ["security-scan"]
},
"dotnet-format": {
"version": "5.1.250801",
"commands": ["dotnet-format"]
}
}
}
44 changes: 21 additions & 23 deletions src/ByteDecoder.Common.Tests/ByteDecoder.Common.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<CodeAnalysisRuleSet>$(SolutionDir)\_stylecop\TestProjStyleCopRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<TreatSpecificWarningsAsErrors/>
<NoWarn>1701;1702;1705</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0"/>
<PackageReference Include="xunit" Version="2.4.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="2.9.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="3.1.0"/>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0"/>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit.analyzers" Version="0.10.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ByteDecoder.Common\ByteDecoder.Common.csproj" />
<ProjectReference Include="..\ByteDecoder.Common\ByteDecoder.Common.csproj"/>
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="$(SolutionDir)\_stylecop\stylecop.json" Link="stylecop.json" />
<AdditionalFiles Include="$(SolutionDir)\_stylecop\stylecop.json" Link="stylecop.json"/>
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>$(SolutionDir)\_stylecop\TestProjStyleCopRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<TreatSpecificWarningsAsErrors />
<NoWarn>1701;1702;1705</NoWarn>
<PropertyGroup>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
</PropertyGroup>

</Project>
Loading