QAP 1 - Password Generator
Objective
Create a Command-Line Interface (CLI) application in Node.js that generates passwords for users based on arguments they provide via flags.
Due Date: May 15th, 2025, at 11:59 PM
Getting Started
To help you get started, a base repository has been provided for you to work from. The repository is set up as a GitHub Assignment to help you quickly get started.
Steps to Create Your Own Repository
Click the link above and select your name on the list that appears, if you haven’t already.
Click the “Accept this assignment” button.
Once your repository is created, clone your new repo to your local machine:
git clone <your-new-repo-url>
Navigate into the project directory and install the necessary dependencies:
cd <your-new-repo-name> npm install
Run the app from the command line:
node passwordGenerator.js [flags]
Replace
[flags]
with any supported flags like--length
,--numbers
, etc.Run tests:
npm test
This will run the unit tests for the application.
By using this template, you’ll have the project structure and initial setup ready to go so you can focus on building the functionality.
Note: This code has been provided as a starting point for you to work from. It is by no means a completed QAP.
Requirements
Functionality
- Basic Features:
- Support the following command-line flags:
--help
: displays a help message explaining how to use the application and its flags. This flag is required to be implemented.--length <number>
: specifies the length of the password.--lowercase
: include lowercase letters in the password.--numbers
: include numbers in the password.
- If no
--length
flag is provided, default the password length to 8. - If neither
--lowercase
nor--numbers
is provided, default to including lowercase letters. - If no character types are selected (for example, if
--lowercase
is explicitly disabled and--numbers
is not provided), the program should throw an error. - The application should handle invalid input gracefully, displaying an informative error message rather than crashing.
- Support the following command-line flags:
Testing
- Write a complete set of unit tests for the
generatePassword
function. - Tests must be developed on a separate branch and merged into the
main
branch using a GitHub pull request. - Tests must cover different input scenarios and verify that the function behaves as expected.
- All tests must pass before submission.
Code Quality
- Maintain clear and consistent code style.
- Ensure proper error handling.
Git Hygiene
- Regularly commit changes with meaningful messages.
- Do not commit unnecessary files such as
node_modules
or temporary files.
Extra Files
- Your project must include:
README.md
explaining:- The purpose of the application.
- How to use it.
- How to run the tests.
Submission Guidelines
- Ensure all code runs correctly and meets the requirements.
- Submissions should be made on Teams under the appropriate assignment.
- Submissions should only include a link to your GitHub repository containing the completed code for your QAP.
- Submissions are subject to the Keyin late assessment policy found here
- If an extension is required, please contact me directly before the due date.
Grading Rubric
Category | Criteria | Points |
---|---|---|
Functionality | 45 | |
Help Flag | Implements --help flag that displays usage instructions. | 5 |
Password Length Flag | Allows user to specify password length and applies it correctly. | 10 |
Default Length Behavior | Defaults to 8 when no length is provided. | 5 |
Default Character Behavior | Defaults to lowercase when no character flags are provided. | 5 |
Invalid Input Handling | Handles invalid input with clear error messages. | 5 |
Character Flags | Correctly implements --lowercase and --numbers flags. | 15 |
Testing | 20 | |
Test Coverage | Adequate tests written for generatePassword covering different scenarios. | 15 |
All Tests Passing | All tests pass successfully. | 5 |
Git Hygiene | 15 | |
Branching and Pull Request | Tests developed on a separate branch and merged via pull request. | 5 |
Commit Frequency and Quality | Regular commits with descriptive messages. | 5 |
No Unnecessary Files | No unnecessary files (e.g., node_modules ) committed. | 5 |
Code Quality | 10 | |
Readability and Structure | Code is well-organized, follows a clear structure, and uses appropriate style. | 10 |
Project Structure | 5 | |
README.md | Includes clear description, usage instructions, and test instructions. | 5 |
Total Points | 100 |
Good luck! If you have any questions, please don’t hesitiate to ask!