未验证 提交 cccdfb1d 编写于 作者: D Don Syme 提交者: GitHub

Formatting: test adjusting line length to 140 (#13170)

* adjust line length

* apply formatting
上级 907e4392
root = true
[*.fs]
max_line_length=140
fsharp_newline_between_type_definition_and_members=true
fsharp_max_infix_operator_expression=80
fsharp_max_array_or_list_width=80
......
......@@ -98,9 +98,7 @@ module internal {1} =
XElement(xname "summary", docComment)
.ToString()
.Split([| "\r\n"; "\r"; "\n" |], StringSplitOptions.None)
|> Array.fold
(fun (sb: StringBuilder) line -> sb.AppendLine(" /// " + line))
(StringBuilder())
|> Array.fold (fun (sb: StringBuilder) line -> sb.AppendLine(" /// " + line)) (StringBuilder())
// add the resource
let accessorBody =
match (generateLegacy, generateLiteral) with
......
......@@ -175,12 +175,7 @@ type FSharpEmbedResourceText() =
| 'f' -> AddHole "System.Double"
| 's' -> AddHole "System.String"
| '%' -> sb.Append('%') |> ignore
| c ->
Err(
fileName,
lineNum,
sprintf "'%%%c' is not a valid sequence, only %%d %%x %%X %%f %%s or %%%%" c
)
| c -> Err(fileName, lineNum, sprintf "'%%%c' is not a valid sequence, only %%d %%x %%X %%f %%s or %%%%" c)
i <- i + 2
else
......@@ -219,11 +214,7 @@ type FSharpEmbedResourceText() =
i <- i + 1
// parse short identifier
if i < txt.Length && not (System.Char.IsLetter(txt.[i])) then
Err(
fileName,
lineNum,
sprintf "The first character in the short identifier should be a letter, but found '%c'" txt.[i]
)
Err(fileName, lineNum, sprintf "The first character in the short identifier should be a letter, but found '%c'" txt.[i])
while i < txt.Length && System.Char.IsLetterOrDigit txt.[i] do
identB.Append txt.[i] |> ignore
......@@ -240,11 +231,7 @@ type FSharpEmbedResourceText() =
i <- i + 1
if i = txt.Length then
Err(
fileName,
lineNum,
sprintf "After the identifier '%s' and comma, there should be the quoted string resource" ident
)
Err(fileName, lineNum, sprintf "After the identifier '%s' and comma, there should be the quoted string resource" ident)
else
let str =
try
......@@ -405,13 +392,7 @@ open Printf
&& (File.GetLastWriteTimeUtc(fileName) <= File.GetLastWriteTimeUtc(outXmlFileName))
if condition5 then
printMessage (
sprintf
"Skipping generation of %s and %s from %s since up-to-date"
outFileName
outXmlFileName
fileName
)
printMessage (sprintf "Skipping generation of %s and %s from %s since up-to-date" outFileName outXmlFileName fileName)
Some(fileName, outFileName, outXmlFileName)
else
......@@ -543,9 +524,7 @@ open Printf
printMessage (sprintf "Generating .resx for %s" outFileName)
fprintfn out ""
// gen validation method
fprintfn
out
" /// Call this method once to validate that all known resources are valid; throws if not"
fprintfn out " /// Call this method once to validate that all known resources are valid; throws if not"
fprintfn out " static member RunStartupValidation() ="
......
......@@ -153,12 +153,8 @@ type MapSourceRoots() =
// Since the paths in ItemSpec have backslashes replaced with slashes on non-Windows platforms we need to do the same for ContainingRoot.
match topLevelMappedPaths.TryGetValue(Utilities.FixFilePath(containingRoot)) with
| true, mappedTopLevelPath ->
root.SetMetadata(
MappedPath,
mappedTopLevelPath + ensureEndsWithSlash (nestedRoot.Replace('\\', '/'))
)
| false, _ ->
log.LogError(FSBuild.SR.mapSourceRootsNoSuchTopLevelSourceRoot containingRoot)
root.SetMetadata(MappedPath, mappedTopLevelPath + ensureEndsWithSlash (nestedRoot.Replace('\\', '/')))
| false, _ -> log.LogError(FSBuild.SR.mapSourceRootsNoSuchTopLevelSourceRoot containingRoot)
| NullOrEmpty -> log.LogError(FSBuild.SR.mapSourceRootsNoSuchTopLevelSourceRoot "")
| NullOrEmpty -> ()
else
......
......@@ -96,9 +96,7 @@ module internal ProjectFile =
let fields = line.Split(',')
if fields.Length < 8 then
raise (
InvalidOperationException(sprintf "Internal error - Invalid resolutions file format '%s'" line)
)
raise (InvalidOperationException(sprintf "Internal error - Invalid resolutions file format '%s'" line))
else
{
NugetPackageId = fields[0]
......
......@@ -144,13 +144,7 @@ module internal Utilities =
| None -> -1
let arguments prefix =
sprintf
"%s -restore %s %c%s%c /nologo /t:InteractivePackageManagement"
prefix
binLoggingArguments
'\"'
projectPath
'\"'
sprintf "%s -restore %s %c%s%c /nologo /t:InteractivePackageManagement" prefix binLoggingArguments '\"' projectPath '\"'
let workingDir = Path.GetDirectoryName projectPath
let dotnetHostPath = getDotnetHostPath ()
......
......@@ -58,20 +58,12 @@ module FSharpDependencyManager =
p
seq {
match not (String.IsNullOrEmpty(inc)), not (String.IsNullOrEmpty(ver)), not (String.IsNullOrEmpty(script))
with
| true, true, false ->
yield sprintf @" <ItemGroup><PackageReference Include='%s' Version='%s' /></ItemGroup>" inc ver
match not (String.IsNullOrEmpty(inc)), not (String.IsNullOrEmpty(ver)), not (String.IsNullOrEmpty(script)) with
| true, true, false -> yield sprintf @" <ItemGroup><PackageReference Include='%s' Version='%s' /></ItemGroup>" inc ver
| true, true, true ->
yield
sprintf
@" <ItemGroup><PackageReference Include='%s' Version='%s' Script='%s' /></ItemGroup>"
inc
ver
script
yield sprintf @" <ItemGroup><PackageReference Include='%s' Version='%s' Script='%s' /></ItemGroup>" inc ver script
| true, false, false -> yield sprintf @" <ItemGroup><PackageReference Include='%s' /></ItemGroup>" inc
| true, false, true ->
yield sprintf @" <ItemGroup><PackageReference Include='%s' Script='%s' /></ItemGroup>" inc script
| true, false, true -> yield sprintf @" <ItemGroup><PackageReference Include='%s' Script='%s' /></ItemGroup>" inc script
| _ -> ()
match not (String.IsNullOrEmpty(src)) with
......@@ -188,8 +180,7 @@ module FSharpDependencyManager =
let mutable timeout = None
lines
|> List.choose (fun line ->
parsePackageReferenceOption scriptExt (fun p -> binLogPath <- p) (fun t -> timeout <- t) line)
|> List.choose (fun line -> parsePackageReferenceOption scriptExt (fun p -> binLogPath <- p) (fun t -> timeout <- t) line)
|> List.distinct
|> (fun l -> l, binLogPath, timeout)
......@@ -202,8 +193,7 @@ module FSharpDependencyManager =
match directive with
| "i" -> sprintf "RestoreSources=%s" line
| _ -> line)
|> List.choose (fun line ->
parsePackageReferenceOption scriptExt (fun p -> binLogPath <- p) (fun t -> timeout <- t) line)
|> List.choose (fun line -> parsePackageReferenceOption scriptExt (fun p -> binLogPath <- p) (fun t -> timeout <- t) line)
|> List.distinct
|> (fun l -> l, binLogPath, timeout)
......@@ -391,13 +381,7 @@ type FSharpDependencyManager(outputDirectory: string option) =
let directiveLines = Seq.append packageManagerTextLines configIncludes
let resolutionResult =
prepareDependencyResolutionFiles (
scriptExt,
directiveLines,
targetFrameworkMoniker,
runtimeIdentifier,
timeout
)
prepareDependencyResolutionFiles (scriptExt, directiveLines, targetFrameworkMoniker, runtimeIdentifier, timeout)
match resolutionResult.resolutionsFile with
| Some file ->
......@@ -425,13 +409,6 @@ type FSharpDependencyManager(outputDirectory: string option) =
| None ->
let empty = Seq.empty<string>
ResolveDependenciesResult(
resolutionResult.success,
resolutionResult.stdOut,
resolutionResult.stdErr,
empty,
empty,
empty
)
ResolveDependenciesResult(resolutionResult.success, resolutionResult.stdOut, resolutionResult.stdErr, empty, empty, empty)
generateAndBuildProjectArtifacts :> obj
......@@ -189,9 +189,7 @@ type internal ReadLineConsole() =
if (lastDot < 0) then
None, name, input.Substring(0, start)
else
Some(name.Substring(0, lastDot)),
name.Substring(lastDot + 1),
input.Substring(0, start + lastDot + 1)
Some(name.Substring(0, lastDot)), name.Substring(lastDot + 1), input.Substring(0, start + lastDot + 1)
try
complete (attr, pref)
......
......@@ -232,8 +232,7 @@ let evaluateSession (argv: string[]) =
let fsiTy = fsiAssembly.GetType("FSharp.Compiler.Interactive.Settings")
if isNull fsiAssembly then
failwith
"failed to find type FSharp.Compiler.Interactive.Settings in FSharp.Compiler.Interactive.Settings.dll"
failwith "failed to find type FSharp.Compiler.Interactive.Settings in FSharp.Compiler.Interactive.Settings.dll"
Some(callStaticMethod fsiTy "get_fsi" [])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册