Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let filter (key:string,items:FileSummary seq) =
(getGroupLineCount items) > threshold
summaries
|> Seq.groupBy (fun x->x.RelativePath)
|> (fun group -> if useThresholds then (Seq.filter filter group) else group )
|> (fun group -> if useTakeLimits.IsSome then Seq.take(useTakeLimits.Value) group else group)
|> Seq.map (fun (key,items) -> (key, items |> Seq.sumBy (fun i->i.LineCount) , items))
|> Seq.sortBy (fun (key,l,items)-> -l)
could be something like...
let groupByPaths y = Seq.groupBy (fun x->x.RelativePath) y
let filterByThreshold x = if useThresholds then (Seq.filter filter x) else x
let takeLimitedAmount x = if useTakeLimits.IsSome then Seq.take(useTakeLimits.Value) x else x
let itemsLineCounter x = Seq.map (fun (key,items) -> (key, items |> Seq.sumBy (fun i->i.LineCount) , items))
//...then nice readable line:
summaries |> groupByPaths |> filterByThreshold |> takeLimitedAmount |> itemsLineCounter |> Seq.sortBy (snd |> (-))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment