Skip to content

A starter project for the Lines Of Code hack event at Elixir North

Notifications You must be signed in to change notification settings

elixir-north/lines-of-code-hack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lines of Code Hack

Objective

Your objective is to write a module which counts the significant lines of code in a given file or directory. The API is simple Loc.count_file/1 should output the lines of code for a single file while Loc.count_directory(path) should output the lines of code for all files in the directory (recursively).

  • Lines which are solely whitespace (spaces or tabs) should be ignored.
  • Lines which are only comments (starts with #) should be ignored.
  • Non-Elixir files should be ignored (anything without a .ex or .exs extension).
  • Assume that files and directories passed in exist and are fully readable.

Testing your solution

To test your solution manually, use the Loc module in iex like so:

$ iex -S mix
iex> Loc.count_file("foo.ex") # => 10
iex> Loc.count_directory("foo/bar") # => 100

To run the test suite and ensure your solution passes, use the following:

$ mix test

About

A starter project for the Lines Of Code hack event at Elixir North

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages