Git Product home page Git Product logo

capitalone's Introduction

Coding Challenge for Capital One (1.0.0)

Summary of Challenge

Create a program that takes a file as input and returns several statements about the program's comments: how many, what types, how many TODOs, etc. I created my solution in Java. The main code can be found in Solution.java. The test suite can be found in SolutionTest.java.

After creating a JAR file, this program can be run in any folder by typing

java -jar path/to/jar.jar

It will then wait for input. Please enter a relative or absolute path to the file you want to analyse.

Statistics such as the following will then be printed to the console:

Total # of lines: 52
Total # of comment lines: 5
Total # of single line comments: 2
Total # of comment lines within block comments: 3
Total # of block line comments: 1
Total # of TODO’s: 0

Assumptions I Made In This Task

  1. Lines that contain multiple TODO would be considered as one TODO. E.g.
// TODO: Write up all the TODOs we have to complete this week
  1. Multiline comments that appear next to code count as single line comments. For example
code() // comment about code
moreCode() // comment about more code

or

hello() # comment
# other comment

Will each count as 2 comments, not one block comment

Known specifications and limitations

This program does not handle comments in languages such as Scheme, that use ;; for their comment schemes.

This program counts lines such as

System.out.println("// A comment");

as comments at the given time.

After submitting this challenge, I learned by chance that Python also recently started to support ''' ''' as syntax for multiline comments. This is not implemented in my solution at this time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.