Skip to content

Commit

Permalink
Merge pull request #1444 from dsyme/fmt3
Browse files Browse the repository at this point in the history
formatting: wider lists
  • Loading branch information
dsyme authored Jun 2, 2022
2 parents 8639894 + 84ac681 commit 3aaade7
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 67 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ insert_final_newline = true
trim_trailing_whitespace = false

[*.fs]
fsharp_max_array_or_list_width=80
fsharp_max_array_or_list_number_of_items=5
fsharp_max_if_then_else_short_width=60
fsharp_max_dot_get_expression_width=80
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ You can see the version history [here](RELEASE_NOTES.md).
- Install the .NET SDK specified in the `global.json` file
- `build.sh -t Build` or `build.cmd -t Build`

## Formatting

dotnet fake build -t Format
dotnet fake build -t CheckFormat

## Documentation

This library comes with comprehensive documentation. The documentation is
Expand Down
23 changes: 4 additions & 19 deletions src/CommonRuntime/StructuralInference.fs
Original file line number Diff line number Diff line change
Expand Up @@ -95,25 +95,10 @@ let typeTag =
let private conversionTable =
[ typeof<Bit>, [ typeof<Bit0>; typeof<Bit1> ]
typeof<bool>,
[ typeof<Bit0>
typeof<Bit1>
typeof<Bit> ]
typeof<int>,
[ typeof<Bit0>
typeof<Bit1>
typeof<Bit> ]
typeof<int64>,
[ typeof<Bit0>
typeof<Bit1>
typeof<Bit>
typeof<int> ]
typeof<decimal>,
[ typeof<Bit0>
typeof<Bit1>
typeof<Bit>
typeof<int>
typeof<int64> ]
typeof<bool>, [ typeof<Bit0>; typeof<Bit1>; typeof<Bit> ]
typeof<int>, [ typeof<Bit0>; typeof<Bit1>; typeof<Bit> ]
typeof<int64>, [ typeof<Bit0>; typeof<Bit1>; typeof<Bit>; typeof<int> ]
typeof<decimal>, [ typeof<Bit0>; typeof<Bit1>; typeof<Bit>; typeof<int>; typeof<int64> ]
typeof<float>,
[ typeof<Bit0>
typeof<Bit1>
Expand Down
10 changes: 1 addition & 9 deletions src/CommonRuntime/TextConversions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,7 @@ module private Helpers =
type TextConversions private () =

/// `NaN` `NA` `N/A` `#N/A` `:` `-` `TBA` `TBD`
static member val DefaultMissingValues =
[| "NaN"
"NA"
"N/A"
"#N/A"
":"
"-"
"TBA"
"TBD" |]
static member val DefaultMissingValues = [| "NaN"; "NA"; "N/A"; "#N/A"; ":"; "-"; "TBA"; "TBD" |]

/// `%` `‰` `‱`
static member val DefaultNonCurrencyAdorners = [| '%'; '‰'; '‱' |] |> Set.ofArray
Expand Down
18 changes: 2 additions & 16 deletions src/Html/HtmlRuntime.fs
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,7 @@ module HtmlRuntime =
let data =
let getContents contents =
contents
|> List.map (
innerTextExcluding
[ "table"
"ul"
"ol"
"dl"
"sup"
"sub" ]
)
|> List.map (innerTextExcluding [ "table"; "ul"; "ol"; "dl"; "sup"; "sub" ])
|> String.Concat
|> normalizeWs

Expand Down Expand Up @@ -362,13 +354,7 @@ module HtmlRuntime =
let rows =
list.Descendants("li", true)
|> Seq.map (
innerTextExcluding
[ "table"
"ul"
"ol"
"dl"
"sup"
"sub" ]
innerTextExcluding [ "table"; "ul"; "ol"; "dl"; "sup"; "sub" ]
>> normalizeWs
)
|> Seq.toArray
Expand Down
7 changes: 2 additions & 5 deletions src/Json/JsonGenerator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ module JsonTypeBuilder =

let tupleType =
Microsoft.FSharp.Reflection.FSharpType.MakeTupleType(
[| keyResult.ConvertedType
valueResult.ConvertedType |]
[| keyResult.ConvertedType; valueResult.ConvertedType |]
)

let itemsSeqType = typedefof<_ seq>.MakeGenericType ([| tupleType |])
Expand Down Expand Up @@ -566,9 +565,7 @@ module JsonTypeBuilder =
typeof<string * obj>,
args
|> List.mapi (fun i a ->
Expr.NewTuple
[ Expr.Value names.[i]
Expr.Coerce(a, typeof<obj>) ])
Expr.NewTuple [ Expr.Value names.[i]; Expr.Coerce(a, typeof<obj>) ])
)

let cultureStr = ctx.CultureStr
Expand Down
3 changes: 1 addition & 2 deletions src/WorldBank/WorldBankProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ type public WorldBankProvider(cfg: TypeProviderConfig) as this =

// ASSUMPTION: Follow www.worldbank.org and only show these sources by default. The others are very sparsely populated.
let defaultSources =
[ "World Development Indicators"
"Global Financial Development" ]
[ "World Development Indicators"; "Global Financial Development" ]

let worldBankType =
createTypesForSources (defaultSources, "WorldBankData", false, false)
Expand Down
8 changes: 1 addition & 7 deletions src/WorldBank/WorldBankRuntime.fs
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,7 @@ module Implementation =
member internal __.GetDataAsync(countryOrRegionCode, indicatorCode) =
async {
let! data =
getData
[ "countries"
countryOrRegionCode
"indicators"
indicatorCode ]
[ "date", "" ]
"date"
getData [ "countries"; countryOrRegionCode; "indicators"; indicatorCode ] [ "date", "" ] "date"

return
seq {
Expand Down
12 changes: 3 additions & 9 deletions src/Xml/XmlGenerator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,7 @@ module internal XmlTypeBuilder =
|> Seq.take attrParameters.Length
|> Seq.toList
|> List.mapi (fun i a ->
Expr.NewTuple
[ Expr.Value attrNames.[i]
Expr.Coerce(a, typeof<obj>) ])
Expr.NewTuple [ Expr.Value attrNames.[i]; Expr.Coerce(a, typeof<obj>) ])
)

let elements =
Expand All @@ -587,16 +585,12 @@ module internal XmlTypeBuilder =
)
|> Seq.toList
|> List.mapi (fun i a ->
Expr.NewTuple
[ Expr.Value childElemNames.[i]
Expr.Coerce(a, typeof<obj>) ])
Expr.NewTuple [ Expr.Value childElemNames.[i]; Expr.Coerce(a, typeof<obj>) ])

let elements =
match primitiveParam with
| Some _ ->
Expr.NewTuple
[ Expr.Value ""
Expr.Coerce(args.[attrParameters.Length], typeof<obj>) ]
Expr.NewTuple [ Expr.Value ""; Expr.Coerce(args.[attrParameters.Length], typeof<obj>) ]
:: elements
| None -> elements

Expand Down

0 comments on commit 3aaade7

Please sign in to comment.