├── .eslintignore ├── .gitignore ├── .eslintrc.json ├── circle.yml ├── lib └── daysOfTheWeek.js ├── package.json ├── README.md ├── tests └── daysOfTheWeek.js ├── CONTRIBUTING.md └── LICENSE.md /.eslintignore: -------------------------------------------------------------------------------- 1 | documentation/* 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .nyc_output 3 | coverage 4 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "airbnb-base", 3 | "rules": { 4 | "comma-dangle": [1, "never"], 5 | "max-len": 0, 6 | "no-restricted-syntax": [ 7 | "error", 8 | "LabeledStatement", 9 | "WithStatement" 10 | ] 11 | }, 12 | "env": { 13 | "node": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | node: 3 | version: 6.11.0 4 | dependencies: 5 | post: 6 | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter 7 | - chmod +x ./cc-test-reporter 8 | test: 9 | pre: 10 | - ./cc-test-reporter before-build 11 | override: 12 | - npm test -- --coverage-report=lcov; ./cc-test-reporter after-build --exit-code $? 13 | -------------------------------------------------------------------------------- /lib/daysOfTheWeek.js: -------------------------------------------------------------------------------- 1 | module.exports.getDayName = (date) => { 2 | if (Object.prototype.toString.call(date) !== '[object Date]' && Number.isNaN(Number(date))) { 3 | throw new Error('Date argument must be a Date object or a Javascript epoch timestamp'); 4 | } else if (Array.isArray(date) || date === null || date === true || date === false) { 5 | throw new Error('Date argument must be a Date object or a Javascript epoch timestamp'); 6 | } 7 | 8 | const passedDate = new Date(date); 9 | 10 | return ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][passedDate.getDay()]; 11 | }; 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "code-review-demo", 3 | "version": "1.0.0", 4 | "description": "A project just to demo how a code review might go down", 5 | "main": "index.js", 6 | "scripts": { 7 | "lint": "eslint --fix 'lib/**/*.js' 'tests/**/*.js'", 8 | "test": "tap 'tests/**/*.js' --cov" 9 | }, 10 | "author": { 11 | "name": "Greg Walker", 12 | "email": "michael.walker@gsa.gov" 13 | }, 14 | "license": "CC0-1.0", 15 | "dependencies": { 16 | "eslint": "^3.19.0", 17 | "eslint-config-airbnb-base": "^11.2.0", 18 | "eslint-plugin-import": "^2.6.0", 19 | "tap": "^10.5.2" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![CircleCI](https://circleci.com/gh/18F/acq-code-review-demo/tree/master.svg?style=svg)](https://circleci.com/gh/18F/acq-code-review-demo/tree/master) 2 | [![Code Climate](https://codeclimate.com/github/18F/acq-code-review-demo/badges/gpa.svg)](https://codeclimate.com/github/18F/acq-code-review-demo) 3 | [![Test Coverage](https://codeclimate.com/github/18F/acq-code-review-demo/badges/coverage.svg)](https://codeclimate.com/github/18F/acq-code-review-demo) 4 | 5 | # code-review-demo 6 | 7 | A Slack bot to streamline team standup without disturbing the overall flow of conversation. 8 | 9 | ## Public domain 10 | 11 | This project is in the worldwide [public domain](LICENSE.md). As stated in [CONTRIBUTING](CONTRIBUTING.md): 12 | 13 | > This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/). 14 | > 15 | > All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest. 16 | -------------------------------------------------------------------------------- /tests/daysOfTheWeek.js: -------------------------------------------------------------------------------- 1 | const tap = require('tap'); 2 | const target = require('../lib/daysOfTheWeek'); 3 | 4 | tap.test('getDayName', (getDayNameTest) => { 5 | getDayNameTest.throws(() => target.getDayName(), 'throws when using no input'); 6 | getDayNameTest.throws(() => target.getDayName(null), 'throws when using a null input'); 7 | getDayNameTest.throws(() => target.getDayName(undefined), 'throws when using an undefined input'); 8 | getDayNameTest.throws(() => target.getDayName('string'), 'throws when using a string input'); 9 | getDayNameTest.throws(() => target.getDayName([]), 'throws when using an array input'); 10 | getDayNameTest.throws(() => target.getDayName({}), 'throws when using an object input'); 11 | getDayNameTest.throws(() => target.getDayName(true), 'throws when using a boolean input'); 12 | 13 | // Javascript months start at 0, so month 5 is actually June. 14 | const validDateObject = new Date(2017, 5, 23); 15 | const validDateValue = validDateObject.getTime(); 16 | getDayNameTest.equal(target.getDayName(validDateValue), 'Friday', 'get expected day name when using a Date timestamp'); 17 | getDayNameTest.equal(target.getDayName(validDateObject), 'Friday', 'get expected day name when using a Date object'); 18 | getDayNameTest.end(); 19 | }); 20 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Welcome! 2 | 3 | We're so glad you're thinking about contributing to an 18F open source project! If you're unsure about anything, just ask -- or submit the issue or pull request anyway. The worst that can happen is you'll be politely asked to change something. We love all friendly contributions. 4 | 5 | We want to ensure a welcoming environment for all of our projects. Our staff follow the [18F Code of Conduct](https://github.com/18F/code-of-conduct/blob/master/code-of-conduct.md) and all contributors should do the same. 6 | 7 | We encourage you to read this project's CONTRIBUTING policy (you are here), its [LICENSE](LICENSE.md), and its [README](README.md). 8 | 9 | If you have any questions or want to read more, check out the [18F Open Source Policy GitHub repository]( https://github.com/18f/open-source-policy), or just [shoot us an email](mailto:18f@gsa.gov). 10 | 11 | ## Public domain 12 | 13 | This project is in the public domain within the United States, and 14 | copyright and related rights in the work worldwide are waived through 15 | the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/). 16 | 17 | All contributions to this project will be released under the CC0 18 | dedication. By submitting a pull request, you are agreeing to comply 19 | with this waiver of copyright interest. 20 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | As a work of the United States Government, this project is in the 2 | public domain within the United States. 3 | 4 | Additionally, we waive copyright and related rights in the work 5 | worldwide through the CC0 1.0 Universal public domain dedication. 6 | 7 | ## CC0 1.0 Universal Summary 8 | 9 | This is a human-readable summary of the [Legal Code (read the full text)](https://creativecommons.org/publicdomain/zero/1.0/legalcode). 10 | 11 | ### No Copyright 12 | 13 | The person who associated a work with this deed has dedicated the work to 14 | the public domain by waiving all of his or her rights to the work worldwide 15 | under copyright law, including all related and neighboring rights, to the 16 | extent allowed by law. 17 | 18 | You can copy, modify, distribute and perform the work, even for commercial 19 | purposes, all without asking permission. 20 | 21 | ### Other Information 22 | 23 | In no way are the patent or trademark rights of any person affected by CC0, 24 | nor are the rights that other persons may have in the work or in how the 25 | work is used, such as publicity or privacy rights. 26 | 27 | Unless expressly stated otherwise, the person who associated a work with 28 | this deed makes no warranties about the work, and disclaims liability for 29 | all uses of the work, to the fullest extent permitted by applicable law. 30 | When using or citing the work, you should not imply endorsement by the 31 | author or the affirmer. 32 | --------------------------------------------------------------------------------