Skip to content

Instantly share code, notes, and snippets.

@JimmyHoffa
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JimmyHoffa/b4fd667b30249008fa6c to your computer and use it in GitHub Desktop.
Save JimmyHoffa/b4fd667b30249008fa6c to your computer and use it in GitHub Desktop.
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