Skip to content

Commit

Permalink
Merge pull request #8 from Atypical-Consulting/features-linting
Browse files Browse the repository at this point in the history
Add .editorconfig and lint the code
  • Loading branch information
phmatray authored Nov 30, 2022
2 parents e9364bb + 60998ec commit c090698
Show file tree
Hide file tree
Showing 27 changed files with 2,930 additions and 2,966 deletions.
24 changes: 12 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggest
#Style - Modifier preferences

#when this rule is set to a list of modifiers, prefer the specified ordering.
csharp_preferred_modifier_order = public,protected,private,internal,static,async,abstract,virtual,readonly,sealed,override:suggestion
csharp_preferred_modifier_order = public, protected, private, internal, static, async, abstract, virtual, readonly, sealed, override:suggestion

#Style - Pattern matching

Expand Down Expand Up @@ -167,31 +167,31 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

A virtual file system implementation in modern C#.

When writing applications in .NET, you often need to write or read the contents of a file. .NET provides `System.IO` namespace dedicated to this purpose. But how do we deal with the filesystem when testing our code?

"Virtual File System" is an attempt to solve this problem. Currently, this library is at an early stage of development. If you need additional functionality, I invite you to open an issue to discuss it.
When writing applications in .NET, you often need to write or read the contents of a file. .NET provides `System.IO`
namespace dedicated to this purpose. But how do we deal with the filesystem when testing our code?

"Virtual File System" is an attempt to solve this problem. Currently, this library is at an early stage of development.
If you need additional functionality, I invite you to open an issue to discuss it.

## Badges

Expand All @@ -16,7 +17,6 @@ _Social buttons_
[![stars - VirtualFileSystem](https://img.shields.io/github/stars/Atypical-Consulting/VirtualFileSystem?style=social)](https://github.com/Atypical-Consulting/VirtualFileSystem)
[![forks - VirtualFileSystem](https://img.shields.io/github/forks/Atypical-Consulting/VirtualFileSystem?style=social)](https://github.com/Atypical-Consulting/VirtualFileSystem)


_Repo metadata_

[![GitHub tag](https://img.shields.io/github/tag/Atypical-Consulting/VirtualFileSystem?include_prereleases=&sort=semver&color=blue)](https://github.com/Atypical-Consulting/VirtualFileSystem/releases/)
Expand All @@ -30,21 +30,24 @@ _Call-to-Action buttons_
[![View site - GH Pages](https://img.shields.io/badge/View_site-GH_Pages-2ea44f?style=for-the-badge)](https://atypical-consulting.github.io/VirtualFileSystem/)
[![view - Documentation](https://img.shields.io/badge/view-Documentation-blue?style=for-the-badge)](/docs/ "Go to project documentation")


## What is a virtual file system and why should I use it?
A virtual file system is a data structure that represents a file system in memory. It is used to simulate a file system on a computer. It is useful for testing purposes, for example, when you want to test a file system without actually creating files on the hard drive.

A virtual file system is a data structure that represents a file system in memory. It is used to simulate a file system
on a computer. It is useful for testing purposes, for example, when you want to test a file system without actually
creating files on the hard drive.

## We use the lastest C# features

This library targets .NET 7.0 and uses the latest C# features. It is written in C# 11.0 and uses the new `init` properties, `record` types, `switch` expressions, `using` declarations, and more.

I invite you to read the [C# 11.0 documentation](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-11) to learn more about these features.
This library targets .NET 7.0 and uses the latest C# features. It is written in C# 11.0 and uses the new `init`
properties, `record` types, `switch` expressions, `using` declarations, and more.

I invite you to read the [C# 11.0 documentation](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-11) to
learn more about these features.

## License

This project is licensed under the terms of the BSD-3-Clause license.
If you use this library in your project, please consider adding a link to this repository in your project's README.

This project is maintained by [Atypical Consulting](https://www.atypical.consulting/). If you need help with this project, please contact us from this repository by opening an issue.
This project is maintained by [Atypical Consulting](https://www.atypical.consulting/). If you need help with this
project, please contact us from this repository by opening an issue.
96 changes: 48 additions & 48 deletions src/Atypical.VirtualFileSystem.Core/Abstractions/VFSNode.cs
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
// Copyright (c) 2022, Atypical Consulting SRL
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.

namespace Atypical.VirtualFileSystem.Core.Abstractions;

/// <summary>
/// Represents a node in a virtual file system.
/// A node can be a file or a directory.
/// </summary>
public abstract record VFSNode
: IVirtualFileSystemNode
{
/// <summary>
/// Initializes a new instance of the <see cref="VFSNode"/> class.
/// This constructor is used by derived classes.
/// </summary>
/// <param name="path">The path of the node.</param>
protected VFSNode(VFSPath path)
{
ArgumentNullException.ThrowIfNull(path);

// set timestamps
var now = DateTime.UtcNow;
CreationTime = now;
LastAccessTime = now;
LastWriteTime = now;
}

/// <inheritdoc cref="IVirtualFileSystemNode.CreationTime"/>
public abstract VFSPath Path { get; }
/// <inheritdoc cref="IVirtualFileSystemNode.CreationTime"/>
public DateTimeOffset CreationTime { get; }
/// <inheritdoc cref="IVirtualFileSystemNode.LastAccessTime"/>
public DateTimeOffset LastAccessTime { get; }

/// <inheritdoc cref="IVirtualFileSystemNode.LastWriteTime"/>
public DateTimeOffset LastWriteTime { get; }
/// <inheritdoc cref="IVirtualFileSystemNode.IsDirectory"/>
public abstract bool IsDirectory { get; }
/// <inheritdoc cref="IVirtualFileSystemNode.IsFile"/>
public abstract bool IsFile { get; }
// Copyright (c) 2022, Atypical Consulting SRL
// All rights reserved.
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.

namespace Atypical.VirtualFileSystem.Core.Abstractions;

/// <summary>
/// Represents a node in a virtual file system.
/// A node can be a file or a directory.
/// </summary>
public abstract record VFSNode
: IVirtualFileSystemNode
{
/// <summary>
/// Initializes a new instance of the <see cref="VFSNode" /> class.
/// This constructor is used by derived classes.
/// </summary>
/// <param name="path">The path of the node.</param>
protected VFSNode(VFSPath path)
{
ArgumentNullException.ThrowIfNull(path);

// set timestamps
var now = DateTime.UtcNow;
CreationTime = now;
LastAccessTime = now;
LastWriteTime = now;
}

/// <inheritdoc cref="IVirtualFileSystemNode.CreationTime" />
public abstract VFSPath Path { get; }

/// <inheritdoc cref="IVirtualFileSystemNode.CreationTime" />
public DateTimeOffset CreationTime { get; }

/// <inheritdoc cref="IVirtualFileSystemNode.LastAccessTime" />
public DateTimeOffset LastAccessTime { get; }

/// <inheritdoc cref="IVirtualFileSystemNode.LastWriteTime" />
public DateTimeOffset LastWriteTime { get; }

/// <inheritdoc cref="IVirtualFileSystemNode.IsDirectory" />
public abstract bool IsDirectory { get; }

/// <inheritdoc cref="IVirtualFileSystemNode.IsFile" />
public abstract bool IsFile { get; }
}
Loading

0 comments on commit c090698

Please sign in to comment.