-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing some issues. Applying Metalama code style.
- Loading branch information
Showing
27 changed files
with
224 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
CodeQualityTalk.Metalama/Abstractions/DocumentCreationContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details. | ||
|
||
namespace CodeQualityTalk.Abstractions; | ||
|
||
public record DocumentCreationContext( string OwnerId ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
using CodeQualityTalk.Documents; | ||
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details. | ||
|
||
using CodeQualityTalk.Documents; | ||
|
||
namespace CodeQualityTalk.Abstractions; | ||
|
||
public static class DocumentHelper | ||
{ | ||
public static bool IsInvoice(IDocument document) => document is Invoice; | ||
public static bool IsInvoice( IDocument document ) => document is Invoice; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details. | ||
|
||
namespace CodeQualityTalk.Abstractions; | ||
|
||
public interface IDocument | ||
{ | ||
string OwnerId { get; } | ||
|
||
string Name { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
using Metalama.Extensions.Architecture.Aspects; | ||
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details. | ||
|
||
using Metalama.Extensions.Architecture.Aspects; | ||
|
||
namespace CodeQualityTalk.Abstractions; | ||
|
||
[DerivedTypesMustRespectNamingConvention("*Factory")] | ||
[DerivedTypesMustRespectNamingConvention( "*Factory" )] | ||
public interface IDocumentFactory | ||
{ | ||
IDocument CreateDocument(string name, DocumentCreationContext context); | ||
IDocument CreateDocument( string name, DocumentCreationContext context ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
using Metalama.Extensions.Architecture; | ||
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details. | ||
|
||
using Metalama.Extensions.Architecture; | ||
using Metalama.Extensions.Architecture.Predicates; | ||
using Metalama.Framework.Fabrics; | ||
|
||
namespace CodeQualityTalk.Architecture; | ||
|
||
public class Fabric : ProjectFabric | ||
{ | ||
public override void AmendProject(IProjectAmender amender) | ||
public override void AmendProject( IProjectAmender amender ) | ||
{ | ||
// Validate dependencies. | ||
amender | ||
.Select(c=>c.GlobalNamespace.GetDescendant("CodeQualityTalk.Documents")!) | ||
.CannotBeUsedFrom( x => x.Namespace("CodeQualityTalk.Abstractions")); | ||
.Select( c => c.GlobalNamespace.GetDescendant( "CodeQualityTalk.Documents" )! ) | ||
.CannotBeUsedFrom( x => x.Namespace( "CodeQualityTalk.Abstractions" ) ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details. | ||
|
||
using CodeQualityTalk.Abstractions; | ||
|
||
namespace CodeQualityTalk; | ||
|
||
internal class CreditNote : IDocument | ||
{ | ||
public string OwnerId { get; } | ||
public string Name { get; } | ||
public string OwnerId { get; } | ||
|
||
public string Name { get; } | ||
|
||
public CreditNote(string ownerId, string name) | ||
public CreditNote( string ownerId, string name ) | ||
{ | ||
OwnerId = ownerId; | ||
Name = name; | ||
this.OwnerId = ownerId; | ||
this.Name = name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details. | ||
|
||
using CodeQualityTalk.Abstractions; | ||
|
||
namespace CodeQualityTalk.Documents; | ||
|
||
internal class Invoice : IDocument | ||
{ | ||
public string OwnerId { get; } | ||
public string Name { get; } | ||
public string OwnerId { get; } | ||
|
||
public string Name { get; } | ||
|
||
public Invoice(string ownerId, string name) | ||
public Invoice( string ownerId, string name ) | ||
{ | ||
OwnerId = ownerId; | ||
Name = name; | ||
this.OwnerId = ownerId; | ||
this.Name = name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details. | ||
|
||
using CodeQualityTalk.Abstractions; | ||
|
||
namespace CodeQualityTalk.Factories; | ||
|
||
public class CreditNoteCreator : IDocumentFactory | ||
{ | ||
public IDocument CreateDocument(string name, DocumentCreationContext context) | ||
=> new CreditNote(context.OwnerId, name); | ||
public IDocument CreateDocument( string name, DocumentCreationContext context ) => new CreditNote( context.OwnerId, name ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details. | ||
|
||
using CodeQualityTalk.Abstractions; | ||
using CodeQualityTalk.Documents; | ||
|
||
namespace CodeQualityTalk.Factories; | ||
|
||
public class InvoiceFactory : IDocumentFactory | ||
{ | ||
public IDocument CreateDocument(string name, DocumentCreationContext context) | ||
=> new Invoice(context.OwnerId, name); | ||
public IDocument CreateDocument( string name, DocumentCreationContext context ) => new Invoice( context.OwnerId, name ); | ||
} |
Oops, something went wrong.