You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(docs): Fixed Markdownlint, added cspell words and slight sample Readme improvement (#1563)
Added files:
- markdownlint
- cSpell
fixed lintings accordingly:
- root Readme
- samples Readme(s)
- Contributing.md
Improved also sample explanation by embedding a codeblock from the
linked file to enable also showing this md file in future maybe docfx
created web docs
@@ -11,20 +12,24 @@ We also want the person with the idea, suggestion or bug report to implement the
11
12
This is to help grow the number of people that can contribute to the project and after someone new lands that first PR we often see more PRs from that person later.
12
13
13
14
## Coding Conventions
15
+
14
16
* Match the existing code style, we generally stick to "Visual Studio defaults" and [.NET Foundation Coding Guidelines](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md)
15
17
* If you use ReSharper there is a [settings file](https://github.com/angularsen/UnitsNet/blob/master/UnitsNet.sln.DotSettings) that will take effect automatically
16
18
* There is an [.editorconfig](https://github.com/angularsen/UnitsNet/blob/master/.editorconfig) to help configure whitespace and C# syntax for your editor if it supports it
17
19
* Add the file header to new files you create
18
20
19
21
### Test Code
22
+
20
23
* Test class: Use `Tests` suffix for the type you are testing, such as `UnitSystemTests`
21
24
* Test method: `<method>_<condition>_<result>` (`Parse_AmbiguousUnits_ThrowsException`)
22
25
* If there are many tests for a single method, you can wrap those in an inner class named the same as the method and then you can skip that part of the test method names
23
26
24
27
## Unit definitions (.JSON)
28
+
25
29
For a fairly complete summary of the unit definition JSON schema, see [Meter of Length](https://github.com/angularsen/UnitsNet/blob/master/Common/UnitDefinitions/Length.json). It has prefix units and multiple cultures.
26
30
27
31
### Conversion functions
32
+
28
33
Converting from unit A to B is achieved by first converting from unit A to the base unit, then from the base unit to unit B. To achieve this, each unit defines two conversion functions.
29
34
30
35
* Prefer multiplication for `FromUnitToBaseFunc` (`{x} * 2.54e-2` for `Inch` to `Meter`)
@@ -34,13 +39,15 @@ Converting from unit A to B is achieved by first converting from unit A to the b
34
39
* Prefer a calculation if the conversion factor is infinite (`({x} / 72.27)*2.54e-2` for `PrinterPoint`)
35
40
36
41
### Units
42
+
37
43
Generally we try to name the units as what is the most widely used.
38
44
39
45
* Use prefix for country variants, such as `ImperialGallon` and `UsGallon`
40
46
41
47
**Note:** We should really consider switching variant prefix to suffix, since that plays better with kilo, mega etc.. Currently we have units named `KilousGallon` and `KiloimperialGallon`, these would be better named `KilogallonUs` and `KilogallonImperial`.
42
48
43
49
### Unit abbreviations
50
+
44
51
A unit can have multiple abbreviations per culture/language, the first one is used by `ToString()` while all of them are used by `Parse()`.
45
52
46
53
* Prefer the most widely used abbreviation in the domain, but try to adapt to our conventions
0 commit comments