Git Product home page Git Product logo

dotnet-eithers's People

Stargazers

 avatar

Watchers

 avatar

dotnet-eithers's Issues

Implement Results<T>

Requirements:

  • Implement a Results capability. It should be similar to the Maybe capability in design, but instead of None, it will have an error class.

Update .editorconfig

Issue: The .editorconfig file has not received the love it needs; so, it is likely that many formatting settings, warning, etc. are not optimally set.

*Requirements:

  • Update .editorconfig
  • Resolve all issues that arise.

Reorganize code coverage files and directories

Issue: Currently, the code covers files a folders are a bit scattered, which makes managing them (e.g., in .gitignore) somewhat error prone.

Requirements

  • Single up the coverage files under a single directory.

Constructor Some<T> should throw for null argument

Issue: Although marked not to accept a null value argument, code that does not have null analysis enabled (#nullable enable in C#) can still provide a null argument.

Requirements

  • Constructor Some<T> must throw ArgumentNullException with the value argument is null.

Verification

  • A unit test to verify that ArgumentNullException is thrown.

Add tests to detect inappropriately-scoped constructors

Issue: The design of this library relies on proper construction instances. For example, there should be only one instance of each None<T>.

Requirements

  • Add tests that ensure constructors have proper visibility.

Constructor Visibility Specs

  • Maybe<T>: constructors must be protected to avoid subclassing outside this library.
  • Some<T>: constructors must be internal to allow instance creation by the library.
  • None<T>: constructors must be private to ensure only singleton instance is created.

Eliminate remnants of test values

Issue: Originally, the unit tests relied on constant and readonly values defined in the TestData class. This turned out to make the test code harder to grok.

Requirements

  • Remove the constants and readonly values from TestData.
  • Fix any test code that breaks.

Refactoring and cleanup

Issue: Running SonarLint identified minor problems and some potential refactoring.

Requirements: Refactor and remove unnecessary code as needed.

  • Remove redundant function overrides (particularly object.GetHashCode()) and suppress resulting false positive SonarLint diagnostics.
  • Remove unnecessary #nullable enables.
  • Simplify types.
  • Change all line endings to NL.
  • Fix misspellings.
  • Readability tweaks.

Refine Maybe structure and test

Issue: As part of implementing Results (see #23), numerous modifications and improvements were made to ensure alignment in structure and testing between the implementations of Maybe and Result.

Requirements

  • Bring Maybe update to date before pulling Results.

Change Maybe and Result to interfaces

Issue: Currently, Maybe and Result are implemented using abstract classes. This adds complexity and execution overhead compared to structs.

Requirements:

  • Convert Maybe to use an interface.
  • Convert Results to use and interface.
  • Modify namespaces and directory structure to separate Maybe and Result (and future groups).

Revert unit tests to .NET 6.x

Issue: The unit test projects current target .NET 7.0. Since there is actual no need for .NET 7.0, switching to .NET 6.0 (the long-term support version) carries less risk.

Requirements

  • Switch the test projects to .NET 6.0

Change `Maybe` to `Option`

Issue: The name Maybe feels more like Haskell than C#.

Requirements:

  • Change the name of Maybe to Option.

Cleanup `Maybe<T>` testing

Issue: The Maybe<T> testing contains lots of redundant code and some questionable organization. Three issues in particular need resolution:

  • Redundant code, which is used to ensure the generics work across all types.
  • Redundant tests. In particular, tests that exist in both super- and sub-classes that exercise the same code.
  • Coverage gaps, which will be easier to locate and fill with better-organize test code.

Requirements:

  • Refactor redundant code into a central test controller class.
  • Reorder test classes and methods to match the order displayed by MSTest.
  • Remove redundant tests.
  • Fill coverage gaps.

Some files have CRLF line endings

Issue: Some files created from templates have CRLF line endings even though they were created on linux (looking at you DocFx).

Requirements

  • Change the line endings to NL.

Eliminate 'init' hack

Issue: In order to use property init, System.Runtime.CompilerServices.IsExternalInit must be defined. Since the single use of init can be easily replaced with private set, the IsExternalInit hack is not very beneficial.

Requirements

  • Remove IsExternalInit.
  • Replace init instances with private set.

None<T> singletons are clunky

Issue: None<T> singletons are currently implement as the only member of the Option<T> class. This is clunky for several reasons:

  • The singleton is the only member of Option<T>, but is actually implemented in None<T>.
  • The singleton is exposed; but there is not really a good reason for the exposure.

Requirements:

  • Bury the singleton and remove the Option<T> class.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.