diff --git a/lib/.env.defaults b/.env.defaults similarity index 58% rename from lib/.env.defaults rename to .env.defaults index bc78b17..31cc783 100644 --- a/lib/.env.defaults +++ b/.env.defaults @@ -10,9 +10,19 @@ # ENV VARS defaults for readme-inspector: +# ReadmeAppraisal +API_ENDPOINT_README_SCORE="http://readme-score-api.herokuapp.com/score.json?url=&human_breakdown=false&force=false" + +# Bitbucket REST API v1.0 and v2.0 base url. Modify this if you're using +# on-premise, company-hosted Bitbucket servers. +BITBUCKET_API_BASE_URL="https://api.bitbucket.org" + ## Google Analytics trackingCode GA_README_INSPECTOR="UA-117338111-1" -# ReadmeAppraisal -API_ENDPOINT_README_SCORE="http://readme-score-api.herokuapp.com/score.json?url=&human_breakdown=false&force=false" +# GitHub REST API v3 baseUrl. Modify this if you're using GitHub Enterprise. +GITHUB_API_BASE_URL="https://api.github.com" +# readme-score-api base url. Modify this if you're using it +# behind a company firewall. +README_SCORE_API_BASE_URL="http://readme-score-api.herokuapp.com" diff --git a/lib/.env.schema b/.env.schema similarity index 80% rename from lib/.env.schema rename to .env.schema index 6d5c177..073f51f 100644 --- a/lib/.env.schema +++ b/.env.schema @@ -14,8 +14,12 @@ # 🔹 OPTIONAL env vars: API_ENDPOINT_README_SCORE= +BITBUCKET_API_BASE_URL= GA_README_INSPECTOR= +GITHUB_API_BASE_URL= +README_SCORE_API_BASE_URL= -# 🔸 RECOMMENDED vars (to extend GitHub API rate limits) +# 🔸 RECOMMENDED vars (to extend API rate limits) +BITBUCKET_ACCESS_TOKEN= GH_TOKEN= GITHUB_ACCESS_TOKEN= diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6b4b6ce..1b7db42 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,27 +2,10 @@ [![PRs Welcome][makeapullrequest-image]][makeapullrequest-url] We welcome contributors, issues, and pull requests. -
-Contributions start with community conversations that lead to positive change. readme-inspector's open source collaboration model has five steps: - -
-
1. Issues
-
Start community conversations that determine whether proposed changes add value and should be made.
-
2. Pull Requests (PRs)
-
Inform and manage community code reviews for approved changes in-progress.
-
3. Merges
-
Incorporate approved PR changes into the product.
-
4. Releases
-
Make changes available for community consumption.
-
5. Support
-
Improves the product with refactorings and defect fixes.
-
-
- ## Table of contents -- [1. Issues](#1-issues) +- [1. Contributions: a brief "how-to"](#1-contributions-a-brief-how-to) * [1.1. Create Issues for feature requests and defects.](#11-create-issues-for-feature-requests-and-defects) * [1.2. Format titles with **`type(scope): subject`**.](#12-format-titles-with-typescope-subject) * [1.3. Fill out the issue template.](#13-fill-out-the-issue-template) @@ -72,7 +55,24 @@ - [9. **Licensing**](#9-licensing) -## 1. Issues +## 1. Contributions: a brief "how-to" + +
+Contributions start with community conversations that lead to positive change. readme-inspector's open source collaboration model has five steps: + +
+
1. Issues
+
Start community conversations that determine whether proposed changes add value and should be made.
+
2. Pull Requests (PRs)
+
Inform and manage community code reviews for approved changes in-progress.
+
3. Merges
+
Incorporate approved PR changes into the product.
+
4. Releases
+
Make changes available for community consumption.
+
5. Support
+
Improves the product with refactorings and defect fixes.
+
+
issues @@ -1015,10 +1015,10 @@ Make sure you use resources that you have the rights to use. If you use librarie [icon-issue-image]: ./assets/img/icons8/icon-issues.png [icon-pr-image]: ./assets/img/icons8/icon-pr.png [icon-rest-api-image]: ./assets/img/icons8/icon-rest-api.png -[issues-new-defect-image]: https://img.shields.io/badge/report---defect---lightgrey.svg?style=for-the-badge&label=report+a +[issues-new-defect-image]: https://img.shields.io/badge/report-defect-F5CB5C.svg?style=for-the-badge&label=report+a [issues-new-defect-url]: /commonality/readme-inspector.git/issues/new?title=defect%28scope%29%3A+summary-of-change&labels=priority%3A+medium%2Cstatus%3A+review+needed%2Ctype%3A+defect&body=%2A%2A%F0%9F%92%A1+TIP%3A%2A%2A+Select+the+%E2%86%96%EF%B8%8E%E2%8E%BE+Preview+%E2%8F%8B+Tab+above+help+read+these+instructions.%0D%0A%0D%0A%23%23+1.+Issue+type%0D%0A%3E%E2%8C%A6+Type+the+letter+%22x%22+in+the+%22checkbox%22+the+best+describe+this+issue.%0D%0A%0D%0A-+%5Bx%5D+**Feature%3A**+I%27m+requesting+a+product+enhancement.%0D%0A%0D%0A%23%23+2.+User+story+summary%0D%0A%3E%E2%8C%A6+Describe+what+you+want+to+accomplish%2C+in+what+role%2Fcapacity%2C+and+why+it%27s+important+to+you.%0D%0A%0D%0A%3E+**EXAMPLE%3A**%0D%0A%3E+As+a+Applicant%2C%0D%0A%3E+I+want+to+submit+my+resume%0D%0A%3E+In+order+to+be+considered+for+a+job+opening.%0D%0A%0D%0AAs+a+%7Brole%7D%2C%0D%0AI+must%2Fneed%2Fwant%2Fshould+%7Bdo+something%7D%0D%0AIn+order+to+%7Bachieve+value%7D.%0D%0A%0D%0A%23%23+3.+Acceptance+criteria%0D%0A%3E%E2%8C%A6+Replace+the+examples+below+with+your+own+imperative%2C+%22true%2Ffalse%22+statements+for+the+**behavior+you+expect**+to+see%2C+or+the+behavior+that+**would**+be+true+if+there+were+no+errors+%28for+defects%29.%0D%0A%0D%0A-+%5B+%5D+1.+Job+Applicants+receive+a+confirmation+email+after+they+submit+their+resumes.%0D%0A-+%5B+%5D+2.+An+Applicant%27s+resume+information+isn%27t+lost+when+errors+occur.%0D%0A-+%5B+%5D+3.+%7Bcriterion-three%7D%0D%0A-+%5B+%5D+4.+%7Bcriterion-four%7D%0D%0A%0D%0A%3C%21--+%E2%9B%94%EF%B8%8F++Do+not+remove+anything+below+this+comment.+%E2%9B%94%EF%B8%8F++--%3E%0D%0A%5Bicon-info-image%5D%3A+..%2Fdocs%2Fimg%2Ficons8%2Ficon-info-50.png%0D%0A [issues-new-defect-url]: https://github.com/commonality/readme-inspector/issues/new?title=defect%28scope%29%3A+summary-of-problem&labels=priority%3A+medium%2Cstatus%3A+review+needed%2Ctype%3A+defect&body=%2A%2A%F0%9F%92%A1+TIP%3A%2A%2A+Select+the+%E2%86%96%EF%B8%8E%E2%8E%BE+Preview+%E2%8F%8B+Tab+above+help+read+these+instructions.%0D%0A%0D%0A%23%23+1.+Issue+type%0D%0A%3E%E2%8C%A6+Type+the+letter+%22x%22+in+the+%22checkbox%22+the+best+describe+this+issue.%0D%0A%0D%0A-+%5Bx%5D+**Feature%3A**+I%27m+requesting+a+product+enhancement.%0D%0A%0D%0A%23%23+2.+User+story+summary%0D%0A%3E%E2%8C%A6+Describe+what+you+want+to+accomplish%2C+in+what+role%2Fcapacity%2C+and+why+it%27s+important+to+you.%0D%0A%0D%0A%3E+**EXAMPLE%3A**%0D%0A%3E+As+a+Applicant%2C%0D%0A%3E+I+want+to+submit+my+resume%0D%0A%3E+In+order+to+be+considered+for+a+job+opening.%0D%0A%0D%0AAs+a+%7Brole%7D%2C%0D%0AI+must%2Fneed%2Fwant%2Fshould+%7Bdo+something%7D%0D%0AIn+order+to+%7Bachieve+value%7D.%0D%0A%0D%0A%23%23+3.+Acceptance+criteria%0D%0A%3E%E2%8C%A6+Replace+the+examples+below+with+your+own+imperative%2C+%22true%2Ffalse%22+statements+for+the+**behavior+you+expect**+to+see%2C+or+the+behavior+that+**would**+be+true+if+there+were+no+errors+%28for+defects%29.%0D%0A%0D%0A-+%5B+%5D+1.+Job+Applicants+receive+a+confirmation+email+after+they+submit+their+resumes.%0D%0A-+%5B+%5D+2.+An+Applicant%27s+resume+information+isn%27t+lost+when+errors+occur.%0D%0A-+%5B+%5D+3.+%7Bcriterion-three%7D%0D%0A-+%5B+%5D+4.+%7Bcriterion-four%7D%0D%0A%0D%0A%3C%21--+%E2%9B%94%EF%B8%8F++Do+not+remove+anything+below+this+comment.+%E2%9B%94%EF%B8%8F++--%3E%0D%0A%5Bicon-info-image%5D%3A+..%2Fdocs%2Fimg%2Ficons8%2Ficon-info-50.png%0D%0A -[issues-new-feat-image]: https://img.shields.io/badge/request---feature---blue.svg?style=for-the-badge&label=request+a +[issues-new-feat-image]: https://img.shields.io/badge/request-feature-c1ccc6.svg?style=for-the-badge&label=request+a [issues-new-feat-url]: /commonality/readme-inspector.git/issues/new?title=feat%28scope%29%3A+summary-of-change&labels=priority%3A+medium%2Cstatus%3A+review+needed%2Ctype%3A+feature&body=%2A%2A%F0%9F%92%A1+TIP%3A%2A%2A+Select+the+%E2%86%96%EF%B8%8E%E2%8E%BE+Preview+%E2%8F%8B+Tab+above+help+read+these+instructions.%0D%0A%0D%0A%23%23+1.+Issue+type%0D%0A%3E%E2%8C%A6+Type+the+letter+%22x%22+in+the+%22checkbox%22+the+best+describe+this+issue.%0D%0A%0D%0A-+%5Bx%5D+**Feature%3A**+I%27m+requesting+a+product+enhancement.%0D%0A%0D%0A%23%23+2.+User+story+summary%0D%0A%3E%E2%8C%A6+Describe+what+you+want+to+accomplish%2C+in+what+role%2Fcapacity%2C+and+why+it%27s+important+to+you.%0D%0A%0D%0A%3E+**EXAMPLE%3A**%0D%0A%3E+As+a+Applicant%2C%0D%0A%3E+I+want+to+submit+my+resume%0D%0A%3E+In+order+to+be+considered+for+a+job+opening.%0D%0A%0D%0AAs+a+%7Brole%7D%2C%0D%0AI+must%2Fneed%2Fwant%2Fshould+%7Bdo+something%7D%0D%0AIn+order+to+%7Bachieve+value%7D.%0D%0A%0D%0A%23%23+3.+Acceptance+criteria%0D%0A%3E%E2%8C%A6+Replace+the+examples+below+with+your+own+imperative%2C+%22true%2Ffalse%22+statements+for+the+**behavior+you+expect**+to+see%2C+or+the+behavior+that+**would**+be+true+if+there+were+no+errors+%28for+defects%29.%0D%0A%0D%0A-+%5B+%5D+1.+Job+Applicants+receive+a+confirmation+email+after+they+submit+their+resumes.%0D%0A-+%5B+%5D+2.+An+Applicant%27s+resume+information+isn%27t+lost+when+errors+occur.%0D%0A-+%5B+%5D+3.+%7Bcriterion-three%7D%0D%0A-+%5B+%5D+4.+%7Bcriterion-four%7D%0D%0A%0D%0A%3C%21--+%E2%9B%94%EF%B8%8F++Do+not+remove+anything+below+this+comment.+%E2%9B%94%EF%B8%8F++--%3E%0D%0A%5Bicon-info-image%5D%3A+..%2Fdocs%2Fimg%2Ficons8%2Ficon-info-50.png%0D%0A [issues-new-feat-url]: https://github.com/commonality/readme-inspector/issues/new?title=feat%28scope%29%3A+summary-of-change&labels=priority%3A+medium%2Cstatus%3A+review+needed%2Ctype%3A+feature&body=%2A%2A%F0%9F%92%A1+TIP%3A%2A%2A+Select+the+%E2%86%96%EF%B8%8E%E2%8E%BE+Preview+%E2%8F%8B+Tab+above+help+read+these+instructions.%0D%0A%0D%0A%23%23+1.+Issue+type%0D%0A%3E%E2%8C%A6+Type+the+letter+%22x%22+in+the+%22checkbox%22+the+best+describe+this+issue.%0D%0A%0D%0A-+%5Bx%5D+**Feature%3A**+I%27m+requesting+a+product+enhancement.%0D%0A%0D%0A%23%23+2.+User+story+summary%0D%0A%3E%E2%8C%A6+Describe+what+you+want+to+accomplish%2C+in+what+role%2Fcapacity%2C+and+why+it%27s+important+to+you.%0D%0A%0D%0A%3E+**EXAMPLE%3A**%0D%0A%3E+As+a+Applicant%2C%0D%0A%3E+I+want+to+submit+my+resume%0D%0A%3E+In+order+to+be+considered+for+a+job+opening.%0D%0A%0D%0AAs+a+%7Brole%7D%2C%0D%0AI+must%2Fneed%2Fwant%2Fshould+%7Bdo+something%7D%0D%0AIn+order+to+%7Bachieve+value%7D.%0D%0A%0D%0A%23%23+3.+Acceptance+criteria%0D%0A%3E%E2%8C%A6+Replace+the+examples+below+with+your+own+imperative%2C+%22true%2Ffalse%22+statements+for+the+**behavior+you+expect**+to+see%2C+or+the+behavior+that+**would**+be+true+if+there+were+no+errors+%28for+defects%29.%0D%0A%0D%0A-+%5B+%5D+1.+Job+Applicants+receive+a+confirmation+email+after+they+submit+their+resumes.%0D%0A-+%5B+%5D+2.+An+Applicant%27s+resume+information+isn%27t+lost+when+errors+occur.%0D%0A-+%5B+%5D+3.+%7Bcriterion-three%7D%0D%0A-+%5B+%5D+4.+%7Bcriterion-four%7D%0D%0A%0D%0A%3C%21--+%E2%9B%94%EF%B8%8F++Do+not+remove+anything+below+this+comment.+%E2%9B%94%EF%B8%8F++--%3E%0D%0A%5Bicon-info-image%5D%3A+..%2Fdocs%2Fimg%2Ficons8%2Ficon-info-50.png%0D%0A [issues-url]: /commonality/readme-inspector/issues diff --git a/README.md b/README.md index b1e52e4..a23b0d2 100644 --- a/README.md +++ b/README.md @@ -92,8 +92,8 @@ GITHUB_ACCESS_TOKEN= Defines a schema of what variables should be defined in the combination of .env and .env.defaults. - - + + ```properties # .env.schema, committed to repo @@ -111,9 +111,13 @@ Defines a schema of what variables should be defined in the combination of # 🔹 OPTIONAL env vars: API_ENDPOINT_README_SCORE= +BITBUCKET_API_BASE_URL= GA_README_INSPECTOR= +GITHUB_API_BASE_URL= +README_SCORE_API_BASE_URL= -# 🔸 RECOMMENDED vars (to extend GitHub API rate limits) +# 🔸 RECOMMENDED vars (to extend API rate limits) +BITBUCKET_ACCESS_TOKEN= GH_TOKEN= GITHUB_ACCESS_TOKEN= ``` @@ -128,8 +132,8 @@ configuration values that would be common across environments. The file is loaded and will overwrite any values from the .env.defaults file. - - + + ```properties # .env.defaults, committed to repo @@ -143,11 +147,22 @@ file. # ENV VARS defaults for readme-inspector: +# ReadmeAppraisal +API_ENDPOINT_README_SCORE="http://readme-score-api.herokuapp.com/score.json?url=&human_breakdown=false&force=false" + +# Bitbucket REST API v1.0 and v2.0 base url. Modify this if you're using +# on-premise, company-hosted Bitbucket servers. +BITBUCKET_API_BASE_URL="https://api.bitbucket.org" + ## Google Analytics trackingCode GA_README_INSPECTOR="UA-117338111-1" -# ReadmeAppraisal -API_ENDPOINT_README_SCORE="http://readme-score-api.herokuapp.com/score.json?url=&human_breakdown=false&force=false" +# GitHub REST API v3 baseUrl. Modify this if you're using GitHub Enterprise. +GITHUB_API_BASE_URL="https://api.github.com" + +# readme-score-api base url. Modify this if you're using it +# behind a company firewall. +README_SCORE_API_BASE_URL="http://readme-score-api.herokuapp.com" ``` @@ -158,13 +173,17 @@ This file will have sensitive information such as usernames, passwords, api keys, etc. These would be specific to each environment and **should not be committed to source control**. - - + + ```properties API_ENDPOINT_README_SCORE="http://readme-score-api.herokuapp.com/score.json?url=&human_breakdown=false&force=false" -GA_README_INSPECTOR="UA-117338111-1" -GH_TOKEN=$GH_TOKEN -GITHUB_ACCESS_TOKEN=$GH_TOKEN +# BITBUCKET_ACCESS_TOKEN= +# BITBUCKET_API_BASE_URL= +# GA_README_INSPECTOR="UA-117338111-1" +GH_TOKEN=$(echo $GH_TOKEN) +GITHUB_ACCESS_TOKEN=$(echo $GH_TOKEN) +# GITHUB_API_BASE_URL= +# README_SCORE_API_BASE_URL= ``` @@ -254,7 +273,7 @@ console.log(JSON.stringify(results, null, WHITESPACE)) > [![beaker][octicon-beaker] Test `readme-inspector` in your Web browser ![link-external][octicon-link-external]][runkit-readme-inspector-url]. > -> [![gear][octicon-gear] View the full API docs for details](docs/readme-inspector/1.0.2/ReadmeAppraisal.html). +> [![gear][octicon-gear] View the full API docs for details ![link-external][octicon-link-external]][api-docs-url]. The `readmeInspector` module detects whether or not a README document exists at the root of a GitHub or GitHub Enterprise repository. If a README exists, it can evaluate the README's quality and provide a numerical score from 0 to 100, where 0 is the lowest quality and 100 is the highest. @@ -265,15 +284,19 @@ The `readmeInspector` module detects whether or not a README document exists at > 1. If you can see the information by visiting the site without being logged in, you don't have to be authenticated to retrieve the same information through the API. > 1. If you want to change data, you have to be authenticated. > +> Note: authenticate is synchronous because it only sets the credentials for the following requests. +> > octokit/rest.js. (2018). GitHub. Retrieved 21 March 2018, from ![link-external][octicon-link-external] #### 3.1.1. Parameters -| Name | Type | Description | Notes | -| :---- | :----- | :--------------------------------------------------------------- | :---- | -| key | String | | | -| token | String | | | -| type | Enum | `basic`, `oauth`, `oauth-key-secret`, `token`, and `integration` | | +| Name | Type | Description | +| :------- | :------------ | :------------------------------------------ | +| key | String | `type=oauth` Client identifier | +| token | String | `type=[integration|token]` Unique value | +| type | Enum. | `basic`, `oauth`, `token`, or `integration` | +| username | String | `type=basic` Basic authentication username | +| password | String | `type=basic` Basic authentication password | #### 3.1.2. Returns `void` @@ -630,6 +653,7 @@ Before embarking on a significant change, please follow these guidelines: +[api-docs-url]: https://commonality.github.io/readme-inspector/api/readme-inspector/2.0.0/ReadmeAppraisal.html [bunyan-format-url]: https://github.com/thlorenz/bunyan-format/#readme [node-bunyan-url]: https://github.com/trentm/node-bunyan/#readme [optional-param-img]: https://fakeimg.pl/60x22/757575/FFF/?text=optional&font_size=16 diff --git a/docs/README.md b/docs/README.md index 84d4378..2831440 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,28 +1,59 @@ -# readme-inspector product development and delivery +# Product development, delivery, and governance > Rules, guidelines, a governance for developing, fixing, maintaining, and delivering readme-inspector. +[![The MIT License][license-image]][license-url] +[![FOSSA Status][fossa-image]][fossa-url] +[![NSP Status][nsp-image]][nsp-url] +[![Known Vulnerabilities][vulnerabilities-image]][vulnerabilities-url]
+[![Dependency Status][daviddm-image]][daviddm-url] +[![Development Dependency Status][daviddm-dev-image]][daviddm-dev-url]
+[![MacOS and Ubuntu build statuses][travis-image]][travis-url] +[![Windows build status][appveyor-image]][appveyor-url] +[![Coverage percentage][codacy-coverage-image]][codacy-url] +[![Codacy code quality][codacy-image]][codacy-url] +![Maintenance][maintenance-image]
+[![NPMS score][npms-image]][npms-url] +[![NPM downloads per month][npm-downloads-month]][npm-url] + ## Table of contents +- [Project dashboard](#project-dashboard) - [API reference](#api-reference) -- [Development](#development) -- [Delivery](#delivery) +- [Designing REST APIs](#designing-rest-apis) +- [Development and testing](#development-and-testing) +- [Continuous delivery](#continuous-delivery) - [Maintenance](#maintenance) - [Governance](#governance) +## Project dashboard + +> dashboard Community activity and engagement, as well as project health. + +| Measure | Status/info | +| :-------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Community engagement | [![contributor-count][contributor-count-image]][contributor-count-url]
[![author][author-image]][author-url]
![commits-per-year][commit-activity-one-year-image]
[![last-commit][commit-last-image]][commit-last-url]
[![NPM downloads per month][npm-downloads-month]][npm-url]
[![used-by][used-by-image]][used-by-url]
[![github-forks][github-forks-image]][github-forks-url]
[![github-stars][github-stars-image]][github-stars-url]
[![github-watchers][github-watchers-image]][github-watchers-url] | +| Issues | [![issue-opened][octicon-issue-opened] ![issues-open][issues-open-image]][issues-open-url]
[![megaphone][octicon-megaphone] ![breaking-change-issues-open][issues-open-breaking-change-image]][issues-open-breaking-change-url]
[![bell][octicon-bell] ![feature-issues-open][issues-open-feature-image]][issues-open-url]
[![bug][octicon-bug] ![defect-issues-open][issues-open-defect-image]][issues-open-url]
[![issue-closed][octicon-issue-closed] ![issues-closed][issues-closed-image]][issues-closed-url] | +| Pull requests and merges | [![prs-open][octicon-git-pull-request] ![pull-requests-open][pull-requests-open-image]][pull-requests-open-url]
[![git-merge][octicon-git-merge] ![pull-requests-closed][pull-requests-closed-image]][pull-requests-closed-url] | +| Product releases, maintenance, and size | [![last-release-date][release-date-image]][releases-url]
![maintenance][maintenance-image]
![code-size-in-bytes][code-size-bytes-image]
![repository-size][repo-size-bytes-image]
| + ## API reference -[![book][octicon-book] JSDocs](api/readme-inspector/2.0.0/index.html) for readme-inspector. +> gear [View `readme-inspector`'s JSDocs][api-jsdocs-url]. + +## Designing REST APIs + +> radio-tower [View `readme-inspector`'s REST APIs](project/API.md). -## Development +## Development and testing -[![tools][octicon-tools] Guidelines for developing, buidling, and testing](project/DEVELOPERS.md) readme-inspector. +> beaker [Guidelines for developing, building, and testing](project/DEVELOPERS.md) `readme-inspector`. -## Delivery +## Continuous delivery -> package Instructions coming in the next patch or feature release. +> squirrel Instructions coming in the next patch or feature release. ## Maintenance @@ -32,7 +63,85 @@ > organization Information coming in the next patch or feature release. - + + +[api-jsdocs-url]: https://commonality.github.io/readme-inspector/api/readme-inspector/2.0.0/module-readme-inspector.html + + + +[appveyor-image]: https://img.shields.io/appveyor/ci/gregswindle/readme-inspector.svg?style=flat-square&logo=appveyor&label=windows%20build +[appveyor-url]: https://ci.appveyor.com/project/gregswindle/readme-inspector +[codacy-coverage-image]: https://img.shields.io/codacy/coverage/21f517a2d5bf4304895f40c5cbb596c4.svg?style=flat-square +[codacy-image]: https://img.shields.io/codacy/grade/21f517a2d5bf4304895f40c5cbb596c4.svg?style=flat-square +[codacy-url]: https://www.codacy.com/app/greg_7/readme-inspector?utm_source=github.com&utm_medium=referral&utm_content=commonality/readme-inspector&utm_campaign=Badge_Grade +[coveralls-image]: https://img.shields.io/coveralls/github/commonality/readme-inspector/master.svg +[coveralls-url]: https://coveralls.io/r/commonality/readme-inspector +[daviddm-dev-image]: https://david-dm.org/commonality/readme-inspector/dev-status.svg?theme=shields.io&style=flat-square +[daviddm-dev-url]: https://david-dm.org/commonality/readme-inspector?type=dev +[daviddm-image]: https://david-dm.org/commonality/readme-inspector.svg?theme=shields.io&style=flat-square +[daviddm-url]: https://david-dm.org/commonality/readme-inspector +[fossa-image]: https://app.fossa.io/api/projects/git%2Bgithub.com%2Fcommonality%2Freadme-inspector.svg?type=shield&style=flat-square +[fossa-url]: https://app.fossa.io/projects/git%2Bgithub.com%2Fcommonality%2Freadme-inspector?ref=badge_shield +[github-release-image]: https://img.shields.io/github/release/commonality/readme-inspector.svg?style=flat-square +[github-release-url]: https://github.com/commonality/readme-inspector/releases/latest +[license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square +[license-url]: http://opensource.org/licenses/MIT +[notice-url]: https://app.fossa.io/reports/07123904-7d26-40a6-b6af-c74e82a53789 +[npm-image]: https://img.shields.io/npm/v/readme-inspector.svg?style=flat-square +[npm-url]: https://npmjs.org/package/readme-inspector +[npms-image]: https://badges.npms.io/readme-inspector.svg?style=flat-square +[npms-url]: https://npms.io/search?q=readme-inspector +[nsp-image]: https://nodesecurity.io/orgs/commonality/projects/a2aa0184-ae94-4307-8b87-f0e12324368a/badge +[nsp-url]: https://nodesecurity.io/orgs/commonality/projects/a2aa0184-ae94-4307-8b87-f0e12324368a +[travis-image]: https://img.shields.io/travis/commonality/readme-inspector.svg?branch=master&style=flat-square&label=macOS%20%7C%20ubuntu%20builds&logo=travis +[travis-url]: https://travis-ci.org/commonality/readme-inspector +[vulnerabilities-image]: https://snyk.io/test/github/commonality/readme-inspector/badge.svg?style=flat-square&targetFile=package.json +[vulnerabilities-url]: https://snyk.io/test/github/commonality/readme-inspector?targetFile=package.json + + + +[author-image]: https://img.shields.io/github/issues/detail/u/commonality/readme-inspector/1.svg?style=social +[author-url]: https://github.com/gregswindle +[code-size-bytes-image]: https://img.shields.io/github/languages/code-size/commonality/readme-inspector.svg?style=flat-square +[commit-activity-one-year-image]: https://img.shields.io/github/commit-activity/y/commonality/readme-inspector.svg?style=social +[commit-last-image]: https://img.shields.io/github/last-commit/commonality/readme-inspector.svg?style=social +[commit-last-url]: https://github.com/commonality/readme-inspector/graphs/commit-activity +[contributor-count-image]: https://img.shields.io/github/contributors/commonality/readme-inspector.svg?style=social +[contributor-count-url]: https://github.com/commonality/readme-inspector/graphs/contributors +[github-forks-image]: https://img.shields.io/github/forks/commonality/readme-inspector.svg?style=social&label=Forks +[github-forks-url]: https://github.com/commonality/readme-inspector/network/members +[github-stars-image]: https://img.shields.io/github/stars/commonality/readme-inspector.svg?style=social&label=Stars +[github-stars-url]: https://github.com/commonality/readme-inspector/stargazers +[github-watchers-image]: https://img.shields.io/github/watchers/commonality/readme-inspector.svg?style=social&label=Watchers +[github-watchers-url]: https://github.com/commonality/readme-inspector/watchers +[issues-closed-image]: https://img.shields.io/github/issues-closed/commonality/readme-inspector.svg?style=flat-square +[issues-closed-url]: https://github.com/commonality/readme-inspector/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed +[issues-open-breaking-change-image]: https://img.shields.io/github/issues/commonality/readme-inspector/type%3A%20breaking%20change.svg?style=flat-square&colorB=b60205 +[issues-open-breaking-change-url]: https://github.com/commonality/readme-inspector/labels/type%3A%20breaking%20change +[issues-open-defect-image]: https://img.shields.io/github/issues/commonality/readme-inspector/type:%20defect.svg?style=flat-square&colorB=e99695 +[issues-open-defect-url]: https://github.com/commonality/readme-inspector/labels/type%3A%20defect +[issues-open-feature-image]: https://img.shields.io/github/issues/commonality/readme-inspector/type:%20feature.svg?style=flat-square&colorB=5319e7 +[issues-open-feature-url]: https://github.com/commonality/readme-inspector/labels/type%3A%20feature +[issues-open-image]: https://img.shields.io/github/issues/commonality/readme-inspector.svg?style=flat-square +[issues-open-url]: https://github.com/commonality/readme-inspector/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc +[language-count-image]: https://img.shields.io/github/languages/count/commonality/readme-inspector.svg?style=flat-square +[language-top-image]: https://img.shields.io/github/languages/top/commonality/readme-inspector.svg?style=flat-square +[language-top-url]: https://github.com/commonality/readme-inspector/search?l=javascript +[maintenance-image]: https://img.shields.io/maintenance/readme-inspector/2018.svg?style=flat-square +[maintenance-image]: https://img.shields.io/maintenance/readme-inspector/2018.svg?style=flat-square +[npm-downloads-month]: https://img.shields.io/npm/dm/readme-inspector.svg?style=social +[npm-downloads-year]: https://img.shields.io/npm/dy/readme-inspector.svg?style=social +[pull-requests-closed-image]: https://img.shields.io/github/issues-pr-closed/commonality/readme-inspector.svg?style=flat-square +[pull-requests-closed-url]: https://github.com/commonality/readme-inspector/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Aclosed +[pull-requests-open-image]: https://img.shields.io/github/issues-pr/commonality/readme-inspector.svg?style=flat-square +[pull-requests-open-url]: https://github.com/commonality/readme-inspector/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc +[release-date-image]: https://img.shields.io/github/release-date/commonality/readme-inspector.svg?style=flat-square +[releases-url]: https://github.com/commonality/readme-inspector/releases +[repo-size-bytes-image]: https://img.shields.io/github/repo-size/commonality/readme-inspector.svg?style=flat-square +[used-by-image]: https://img.shields.io/sourcegraph/rrc/github.com/commonality/readme-inspector.svg?style=social +[used-by-url]: https://www.npmjs.com/browse/depended/readme-inspector + + [octicon-alert]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/alert.svg [octicon-arrow-down]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/arrow-down.svg diff --git a/docs/api/readme-inspector/1.0.2/index.html b/docs/api/readme-inspector/1.0.2/index.html index a3077de..c912cae 100644 --- a/docs/api/readme-inspector/1.0.2/index.html +++ b/docs/api/readme-inspector/1.0.2/index.html @@ -117,8 +117,8 @@

1. Installation

readme-inspector is written in JavaScrip


Click here for detailed .env variable initialization instructions
 
-
-
+
+
 properties
 # .env.schema, committed to repo
 
@@ -143,8 +143,8 @@ 

1. Installation

readme-inspector is written in JavaScrip GITHUB_ACCESS_TOKEN= - - + + properties # .env.defaults, committed to repo diff --git a/docs/api/readme-inspector/1.0.2/index.js.html b/docs/api/readme-inspector/1.0.2/index.js.html index 193dae4..c5347e6 100644 --- a/docs/api/readme-inspector/1.0.2/index.js.html +++ b/docs/api/readme-inspector/1.0.2/index.js.html @@ -45,7 +45,7 @@

index.js

/* * Load required environment variables - * @see /lib/.env.example + * @see /.env.example * @private * @ignore */ diff --git a/docs/api/readme-inspector/2.0.0/ReadmeAppraisal.html b/docs/api/readme-inspector/2.0.0/ReadmeAppraisal.html index 5b18f2f..7378cbb 100644 --- a/docs/api/readme-inspector/2.0.0/ReadmeAppraisal.html +++ b/docs/api/readme-inspector/2.0.0/ReadmeAppraisal.html @@ -472,7 +472,7 @@
Example

- Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
diff --git a/docs/api/readme-inspector/2.0.0/appraisal-data.js.html b/docs/api/readme-inspector/2.0.0/appraisal-data.js.html index dc7364b..7fd5e38 100644 --- a/docs/api/readme-inspector/2.0.0/appraisal-data.js.html +++ b/docs/api/readme-inspector/2.0.0/appraisal-data.js.html @@ -177,7 +177,7 @@

appraisal-data.js


- Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
diff --git a/docs/api/readme-inspector/2.0.0/external-Contents.html b/docs/api/readme-inspector/2.0.0/external-Contents.html index bbba8fe..8607fb4 100644 --- a/docs/api/readme-inspector/2.0.0/external-Contents.html +++ b/docs/api/readme-inspector/2.0.0/external-Contents.html @@ -161,7 +161,7 @@

Example


- Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
diff --git a/docs/api/readme-inspector/2.0.0/external-Octokit.html b/docs/api/readme-inspector/2.0.0/external-Octokit.html index 8ca64ea..e49889d 100644 --- a/docs/api/readme-inspector/2.0.0/external-Octokit.html +++ b/docs/api/readme-inspector/2.0.0/external-Octokit.html @@ -139,7 +139,7 @@


- Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
diff --git a/docs/api/readme-inspector/2.0.0/external-Promise.html b/docs/api/readme-inspector/2.0.0/external-Promise.html index fc247df..6a07dc7 100644 --- a/docs/api/readme-inspector/2.0.0/external-Promise.html +++ b/docs/api/readme-inspector/2.0.0/external-Promise.html @@ -139,7 +139,7 @@


- Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
diff --git a/docs/api/readme-inspector/2.0.0/external-URL.html b/docs/api/readme-inspector/2.0.0/external-URL.html index bbc34fd..1b9c0b0 100644 --- a/docs/api/readme-inspector/2.0.0/external-URL.html +++ b/docs/api/readme-inspector/2.0.0/external-URL.html @@ -139,7 +139,7 @@


- Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
diff --git a/docs/api/readme-inspector/2.0.0/github-rest-api-options.js.html b/docs/api/readme-inspector/2.0.0/github-rest-api-options.js.html index a590060..bb9d29c 100644 --- a/docs/api/readme-inspector/2.0.0/github-rest-api-options.js.html +++ b/docs/api/readme-inspector/2.0.0/github-rest-api-options.js.html @@ -105,7 +105,7 @@

github-rest-api-options.js


- Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
diff --git a/docs/api/readme-inspector/2.0.0/global.html b/docs/api/readme-inspector/2.0.0/global.html index f107941..a88a5c9 100644 --- a/docs/api/readme-inspector/2.0.0/global.html +++ b/docs/api/readme-inspector/2.0.0/global.html @@ -945,7 +945,7 @@
Example

- Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
diff --git a/docs/api/readme-inspector/2.0.0/index.html b/docs/api/readme-inspector/2.0.0/index.html index de1514f..a8c85e3 100644 --- a/docs/api/readme-inspector/2.0.0/index.html +++ b/docs/api/readme-inspector/2.0.0/index.html @@ -137,8 +137,8 @@

file .env

@@ -201,13 +216,17 @@

filebeaker Test readme-inspector in your Web browser link-external.

-

gear View the full API docs for details.

+

gear View the full API docs for details link-external.

The readmeInspector module detects whether or not a README document exists at the root of a GitHub or GitHub Enterprise repository. If a README exists, it can evaluate the README's quality and provide a numerical score from 0 to 100, where 0 is the lowest quality and 100 is the highest.

3.1. authenticate({token, type, key})

@@ -296,6 +315,7 @@

3.1. authenticate({token, type, key})

  • If you can see the information by visiting the site without being logged in, you don't have to be authenticated to retrieve the same information through the API.
  • If you want to change data, you have to be authenticated.
  • +

    Note: authenticate is synchronous because it only sets the credentials for the following requests.

    octokit/rest.js. (2018). GitHub. Retrieved 21 March 2018, from https://github.com/octokit/rest.js#authentication link-external

    3.1.1. Parameters

    @@ -304,26 +324,34 @@

    3.1.1. Parameters

    - - - + - - + + - - + + + + + + + + + + + +
    Name Type DescriptionNotes
    key Stringtype=oauth Client identifier
    token String`type=[integrationtoken]` Unique value
    typeEnumbasic, oauth, oauth-key-secret, token, and integrationEnum.basic, oauth, token, or integration
    usernameStringtype=basic Basic authentication username
    passwordStringtype=basic Basic authentication password
    @@ -625,7 +653,7 @@

    6. License

    MIT

    diff --git a/docs/api/readme-inspector/2.0.0/index.js.html b/docs/api/readme-inspector/2.0.0/index.js.html index 382cf14..2c60971 100644 --- a/docs/api/readme-inspector/2.0.0/index.js.html +++ b/docs/api/readme-inspector/2.0.0/index.js.html @@ -45,7 +45,7 @@

    index.js

    /* * Load required environment variables - * @see /lib/.env.example + * @see /.env.example * @private * @ignore */ @@ -192,11 +192,14 @@

    index.js

    }) { const info = await readmeInspector.getInfo(params) if (info.isPresent) { - info.appraisal = await readmeInspector.getAppraisal(`${params.owner}/${params.repo}`) + info.appraisal = + await readmeInspector.getAppraisal(`${params.owner}/${params.repo}`) } return info }, + envConfig, + /** * An API proxy for the readme-score-api, which provides quality * measures for README files with the {@link appraisalData AppraisalData} @@ -269,7 +272,7 @@

    index.js


    - Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
    diff --git a/docs/api/readme-inspector/2.0.0/module-readme-inspector.html b/docs/api/readme-inspector/2.0.0/module-readme-inspector.html index 8650d67..bba8435 100644 --- a/docs/api/readme-inspector/2.0.0/module-readme-inspector.html +++ b/docs/api/readme-inspector/2.0.0/module-readme-inspector.html @@ -946,7 +946,7 @@

    (static) Source:
    @@ -1111,7 +1111,7 @@

    (static) getI
    Source:
    @@ -2296,7 +2296,7 @@

    (static) Source:
    @@ -2461,7 +2461,7 @@

    (static) getI
    Source:
    @@ -2745,7 +2745,7 @@

    Returns:

    - Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
    diff --git a/docs/api/readme-inspector/2.0.0/readme-appraisal.js.html b/docs/api/readme-inspector/2.0.0/readme-appraisal.js.html index f08d878..93181b1 100644 --- a/docs/api/readme-inspector/2.0.0/readme-appraisal.js.html +++ b/docs/api/readme-inspector/2.0.0/readme-appraisal.js.html @@ -118,7 +118,7 @@

    readme-appraisal.js


    - Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
    diff --git a/docs/api/readme-inspector/2.0.0/readme-info.js.html b/docs/api/readme-inspector/2.0.0/readme-info.js.html index eb33868..9bdc355 100644 --- a/docs/api/readme-inspector/2.0.0/readme-info.js.html +++ b/docs/api/readme-inspector/2.0.0/readme-info.js.html @@ -119,7 +119,7 @@

    readme-info.js


    - Generated by JSDoc 3.5.5 on Sat Apr 21 2018 02:14:35 GMT-0500 (CDT) using the Minami theme. + Generated by JSDoc 3.5.5 on Mon Apr 23 2018 11:40:15 GMT-0500 (CDT) using the Minami theme.
    diff --git a/docs/project/API.md b/docs/project/API.md new file mode 100644 index 0000000..8672880 --- /dev/null +++ b/docs/project/API.md @@ -0,0 +1,563 @@ +# REST APIs + +> We try to enforce development of sanely constructed RESTful interfaces, which team members and clients can consume simply and consistently. +> +> Lack of consistency and simplicity can massively increase integration and maintenance costs, which is why `API design` is included in this document. + +## Table of contents + + +- [1. **API design**](#1-api-design) +- [2. **API security**](#2-api-security) +- [3. **API documentation**](#3-api-documentation) + + +## 1. **API design** + +1. We mostly follow resource-oriented design. It has three main factors: resources, collection, and URLs. + +1. A resource has data, gets nested, and there are methods that operate against it. + +1. A group of resources is called a collection. + +1. URL identifies the online location of resource or collection. + + _Why:_ + + > ⌦ This is a very well-known design to developers (your main API consumers). Apart from readability and ease of use, it allows us to write generic libraries and connectors without even knowing what the API is about. + +1. Use kebab-case for URLs. + +1. Use camelCase for parameters in the query string or resource fields. + +1. Use plural kebab-case for resource names in URLs. + +1. Always use a plural nouns for naming a url pointing to a collection: `/users`. + + _Why:_ + + > ⌦ Basically, it reads better and keeps URLs consistent. [read more...](https://apigee.com/about/blog/technology/restful-api-design-plural-nouns-and-concrete-names) + +1. In the source code convert plurals to variables and properties with a List suffix. + + _Why_: + + > ⌦ Plural is nice in the URL but in the source code, it’s just too subtle and error-prone. + +1. Always use a singular concept that starts with a collection and ends to an identifier: + + ```http + /students/245743 + /airports/kjfk + ``` + +1. Avoid URLs like this: + + ```http + GET /blogs/:blogId/posts/:postId/summary + ``` + + _Why:_ + + > ⌦ This is not pointing to a resource but to a property instead. You can pass the property as a parameter to trim your response. + +1. Keep verbs out of your resource URLs. + + _Why:_ + + > ⌦ Because if you use a verb for each resource operation you soon will have a huge list of URLs and no consistent pattern which makes it difficult for developers to learn. Plus we use verbs for something else. + +1. Use verbs for non-resources. In this case, your API doesn't return any resources. Instead, you execute an operation and return the result. These **are not** CRUD (create, retrieve, update, and delete) operations: + + ```http + /translate?text=Hallo + ``` + + _Why:_ + + > ⌦ Because for CRUD we use HTTP methods on `resource` or `collection` URLs. The verbs we were talking about are actually `Controllers`. You usually don't develop many of these. [read more...](https://byrondover.github.io/post/restful-api-guidelines/#controller) + +1. The request body or response type is JSON then please follow `camelCase` for `JSON` property names to maintain the consistency. + + _Why:_ + + > ⌦ This is a JavaScript project guideline, Where Programming language for generating JSON as well as Programming language for parsing JSON are assumed to be JavaScript. + +1. Even though a resource is a singular concept that is similar to an object instance or database record, you should not use your `table_name` for a resource name and `column_name` resource property. + + _Why:_ + + > ⌦ Because your intention is to expose Resources, not your database schema details. + +1. Again, only use nouns in your URL when naming your resources and don’t try to explain their functionality. + + _Why:_ + + > ⌦ Only use nouns in your resource URLs, avoid endpoints like `/addNewUser` or `/updateUser` . Also avoid sending resource operations as a parameter. + +1. Explain the CRUD functionalities using HTTP methods: + + _How:_ + + > `GET`: Retrieve a representation of a resource. + > + > `POST`: Create new resources and sub-resources. + > + > `PUT`: Replace existing resources. + > + > `PATCH`: Update existing resources. It only updates the fields that were supplied, leaving the others alone. + > + > `DELETE`: Delete existing resources. + +1. For nested resources, use the relation between them in the URL. For instance, using `id` to relate an employee to a company. + + _Why:_ + + > ⌦ This is a natural way to make resources explorable. + > + > _How:_ + > + > `GET /schools/2/students` , should get the list of all students from school 2. + > + > `GET /schools/2/students/31` , should get the details of student 31, which belongs to school 2. + > + > `DELETE /schools/2/students/31` , should delete student 31, which belongs to school 2. + > + > `PUT /schools/2/students/31` , should update info of student 31, Use PUT on resource-URL only, not collection. + > + > `POST /schools` , should create a new school and return the details of the new school created. Use POST on collection-URLs. + +1. Use a simple ordinal number for a version with a `v` prefix (v1, v2). Move it all the way to the left in the URL so that it has the highest scope: + + ```http + http://api.domain.com/v1/schools/3/students + ``` + + _Why:_ + + > ⌦ When your APIs are public for other third parties, upgrading the APIs with some breaking change would also lead to breaking the existing products or services using your APIs. Using versions in your URL can prevent that from happening. [read more...](https://apigee.com/about/blog/technology/restful-api-design-tips-versioning) + +1. Response messages must be self-descriptive. A good error message response might look something like this: + + ```json + { + "code": 404, + "level": "ERROR", + "logger": "[http-logger]", + "message": + "No resource found at URL /archetypes/v1/locales/iso-country-codes/BS", + "timestamp": 1504878062000 + } + ``` + + or for validation errors: + + ```json + { + "code": 400, + "logger": "[registration-form-logger]", + "level": "ERROR", + "timestamp": 1504878062000, + "message": "Validation Failed", + "stack": [ + { + "code": 1233, + "field": "email", + "message": "Invalid email" + }, + { + "code": 1234, + "field": "password", + "message": "No password provided" + } + ] + } + ``` + + _Why:_ + + > ⌦ Developers depend on well-designed errors at the critical times when they are troubleshooting and resolving issues after the applications they've built using your APIs are in the hands of their users. + + --- + + _![shield][octicon-shield] **Keep security exception messages as generic as possible.**_ For instance, instead of saying ‘incorrect password’, you can reply back saying ‘invalid username or password’ so that we don’t unknowingly inform user that username was indeed correct and only the password was incorrect. + + --- + +1. Use only these 8 status codes to send with you response to describe whether **everything worked**, + The **client app did something wrong\*\* or The **API did something wrong\*\*. + + _Which ones:_ + + > `200 OK` response represents success for `GET`, `PUT` or `POST` requests. + > + > `201 Created` for when new instance is created. Creating a new instance, using `POST` method returns `201` status code. + > + > `304 Not Modified` response is to minimize information transfer when the recipient already has cached representations. + > + > `400 Bad Request` for when the request was not processed, as the server could not understand what the client is asking for. + > + > `401 Unauthorized` for when the request lacks valid credentials and it should re-request with the required credentials. + > + > `403 Forbidden` means the server understood the request but refuses to authorize it. + > + > `404 Not Found` indicates that the requested resource was not found. + > + > `500 Internal Server Error` indicates that the request is valid, but the server could not fulfill it due to some unexpected condition. + + _Why:_ + + > ⌦ Most API providers use a small subset HTTP status codes. For example, the Google GData API uses only 10 status codes, Netflix uses 9, and Digg, only 8. Of course, these responses contain a body with additional information.There are over 70 HTTP status codes. However, most developers don't have all 70 memorized. So if you choose status codes that are not very common you will force application developers away from building their apps and over to wikipedia to figure out what you're trying to tell them. [read more...](https://apigee.com/about/blog/technology/restful-api-design-what-about-errors) + +1. Provide total numbers of resources in your response. +1. Accept `limit` and `offset` parameters. + +1. The amount of data the resource exposes should also be taken into account. The API consumer doesn't always need the full representation of a resource.Use a fields query parameter that takes a comma separated list of fields to include: + + ```http + GET /student?fields=id,name,age,class + ``` + +1. Pagination, filtering, and sorting don’t need to be supported from start for all resources. Document those resources that offer filtering and sorting. + +## 2. **API security** + +shield These are some basic security best practices. + +1. Don't use basic authentication unless over a secure connection (HTTPS). Authentication tokens must not be transmitted in the URL: `GET /users/123?token=asdf....` + + _Why:_ + + > ⌦ Because Token, or user ID and password are passed over the network as clear text (it is base64 encoded, but base64 is a reversible encoding), the basic authentication scheme is not secure. [read more...](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication) + +1. Tokens must be transmitted using the Authorization header on every request: `Authorization: Bearer xxxxxx, Extra yyyyy`. + +1. Authorization Code should be short-lived. + +1. Reject any non-TLS requests by not responding to any HTTP request to avoid any insecure data exchange. Respond to HTTP requests by `403 Forbidden`. + +1. Consider using Rate Limiting. + + _Why:_ + + > ⌦ To protect your APIs from bot threats that call your API thousands of times per hour. You should consider implementing rate limit early on. + +1. Setting HTTP headers appropriately can help to lock down and secure your web application. [read more...](https://github.com/helmetjs/helmet) + +1. Your API should convert the received data to their canonical form or reject them. Return 400 Bad Request with details about any errors from bad or missing data. + +1. All the data exchanged with the ReST API must be validated by the API. + +1. Serialize your JSON. + + _Why:_ + + > ⌦ A key concern with JSON encoders is preventing arbitrary JavaScript remote code execution within the browser... or, if you're using node.js, on the server. It's vital that you use a proper JSON serializer to encode user-supplied data properly to prevent the execution of user-supplied input on the browser. + +1. Validate the content-type and mostly use `application/*json` (Content-Type header). + + _Why:_ + + > ⌦ For instance, accepting the `application/x-www-form-urlencoded` mime type allows the attacker to create a form and trigger a simple POST request. The server should never assume the Content-Type. A lack of Content-Type header or an unexpected Content-Type header should result in the server rejecting the content with a `4XX` response. + +## 3. **API documentation** + +1. **Fill the API section in the README for "API"**. + +1. **Authentication examples.** Describe API authentication methods with a code sample. + +1. **URL structure.** Explaining The URL Structure (path only, no root URL) including The request type (Method). For each endpoint explain: + +1. **URL Params.** If URL Params exist, specify them in accordance with name mentioned in URL section: + + ```http + Required: id=[integer] + Optional: photo_id=[alphanumeric] + ``` + + > ![light-bulb][octicon-light-bulb] **POST method types** + > + > If the request's method type is POST, provide working examples. URL Params rules apply here too. Separate the section into Optional and Required. + +1. **Success Responses.** What should be the status code and is there any return data? This is useful when people need to know what their callbacks should expect: + + ```http + Code: 200 + Content: { id : 12 } + ``` + +1. **Error Responses.** Most endpoints have many ways to fail. From unauthorized access to wrongful parameters etc. All of those should be listed here. It might seem repetitive, but it helps prevent assumptions from being made. For example: + + + 1. **HTTP status code** + + ```http + 404 Not Found + ``` + + 1. **Response body** + + ```json + { + "code": 404, + "level": "ERROR", + "logger": "[http-logger]", + "message": + "No resource found at URL /archetypes/v1/locales/iso-country-codes/BS", + "timestamp": 1504878062000 + } + ``` + + 1. **Response headers** + + ```http + accept-ranges: bytes + access-control-allow-headers: Authorization + access-control-allow-methods: GET, HEAD, OPTIONS + access-control-allow-origin: * + cache-control: public, no-transform, must-revalidate + connection: keep-alive + content-encoding: gzip + content-language: en-US + content-length: 149 + content-type: application/json + date: Fri, 08 Sep 2017 06:41:02 GMT + last-modified: Tue, 1 Oct 2014 10:10:10 GMT + server: nginx/1.12.1 + vary: Accept-Encoding + ``` + +1. Use API design tools, There are lots of open source tools for good documentation such as [API Blueprint](https://apiblueprint.org/) and [Swagger](https://swagger.io/). + + + +[all-contributors-cli-url]: https://github.com/kentcdodds/all-contributors +[autosquashing-git-commits-url]: https://robots.thoughtbot.com/autosquashing-git-commits +[changelog-url]: ./CHANGELOG.md +[cite-interview-torvalds-url]: https://techcrunch.com/2012/04/19/an-interview-with-millenium-technology-prize-finalist-linus-torvalds/ +[cla-url]: https://www.clahub.com/agreements/commonality/readme-inspector +[code-of-conduct-url]: ./CODE_OF_CONDUCT.md +[commitplease-url]: https://www.npmjs.com/package/commitplease +[commonality-palette-image]: ./assets/img/palette.svg +[contributing-url]: ./CONTRIBUTING.md +[contribution-lifecycle-issues-image]: ./assets/img/icons8/contribution-lifecycle-create-issue.png +[contribution-lifecycle-pr-image]: ./assets/img/icons8/contribution-lifecycle-pr.png +[conventional-commits-url]: https://conventionalcommits.org +[coolors-palette-url]: https://coolors.co/cfdbd5-e8eddf-f5cb5c-242423-333533 +[eslint-logo-image]: ./assets/img/logo-eslint.png +[eslint-rules-table-url]: .github/eslint-rules-table.md +[eslint-url]: https://eslint.org +[force-with-lease-url]: https://developer.atlassian.com/blog/2015/04/force-with-lease/ +[fossa-image-large]: https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Forganization%2Frepo-name.svg?type=large +[gh-create-account-url]: https://github.com/signup/free +[gh-git-labelmaker-url]: https://github.com/himynameisdave/git-labelmaker +[gh-try-github-url]: https://try.github.io/levels/1/challenges/1 +[git-commit-guidelines-url]: https://github.com/commonality/readme-inspector.js/blob/master/CONTRIBUTING.md#commit +[git-resolve-conflicts-url]: https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/ +[icon-bitbucket-20-image]: ./assets/img/icons8/icon-bitbucket-20.png +[icon-git-logo-image]: ./assets/img/icons8/git-logo.png +[icon-github-20-image]: ./assets/img/icons8/icon-github-filled-20.png +[icon-info-image]: ./assets/img/icons8/icon-info-50.png +[icon-issue-image]: ./assets/img/icons8/icon-issues.png +[icon-pr-image]: ./assets/img/icons8/icon-pr.png +[icon-rest-api-image]: ./assets/img/icons8/icon-rest-api.png +[issues-new-defect-image]: https://img.shields.io/badge/report-defect-F5CB5C.svg?style=for-the-badge&label=report+a +[issues-new-defect-url]: /commonality/readme-inspector.git/issues/new?title=defect%28scope%29%3A+summary-of-change&labels=priority%3A+medium%2Cstatus%3A+review+needed%2Ctype%3A+defect&body=%2A%2A%F0%9F%92%A1+TIP%3A%2A%2A+Select+the+%E2%86%96%EF%B8%8E%E2%8E%BE+Preview+%E2%8F%8B+Tab+above+help+read+these+instructions.%0D%0A%0D%0A%23%23+1.+Issue+type%0D%0A%3E%E2%8C%A6+Type+the+letter+%22x%22+in+the+%22checkbox%22+the+best+describe+this+issue.%0D%0A%0D%0A-+%5Bx%5D+**Feature%3A**+I%27m+requesting+a+product+enhancement.%0D%0A%0D%0A%23%23+2.+User+story+summary%0D%0A%3E%E2%8C%A6+Describe+what+you+want+to+accomplish%2C+in+what+role%2Fcapacity%2C+and+why+it%27s+important+to+you.%0D%0A%0D%0A%3E+**EXAMPLE%3A**%0D%0A%3E+As+a+Applicant%2C%0D%0A%3E+I+want+to+submit+my+resume%0D%0A%3E+In+order+to+be+considered+for+a+job+opening.%0D%0A%0D%0AAs+a+%7Brole%7D%2C%0D%0AI+must%2Fneed%2Fwant%2Fshould+%7Bdo+something%7D%0D%0AIn+order+to+%7Bachieve+value%7D.%0D%0A%0D%0A%23%23+3.+Acceptance+criteria%0D%0A%3E%E2%8C%A6+Replace+the+examples+below+with+your+own+imperative%2C+%22true%2Ffalse%22+statements+for+the+**behavior+you+expect**+to+see%2C+or+the+behavior+that+**would**+be+true+if+there+were+no+errors+%28for+defects%29.%0D%0A%0D%0A-+%5B+%5D+1.+Job+Applicants+receive+a+confirmation+email+after+they+submit+their+resumes.%0D%0A-+%5B+%5D+2.+An+Applicant%27s+resume+information+isn%27t+lost+when+errors+occur.%0D%0A-+%5B+%5D+3.+%7Bcriterion-three%7D%0D%0A-+%5B+%5D+4.+%7Bcriterion-four%7D%0D%0A%0D%0A%3C%21--+%E2%9B%94%EF%B8%8F++Do+not+remove+anything+below+this+comment.+%E2%9B%94%EF%B8%8F++--%3E%0D%0A%5Bicon-info-image%5D%3A+..%2Fdocs%2Fimg%2Ficons8%2Ficon-info-50.png%0D%0A +[issues-new-defect-url]: https://github.com/commonality/readme-inspector/issues/new?title=defect%28scope%29%3A+summary-of-problem&labels=priority%3A+medium%2Cstatus%3A+review+needed%2Ctype%3A+defect&body=%2A%2A%F0%9F%92%A1+TIP%3A%2A%2A+Select+the+%E2%86%96%EF%B8%8E%E2%8E%BE+Preview+%E2%8F%8B+Tab+above+help+read+these+instructions.%0D%0A%0D%0A%23%23+1.+Issue+type%0D%0A%3E%E2%8C%A6+Type+the+letter+%22x%22+in+the+%22checkbox%22+the+best+describe+this+issue.%0D%0A%0D%0A-+%5Bx%5D+**Feature%3A**+I%27m+requesting+a+product+enhancement.%0D%0A%0D%0A%23%23+2.+User+story+summary%0D%0A%3E%E2%8C%A6+Describe+what+you+want+to+accomplish%2C+in+what+role%2Fcapacity%2C+and+why+it%27s+important+to+you.%0D%0A%0D%0A%3E+**EXAMPLE%3A**%0D%0A%3E+As+a+Applicant%2C%0D%0A%3E+I+want+to+submit+my+resume%0D%0A%3E+In+order+to+be+considered+for+a+job+opening.%0D%0A%0D%0AAs+a+%7Brole%7D%2C%0D%0AI+must%2Fneed%2Fwant%2Fshould+%7Bdo+something%7D%0D%0AIn+order+to+%7Bachieve+value%7D.%0D%0A%0D%0A%23%23+3.+Acceptance+criteria%0D%0A%3E%E2%8C%A6+Replace+the+examples+below+with+your+own+imperative%2C+%22true%2Ffalse%22+statements+for+the+**behavior+you+expect**+to+see%2C+or+the+behavior+that+**would**+be+true+if+there+were+no+errors+%28for+defects%29.%0D%0A%0D%0A-+%5B+%5D+1.+Job+Applicants+receive+a+confirmation+email+after+they+submit+their+resumes.%0D%0A-+%5B+%5D+2.+An+Applicant%27s+resume+information+isn%27t+lost+when+errors+occur.%0D%0A-+%5B+%5D+3.+%7Bcriterion-three%7D%0D%0A-+%5B+%5D+4.+%7Bcriterion-four%7D%0D%0A%0D%0A%3C%21--+%E2%9B%94%EF%B8%8F++Do+not+remove+anything+below+this+comment.+%E2%9B%94%EF%B8%8F++--%3E%0D%0A%5Bicon-info-image%5D%3A+..%2Fdocs%2Fimg%2Ficons8%2Ficon-info-50.png%0D%0A +[issues-new-feat-image]: https://img.shields.io/badge/request-feature-c1ccc6.svg?style=for-the-badge&label=request+a +[issues-new-feat-url]: /commonality/readme-inspector.git/issues/new?title=feat%28scope%29%3A+summary-of-change&labels=priority%3A+medium%2Cstatus%3A+review+needed%2Ctype%3A+feature&body=%2A%2A%F0%9F%92%A1+TIP%3A%2A%2A+Select+the+%E2%86%96%EF%B8%8E%E2%8E%BE+Preview+%E2%8F%8B+Tab+above+help+read+these+instructions.%0D%0A%0D%0A%23%23+1.+Issue+type%0D%0A%3E%E2%8C%A6+Type+the+letter+%22x%22+in+the+%22checkbox%22+the+best+describe+this+issue.%0D%0A%0D%0A-+%5Bx%5D+**Feature%3A**+I%27m+requesting+a+product+enhancement.%0D%0A%0D%0A%23%23+2.+User+story+summary%0D%0A%3E%E2%8C%A6+Describe+what+you+want+to+accomplish%2C+in+what+role%2Fcapacity%2C+and+why+it%27s+important+to+you.%0D%0A%0D%0A%3E+**EXAMPLE%3A**%0D%0A%3E+As+a+Applicant%2C%0D%0A%3E+I+want+to+submit+my+resume%0D%0A%3E+In+order+to+be+considered+for+a+job+opening.%0D%0A%0D%0AAs+a+%7Brole%7D%2C%0D%0AI+must%2Fneed%2Fwant%2Fshould+%7Bdo+something%7D%0D%0AIn+order+to+%7Bachieve+value%7D.%0D%0A%0D%0A%23%23+3.+Acceptance+criteria%0D%0A%3E%E2%8C%A6+Replace+the+examples+below+with+your+own+imperative%2C+%22true%2Ffalse%22+statements+for+the+**behavior+you+expect**+to+see%2C+or+the+behavior+that+**would**+be+true+if+there+were+no+errors+%28for+defects%29.%0D%0A%0D%0A-+%5B+%5D+1.+Job+Applicants+receive+a+confirmation+email+after+they+submit+their+resumes.%0D%0A-+%5B+%5D+2.+An+Applicant%27s+resume+information+isn%27t+lost+when+errors+occur.%0D%0A-+%5B+%5D+3.+%7Bcriterion-three%7D%0D%0A-+%5B+%5D+4.+%7Bcriterion-four%7D%0D%0A%0D%0A%3C%21--+%E2%9B%94%EF%B8%8F++Do+not+remove+anything+below+this+comment.+%E2%9B%94%EF%B8%8F++--%3E%0D%0A%5Bicon-info-image%5D%3A+..%2Fdocs%2Fimg%2Ficons8%2Ficon-info-50.png%0D%0A +[issues-new-feat-url]: https://github.com/commonality/readme-inspector/issues/new?title=feat%28scope%29%3A+summary-of-change&labels=priority%3A+medium%2Cstatus%3A+review+needed%2Ctype%3A+feature&body=%2A%2A%F0%9F%92%A1+TIP%3A%2A%2A+Select+the+%E2%86%96%EF%B8%8E%E2%8E%BE+Preview+%E2%8F%8B+Tab+above+help+read+these+instructions.%0D%0A%0D%0A%23%23+1.+Issue+type%0D%0A%3E%E2%8C%A6+Type+the+letter+%22x%22+in+the+%22checkbox%22+the+best+describe+this+issue.%0D%0A%0D%0A-+%5Bx%5D+**Feature%3A**+I%27m+requesting+a+product+enhancement.%0D%0A%0D%0A%23%23+2.+User+story+summary%0D%0A%3E%E2%8C%A6+Describe+what+you+want+to+accomplish%2C+in+what+role%2Fcapacity%2C+and+why+it%27s+important+to+you.%0D%0A%0D%0A%3E+**EXAMPLE%3A**%0D%0A%3E+As+a+Applicant%2C%0D%0A%3E+I+want+to+submit+my+resume%0D%0A%3E+In+order+to+be+considered+for+a+job+opening.%0D%0A%0D%0AAs+a+%7Brole%7D%2C%0D%0AI+must%2Fneed%2Fwant%2Fshould+%7Bdo+something%7D%0D%0AIn+order+to+%7Bachieve+value%7D.%0D%0A%0D%0A%23%23+3.+Acceptance+criteria%0D%0A%3E%E2%8C%A6+Replace+the+examples+below+with+your+own+imperative%2C+%22true%2Ffalse%22+statements+for+the+**behavior+you+expect**+to+see%2C+or+the+behavior+that+**would**+be+true+if+there+were+no+errors+%28for+defects%29.%0D%0A%0D%0A-+%5B+%5D+1.+Job+Applicants+receive+a+confirmation+email+after+they+submit+their+resumes.%0D%0A-+%5B+%5D+2.+An+Applicant%27s+resume+information+isn%27t+lost+when+errors+occur.%0D%0A-+%5B+%5D+3.+%7Bcriterion-three%7D%0D%0A-+%5B+%5D+4.+%7Bcriterion-four%7D%0D%0A%0D%0A%3C%21--+%E2%9B%94%EF%B8%8F++Do+not+remove+anything+below+this+comment.+%E2%9B%94%EF%B8%8F++--%3E%0D%0A%5Bicon-info-image%5D%3A+..%2Fdocs%2Fimg%2Ficons8%2Ficon-info-50.png%0D%0A +[issues-url]: /commonality/readme-inspector/issues +[issues-url]: https://github.com/commonality/readme-inspector/issues +[jest-logo-image]: ./assets/img/logo-jest.png +[jest-url]: https://facebook.github.io/jest/ +[license-url]: ./LICENSE +[makeapullrequest-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square +[makeapullrequest-url]: http://makeapullrequest.com +[markdown-toc-url]: https://github.com/jonschlinkert/markdown-toc +[osi-logo-image]: ./assets/img/logo-osi.png +[product-development-guidelines-url]: ./assets/product-development-guidelines/js/PRODUCT_DEVELOPEMENT_GUIDELINES.md +[product-repo-logo-image]: ./assets/img/logo-commonalaxy.png +[product-repo-url]: https://github.com/commonality/common-vocabular +[stackshare-badge-image]: https://img.shields.io/badge/tech-stack-0690fa.svg?style=flat-square +[stackshare-url]: https://stackshare.io/commonality/readme-inspector +[standard-js-badge-image]: https://cdn.rawgit.com/standard/standard/master/badge.svg +[standard-js-url]: https://github.com/standard/standard +[standard-version-url]: https://github.com/semantic-release/semantic-releasehttps://github.com/conventional-changelog/standard-version +[tech-stack-image]: ./assets/img/icons8/icon-package-filled.png +[semantic-release-url]: https://github.com/semantic-release/semantic-release + + + +[octicon-alert]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/alert.svg +[octicon-arrow-down]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/arrow-down.svg +[octicon-arrow-left]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/arrow-left.svg +[octicon-arrow-right]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/arrow-right.svg +[octicon-arrow-small-down]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/arrow-small-down.svg +[octicon-arrow-small-left]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/arrow-small-left.svg +[octicon-arrow-small-right]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/arrow-small-right.svg +[octicon-arrow-small-up]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/arrow-small-up.svg +[octicon-arrow-up]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/arrow-up.svg +[octicon-beaker]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/beaker.svg +[octicon-bell]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/bell.svg +[octicon-bold]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/bold.svg +[octicon-book]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/book.svg +[octicon-bookmark]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/bookmark.svg +[octicon-briefcase]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/briefcase.svg +[octicon-broadcast]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/broadcast.svg +[octicon-browser]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/browser.svg +[octicon-bug]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/bug.svg +[octicon-calendar]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/calendar.svg +[octicon-check]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/check.svg +[octicon-checklist]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/checklist.svg +[octicon-chevron-down]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/chevron-down.svg +[octicon-chevron-left]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/chevron-left.svg +[octicon-chevron-right]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/chevron-right.svg +[octicon-chevron-up]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/chevron-up.svg +[octicon-circle-slash]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/circle-slash.svg +[octicon-circuit-board]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/circuit-board.svg +[octicon-clippy]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/clippy.svg +[octicon-clock]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/clock.svg +[octicon-cloud-download]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/cloud-download.svg +[octicon-cloud-upload]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/cloud-upload.svg +[octicon-code]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/code.svg +[octicon-comment-discussion]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/comment-discussion.svg +[octicon-comment]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/comment.svg +[octicon-credit-card]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/credit-card.svg +[octicon-dash]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/dash.svg +[octicon-dashboard]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/dashboard.svg +[octicon-database]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/database.svg +[octicon-desktop-download]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/desktop-download.svg +[octicon-device-camera-video]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/device-camera-video.svg +[octicon-device-camera]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/device-camera.svg +[octicon-device-desktop]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/device-desktop.svg +[octicon-device-mobile]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/device-mobile.svg +[octicon-diff-added]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/diff-added.svg +[octicon-diff-ignored]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/diff-ignored.svg +[octicon-diff-modified]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/diff-modified.svg +[octicon-diff-removed]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/diff-removed.svg +[octicon-diff-renamed]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/diff-renamed.svg +[octicon-diff]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/diff.svg +[octicon-ellipses]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/ellipses.svg +[octicon-ellipsis]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/ellipsis.svg +[octicon-eye]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/eye.svg +[octicon-file-binary]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-binary.svg +[octicon-file-code]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-code.svg +[octicon-file-directory]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-directory.svg +[octicon-file-media]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-media.svg +[octicon-file-pdf]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-pdf.svg +[octicon-file-submodule]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-submodule.svg +[octicon-file-symlink-directory]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-symlink-directory.svg +[octicon-file-symlink-file]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-symlink-file.svg +[octicon-file-text]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-text.svg +[octicon-file-zip]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file-zip.svg +[octicon-file]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/file.svg +[octicon-flame]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/flame.svg +[octicon-fold]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/fold.svg +[octicon-gear]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/gear.svg +[octicon-gift]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/gift.svg +[octicon-gist-secret]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/gist-secret.svg +[octicon-gist]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/gist.svg +[octicon-git-branch]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/git-branch.svg +[octicon-git-commit]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/git-commit.svg +[octicon-git-compare]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/git-compare.svg +[octicon-git-merge]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/git-merge.svg +[octicon-git-pull-request]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/git-pull-request.svg +[octicon-globe]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/globe.svg +[octicon-grabber]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/grabber.svg +[octicon-graph]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/graph.svg +[octicon-heart]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/heart.svg +[octicon-history]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/history.svg +[octicon-home]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/home.svg +[octicon-horizontal-rule]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/horizontal-rule.svg +[octicon-hubot]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/hubot.svg +[octicon-inbox]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/inbox.svg +[octicon-info]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/info.svg +[octicon-issue-closed]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/issue-closed.svg +[octicon-issue-opened]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/issue-opened.svg +[octicon-issue-reopened]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/issue-reopened.svg +[octicon-italic]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/italic.svg +[octicon-jersey]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/jersey.svg +[octicon-key]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/key.svg +[octicon-keyboard]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/keyboard.svg +[octicon-law]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/law.svg +[octicon-light-bulb]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/light-bulb.svg +[octicon-link-external]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/link-external.svg +[octicon-link]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/link.svg +[octicon-list-ordered]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/list-ordered.svg +[octicon-list-unordered]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/list-unordered.svg +[octicon-location]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/location.svg +[octicon-lock]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/lock.svg +[octicon-logo-gist]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/logo-gist.svg +[octicon-logo-github]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/logo-github.svg +[octicon-mail-read]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/mail-read.svg +[octicon-mail-reply]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/mail-reply.svg +[octicon-mail]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/mail.svg +[octicon-mark-github]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/mark-github.svg +[octicon-markdown]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/markdown.svg +[octicon-megaphone]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/megaphone.svg +[octicon-mention]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/mention.svg +[octicon-milestone]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/milestone.svg +[octicon-mirror]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/mirror.svg +[octicon-mortar-board]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/mortar-board.svg +[octicon-mute]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/mute.svg +[octicon-no-newline]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/no-newline.svg +[octicon-octoface]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/octoface.svg +[octicon-organization]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/organization.svg +[octicon-package]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/package.svg +[octicon-paintcan]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/paintcan.svg +[octicon-pencil]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/pencil.svg +[octicon-person]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/person.svg +[octicon-pin]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/pin.svg +[octicon-plug]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/plug.svg +[octicon-plus-small]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/plus-small.svg +[octicon-plus]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/plus.svg +[octicon-primitive-dot]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/primitive-dot.svg +[octicon-primitive-square]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/primitive-square.svg +[octicon-pulse]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/pulse.svg +[octicon-question]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/question.svg +[octicon-quote]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/quote.svg +[octicon-radio-tower]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/radio-tower.svg +[octicon-reply]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/reply.svg +[octicon-repo-clone]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/repo-clone.svg +[octicon-repo-force-push]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/repo-force-push.svg +[octicon-repo-forked]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/repo-forked.svg +[octicon-repo-pull]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/repo-pull.svg +[octicon-repo-push]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/repo-push.svg +[octicon-repo]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/repo.svg +[octicon-rocket]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/rocket.svg +[octicon-rss]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/rss.svg +[octicon-ruby]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/ruby.svg +[octicon-search]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/search.svg +[octicon-server]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/server.svg +[octicon-settings]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/settings.svg +[octicon-shield]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/shield.svg +[octicon-sign-in]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/sign-in.svg +[octicon-sign-out]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/sign-out.svg +[octicon-smiley]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/smiley.svg +[octicon-squirrel]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/squirrel.svg +[octicon-star]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/star.svg +[octicon-stop]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/stop.svg +[octicon-sync]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/sync.svg +[octicon-tag]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/tag.svg +[octicon-tasklist]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/tasklist.svg +[octicon-telescope]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/telescope.svg +[octicon-terminal]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/terminal.svg +[octicon-text-size]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/text-size.svg +[octicon-three-bars]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/three-bars.svg +[octicon-thumbsdown]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/thumbsdown.svg +[octicon-thumbsup]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/thumbsup.svg +[octicon-tools]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/tools.svg +[octicon-trashcan]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/trashcan.svg +[octicon-triangle-down]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/triangle-down.svg +[octicon-triangle-left]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/triangle-left.svg +[octicon-triangle-right]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/triangle-right.svg +[octicon-triangle-up]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/triangle-up.svg +[octicon-unfold]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/unfold.svg +[octicon-unmute]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/unmute.svg +[octicon-unverified]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/unverified.svg +[octicon-verified]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/verified.svg +[octicon-versions]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/versions.svg +[octicon-watch]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/watch.svg +[octicon-x]: https://cdnjs.cloudflare.com/ajax/libs/octicons/4.4.0/svg/x.svg +[toc]: #table-of-contents diff --git a/docs/project/DEBUG.md b/docs/project/DEBUG.md new file mode 100644 index 0000000..e4f3951 --- /dev/null +++ b/docs/project/DEBUG.md @@ -0,0 +1,3 @@ +# Debug readme-inspector + +## Table of contents diff --git a/docs/project/DEVELOPERS.md b/docs/project/DEVELOPERS.md index 9ba9451..072e566 100644 --- a/docs/project/DEVELOPERS.md +++ b/docs/project/DEVELOPERS.md @@ -1,4 +1,4 @@ -# Building and testing readme-inspector +# Developing, building, and testing readme-inspector > code This document describes how to set up your development environment to build and test readme-inspector. It also explains the basic mechanics of using `git`, `node`, and `npm` from a Terminal/CLI (command-line interface). > @@ -12,47 +12,38 @@ - [3. Installing dependencies](#3-installing-dependencies) - [4. Building](#4-building) - [5. Running tests](#5-running-tests) -- [5. Formatting and verifying your sources](#5-formatting-and-verifying-your-sources) -- [6. Git guidelines](#6-git-guidelines) - * [6.1. Makes changes in a topic branch](#61-makes-changes-in-a-topic-branch) - * [6..2. Favor the topic branch naming convention `GH-{ISSUE_NUMBER}-type-scope`](#62-favor-the-topic-branch-naming-convention-gh-issue_number-type-scope) - * [6.3. Branch out from `master`.](#63-branch-out-from-master) - * [6.4. **_Never_**. push into the `master` branch. **_Always_** submit a Pull Request](#64-_never_-push-into-the-master-branch-_always_-submit-a-pull-request) - * [6.5. Submit a Pull Request as soon as possible.](#65-submit-a-pull-request-as-soon-as-possible) - * [6.6. Rebase your local `master` branch before you ask for PR approvals.](#66-rebase-your-local-master-branch-before-you-ask-for-pr-approvals) - * [6.7. Resolve rebase conflicts before Pull Request reviews.](#67-resolve-rebase-conflicts-before-pull-request-reviews) - * [6.8. Add reviewers and the label `Status: Needs Review` when the topic branch is ready.](#68-add-reviewers-and-the-label-status-needs-review-when-the-topic-branch-is-ready) - * [6.9. Delete local and remote topic branches after merging.](#69-delete-local-and-remote-topic-branches-after-merging) - * [6.10. Protect your `master` branch.](#610-protect-your-master-branch) - * [6.2. **Feature-branch-workflow**](#62-feature-branch-workflow) - * [6.2.1. Initialize a Git repository in the product directory (_for new repositories only_).](#621-initialize-a-git-repository-in-the-product-directory-_for-new-repositories-only_) - * [6.2.2. Checkout a new `feat`ure or `fix` branch.](#622-checkout-a-new-feature-or-fix-branch) - * [6.2.3. Make Changes.](#623-make-changes) - * [6.2.4. Follow the Conventional Commits Specification for commit messages.](#624-follow-the-conventional-commits-specification-for-commit-messages) - * [6.2.5. Sync with remote to get changes you’ve missed.](#625-sync-with-remote-to-get-changes-youve-missed) - * [6.2.6. Update your topic branch with the latest changes from `master` by interactive rebase.](#626-update-your-topic-branch-with-the-latest-changes-from-master-by-interactive-rebase) - * [6.2.7. Resolve conflicts (if any occur), and continue rebase.](#627-resolve-conflicts-if-any-occur-and-continue-rebase) +- [5. Formatting and verifying your sources' quality](#5-formatting-and-verifying-your-sources-quality) +- [6. Git rules](#6-git-rules) + * [6.1. _Always_ create a topic branch or fork from `master`](#61-_always_-create-a-topic-branch-or-fork-from-master) + * [6..2. Favor the branch naming convention `GH-{ISSUE_NUMBER}--[-]`](#62-favor-the-branch-naming-convention-gh-issue_number---) + * [6.3. **_Never_** push into the `master` branch. **_Always_** submit a Pull Request](#63-_never_-push-into-the-master-branch-_always_-submit-a-pull-request) + * [6.4. Submit a Pull Request as soon as possible](#64-submit-a-pull-request-as-soon-as-possible) + * [6.5. Add reviewers and the label `Status: Needs Review` when the topic branch is ready](#65-add-reviewers-and-the-label-status-needs-review-when-the-topic-branch-is-ready) + * [6.6. Delete local and remote topic branches after merging](#66-delete-local-and-remote-topic-branches-after-merging) + * [6.7. Protect the `master` branch](#67-protect-the-master-branch) + * [6.8. GitHub workflow](#68-github-workflow) + * [6.8.1. Initialize a Git repository in the product directory (_for new repositories only_).](#681-initialize-a-git-repository-in-the-product-directory-_for-new-repositories-only_) + * [6.8.2. Checkout a new `feat`ure or `fix` branch.](#682-checkout-a-new-feature-or-fix-branch) + * [6.8.3. Make Changes.](#683-make-changes) + * [6.8.4. Follow the Conventional Commits Specification for commit messages.](#684-follow-the-conventional-commits-specification-for-commit-messages) + * [6.8.5. Sync with remote to get changes you’ve missed.](#685-sync-with-remote-to-get-changes-youve-missed) + * [6.8.6. Update your topic branch with the latest changes from `master` by interactive rebase](#686-update-your-topic-branch-with-the-latest-changes-from-master-by-interactive-rebase) + * [6.2.7. Resolve conflicts (if any occur), and continue rebase](#627-resolve-conflicts-if-any-occur-and-continue-rebase) * [6.2.8. Push your branch with the `-f` flag (if necessary).](#628-push-your-branch-with-the--f-flag-if-necessary) - * [6.2.9. Submit a Pull Request.](#629-submit-a-pull-request) - * [6.2.10. Once accepted, the Pull request will be merged, closed, and deleted by an administrator.](#6210-once-accepted-the-pull-request-will-be-merged-closed-and-deleted-by-an-administrator) - * [6.2.11. Remove your local topic branch if you're done.](#6211-remove-your-local-topic-branch-if-youre-done) -- [3. **Code standards**](#3-code-standards) - * [3.1. Use the Standard JS Style.](#31-use-the-standard-js-style) - * [3.2. Use ESLint to analyze source code.](#32-use-eslint-to-analyze-source-code) -- [4. **Unit testing**](#4-unit-testing) - * [4.1. Write Jest tests.](#41-write-jest-tests) - * [4.2. Reach 100% code coverage.](#42-reach-100%25-code-coverage) -- [5. **Directory structure**](#5-directory-structure) -- [6. **Logging**](#6-logging) -- [7. **Dependencies**](#7-dependencies) - * [7.1. Production](#71-production) - * [7.2. Development](#72-development) - * [7.3. Optional](#73-optional) -- [8. **APIs**](#8-apis) - * [8.1 **API design**](#81-api-design) - * [8.2 **API security**](#82-api-security) - * [8.3 **API documentation**](#83-api-documentation) -- [9. **Licensing**](#9-licensing) + * [6.2.9. Submit a Pull Request](#629-submit-a-pull-request) + * [6.2.10. Remove your local topic branch if you're done](#6210-remove-your-local-topic-branch-if-youre-done) +- [7. **Code standards**](#7-code-standards) + * [7.1. Use the Standard JS Style](#71-use-the-standard-js-style) + * [7.2. Use ESLint to analyze source code.](#72-use-eslint-to-analyze-source-code) +- [8. **Unit testing**](#8-unit-testing) + * [8.1. Write Jest tests](#81-write-jest-tests) + * [8.2. Reach 100% code coverage](#82-reach-100%25-code-coverage) +- [9. **Directory structure**](#9-directory-structure) +- [10. **Logging**](#10-logging) +- [11. **Dependencies**](#11-dependencies) + * [11.1. Production](#111-production) + * [11.2. Development](#112-development) +- [12. **Licensing**](#12-licensing) ## 1. Prerequisite software @@ -60,7 +51,7 @@ Before you can build and test readme-inspector, you must install and configure the following products on your development machine: -1. [Git](http://git-scm.com) and/or the \**GitHub app*1. (for [Mac](http://mac.github.com) or +1. [Git](http://git-scm.com) and/or the **GitHub app** (for [Mac](http://mac.github.com) or [Windows](http://windows.github.com)); [GitHub's Guide to Installing Git](https://help.github.com/articles/set-up-git) is a good source of information. @@ -75,7 +66,7 @@ Fork and clone the readme-inspector repository: 1. [**Sign in**](https://github.com/login) to your GitHub account or [sign up for a (free) GitHub account](https://github.com/join). 2. [**Fork**](http://help.github.com/forking) the [main readme-inspector repository](https://github.com/commonality/readme-inspector) (aka, "`origin`"). -3. \**Clone your fork*1. of the readme-inspector repository and define an `upstream` remote pointing back to the readme-inspector repository that you forked in the first place. +3. **Clone your fork** of the readme-inspector repository and define an `upstream` remote pointing back to the readme-inspector repository that you forked in the first place. ```shell # Clone your GitHub repository: @@ -99,7 +90,7 @@ npm install ## 4. Building -![info][octicon-info] There are no build tasks for versions 1.x.x of readme-inspector. +![info][octicon-info] There are currently no build tasks for readme-inspector. ## 5. Running tests @@ -119,18 +110,19 @@ $ npm run test:watch > > ![bug][octicon-bug] See [DEBUG.md](DEBUG.md) for information on debugging the code while running the unit tests. -All the tests are executed on our Continuous Integration infrastructure and a PR could only be merged once the tests pass. +All tests are executed with Continuous Integration services. -1. CircleCI fails if your code is not formatted properly, -1. Travis CI fails if any of the test suites described above fails. +1. We test on Node.js versions `9`, `8`, and `7.6.0` on Windows, Mac, and Ubuntu operating systems. +1. PRs will only be merged once all tests pass. +1. Travis CI will fail if any of the test suites fails, or a linting rule is violated. -## 5. Formatting and verifying your sources +## 5. Formatting and verifying your sources' quality ![verified][octicon-verified] readme-inspector uses 1. [ESLint](http://clang.llvm.org/docs/ClangFormat.html) to evaluate and format source code; -1. [Fixpack]() to order all `package.json` properties in alphabetical order; and -1. [Prettier]() to format JSON, Markdown, and YAML. +1. [Fixpack](https://www.npmjs.com/package/fixpack) to order all `package.json` properties consistently; and +1. [Prettier](https://www.npmjs.com/package/eslint-plugin-prettier) to format JSON, Markdown, and YAML. You can both evaluate and format your all sources by running: @@ -158,90 +150,136 @@ npm run lint:md > ![alert][octicon-alert] If the source code does not pass linting, the CI will fail and the PR can not be merged. -## 6. Git guidelines +## 6. Git rules ![Git Logo][icon-git-logo-image] -`readme-inspector` manages contributions with the [feature-branch-workflow](https://www.atlassian.com/git/tutorials/comparing-workflows#feature-branch-workflow). +`readme-inspector` manages contributions with the [GitHub Flow](https://guides.github.com/introduction/flow/): +**anything in the `master` branch is _always_ deployable**. -### 6.1. Makes changes in a topic branch +### 6.1. _Always_ create a topic branch or fork from `master` _Why:_ -> ⌦ Use an isolated topic branch for parallel product development. Topic branches allow you to submit multiple pull requests without confusion. You can iterate without polluting the master branch with potentially unstable, unfinished code. The `readme-inspector` team uses: -> -> 1. [Feature-branch-workflow](https://www.atlassian.com/git/tutorials/comparing-workflows#feature-branch-workflow) for small-ish codebases, or -> 1. [Gitflow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows#gitflow-workflow) for large applications and monoliths +> ⌦ Use an isolated topic branch for parallel product development. Topic branches allow you to submit multiple pull requests without confusion. You can iterate without polluting the `master` branch with potentially unstable, unfinished code. -### 6..2. Favor the topic branch naming convention `GH-{ISSUE_NUMBER}-type-scope` +### 6..2. Favor the branch naming convention `GH-{ISSUE_NUMBER}--[-]` _Why:_ -> ⌦ Although not required, our team prefixes branches with the GitHub issue number, followed by the type of change being introduced, followed by the scope of changes. +> ⌦ Although not required, our team +> +> 1. Prefixes branches with the GitHub issue number in the format +> +> ```shell +> GH-{ISSUE_NUMBER} +> ``` > -> **Examples:** +> followed by > -> 1. **feat**: a new feature, e.g., `GH-1-feat-cli-add-authz`. -> 1. **fix**: a defect/bug repair, e.g., `GH-2-fix-api-logging-error`. -> 1. **build**: changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm), e.g., `GH-8-build-add-markdown-toc`. -> 1. **chore**: changes that don't modify src or test files, e.g., `GH-10-remove-unused-files`. -> 1. **ci**: changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs), e.g., `GH-9-ci-travis-deploy-semantic-release`. -> 1. **docs**: documentation changes, e.g., `GH-3-docs-readme-revise-api`. -> 1. **perf**: change that improves performance `GH-6-perf-quicksort`. -> 1. **refactor**: code changes that improve design, but neither fixes a bug nor adds a feature, e.g., `GH-5-refactor-extract-class`. -> 1. **revert**: reverts a previous commit, e.g., `GH-11-revert-7f87cc2`. -> 1. **style**: changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc), e.g., `GH-4-style-lint`. -> 1. **test**: add missing tests or correct existing tests, e.g., `GH-7-test-complete-coverage`. - -### 6.3. Branch out from `master`. +> 1. The `` or "kind" of change being introduced, followed by +> 1. The `` of change, (the feature or module that is changing), followed by +> 1. An _optional_ short, descriptive ``. -_Why:_ +_Examples:_ -> ⌦ `readme-inspector` follows the feature-branch-workflow. +> 1. **feat**: a new feature, e.g., +> +> ```shell +> GH-1-feat-cli-add-authz +> ``` +> +> 1. **fix**: a defect/bug repair, e.g., `GH-2-fix-api-logging-error` +> +> ```shell +> GH-1-feat-cli-add-authz +> ``` +> +> 1. **build**: changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm), e.g., `GH-8-build-add-markdown-toc` +> +> ```shell +> GH-1-feat-cli-add-authz +> ``` +> +> 1. **chore**: changes that don't modify src or test files, e.g., `GH-10-remove-unused-files` +> +> ```shell +> GH-1-feat-cli-add-authz +> ``` +> +> 1. **ci**: changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs), e.g.: +> +> ```shell +> GH-9-ci-travis-deploy-semantic-release +> ``` +> +> 1. **docs**: documentation changes, e.g.: +> +> ```shell +> GH-3-docs-readme-revise-api +> ``` +> +> 1. **perf**: change that improves performance, e.g.: +> +> ```shell +> GH-6-perf-quicksort +> ``` +> +> 1. **refactor**: code changes that improve design, but neither fixes a bug nor adds a feature, e.g.: +> +> ```shell +> GH-5-refactor-extract-class +> ``` +> +> 1. **revert**: reverts a previous commit, e.g.: +> +> ```shell +> GH-11-revert-7f87cc2 +> ``` +> +> 1. **style**: changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc), e.g.: +> +> ```shell +> GH-4-style-lint +> ``` +> +> 1. **test**: add missing tests or correct existing tests, e.g.: +> +> ```shell +> GH-7-test-complete-coverage +> ``` -### 6.4. **_Never_**. push into the `master` branch. **_Always_** submit a Pull Request +### 6.3. **_Never_** push into the `master` branch. **_Always_** submit a Pull Request _Why:_ -> ⌦ It notifies team members whenever changes occur and allows the community to review your changes at any time.. +> ⌦ It notifies team members whenever changes occur and allows the community to review your changes at any time. > -> It also enables easy peer-review of the code and dedicates forum for discussing the proposed feature. +> ⌦ It also enables easy peer-review of the code and dedicates forum for discussing the proposed feature. -### 6.5. Submit a Pull Request as soon as possible. +### 6.4. Submit a Pull Request as soon as possible _Why:_ > ⌦ Pull Requests declare work in progress. Frequent pushes to a Pull Request notify your team members about change, and gives them the opportunity to provide feedback more often. > -> Pull Request pushes also trigger automated CI-services, which help you fail fast and assess quality. +> ⌦ Pull Request pushes also trigger automated CI-services, which help you fail fast and assess quality. -### 6.6. Rebase your local `master` branch before you ask for PR approvals. - -_Why:_ - -> ⌦ Rebasing will merge in the requested branch (`master` or `develop`) and apply the commits that you have made locally to the top of the history without creating a merge commit (assuming there were no conflicts). This results in a nice and clean history. - -### 6.7. Resolve rebase conflicts before Pull Request reviews. - -_Why:_ - -> ⌦ Rebasing will merge in the `master` branch and apply the commits that you have made locally to the top of it. - -### 6.8. Add reviewers and the label `Status: Needs Review` when the topic branch is ready. +### 6.5. Add reviewers and the label `Status: Needs Review` when the topic branch is ready _Why:_ > ⌦ When you add a Reviewer, GitHub (or Bitbucket) notifies teammates that your topic branch meets all Acceptance Criteria and is ready to be merged into `master`. > -> Add the label "Status: Review Needed" formally declares the status of your topic branch, and helps teams filter through issues. +> Add the label Status: Review Needed and someone in the community will take a look. -### 6.9. Delete local and remote topic branches after merging. +### 6.6. Delete local and remote topic branches after merging _Why:_ > ⌦ Topic branches should only exist while work is in-progress. Merged topic branches clutter up your list of branches with dead branches. Topic branch deletion also insures that you only ever merge back into `master`. -### 6.10. Protect your `master` branch. +### 6.7. Protect the `master` branch _Why:_ @@ -250,11 +288,11 @@ _Why:_ > 1. [GitHub protected branches](https://help.github.com/articles/about-protected-branches/) and > 1. [Bitbucket protected branches](https://confluence.atlassian.com/bitbucketserver/using-branch-permissions-776639807.html). -### 6.2. **Feature-branch-workflow** +### 6.8. GitHub workflow We use the [feature-branch-workflow](https://www.atlassian.com/git/tutorials/comparing-workflows#feature-branch-workflow). We _recommend_ [interactive rebasing](https://www.atlassian.com/git/tutorials/merging-vs-rebasing#the-golden-rule-of-rebasing), too, but that's not required. -### 6.2.1. Initialize a Git repository in the product directory (_for new repositories only_). +### 6.8.1. Initialize a Git repository in the product directory (_for new repositories only_). For subsequent features and changes, this step should be ignored. @@ -263,7 +301,7 @@ cd git init ``` -### 6.2.2. Checkout a new `feat`ure or `fix` branch. +### 6.8.2. Checkout a new `feat`ure or `fix` branch. ```sh # For a new feature branch: @@ -273,7 +311,7 @@ git checkout -b GH--feat-scope-of-change git checkout -b GH--fix-scope-of-change ``` -### 6.2.3. Make Changes. +### 6.8.3. Make Changes. ```sh git add @@ -284,13 +322,33 @@ _Why:_ > ⌦ `git commit -a` will start an editor which lets you separate the subject from the body. Read more about it in _section 1.3_. -### 6.2.4. Follow the Conventional Commits Specification for commit messages. +### 6.8.4. Follow the Conventional Commits Specification for commit messages. This project enforces [AngularJS Git Commit Guidelines][git-commit-guidelines-url] (which is now an extension of the [Conventional Commits Specfication][conventional-commits-url]) with [`commitplease`][commitplease-url] pre-commit hooks. _Why:_ -> Consistent, legible Git logs not only facilitate communication, but also enable automated `CHANGELOG` generation and semantic versioning with [`standard-version`][standard-version-url]. +> Consistent, legible Git logs not only facilitate communication, but also enable automated `CHANGELOG` generation and semantic versioning with [`standard-version`][standard-version-url] and [`semantic-release`][semantic-release-url]. + +--- + +
    Click here for conventional commit definitions with examples.

    + +1. **`BREAKING CHANGES` commit messages** + + Commits that change the public API of your product. + + > ![info][octicon-info] BREAKING CHANGES result in a MAJOR version bump. + + ```shell + (): + + BREAKING CHANGE: + + + +

    + ``` 1. **`build` commit messages** @@ -426,7 +484,11 @@ _Why:_
    ``` -### 6.2.5. Sync with remote to get changes you’ve missed. +

    + +--- + +### 6.8.5. Sync with remote to get changes you’ve missed. ```shell git checkout master @@ -437,7 +499,7 @@ _Why:_ > ⌦ This will give you a chance to deal with conflicts on your machine while rebasing(later) rather than creating a Pull Request that contains conflicts. -### 6.2.6. Update your topic branch with the latest changes from `master` by interactive rebase. +### 6.8.6. Update your topic branch with the latest changes from `master` by interactive rebase ```sh git checkout @@ -450,7 +512,7 @@ _Why:_ > > [Learn more about autosquashing Git commits][autosquashing-git-commits-url]. -### 6.2.7. Resolve conflicts (if any occur), and continue rebase. +### 6.2.7. Resolve conflicts (if any occur), and continue rebase ```sh git add ... @@ -473,14 +535,14 @@ _Why:_ > > [Learn more about `--force-with-lease`][force-with-lease-url]. -### 6.2.9. Submit a Pull Request. +### 6.2.9. Submit a Pull Request -### 6.2.10. Once accepted, the Pull request will be merged, closed, and deleted by an administrator. +Once accepted, the Pull request will be approved, merged, closed, and deleted by an administrator. -### 6.2.11. Remove your local topic branch if you're done. +### 6.2.10. Remove your local topic branch if you're done ```sh -git branch -d +git branch -D ``` to remove all branches which are no longer on remote @@ -492,15 +554,15 @@ git fetch -p && \ done ``` -## 3. **Code standards** +## 7. **Code standards** [![JavaScript Style Guide][standard-js-badge-image]][standard-js-url] [![ESLint logo][eslint-logo-image]][eslint-url] -### 3.1. Use the Standard JS Style. +### 7.1. Use the Standard JS Style `readme-inspector` follows the [Standard JS Style][standard-js-url]. -### 3.2. Use ESLint to analyze source code. +### 7.2. Use ESLint to analyze source code. _Why:_ @@ -514,25 +576,25 @@ npm run lint:js View [`readme-inspector's` ESLint rules][eslint-rules-table-url] and their enforcement. -## 4. **Unit testing** +## 8. **Unit testing** [![Jest JavaScript Testing][jest-logo-image]][jest-url] -### 4.1. Write Jest tests. +### 8.1. Write Jest tests _Why:_ > ⌦ Behavior-driven development specifications are executable documentation. -1. **Put test files in the \*\*test\*\1. directory.** +1. **Put test files in the `__tests__` directory.** -1. **Use the `.spec.js` suffix for all tests.** +1. **Use the `.test.js` suffix for all tests.** -### 4.2. Reach 100% code coverage. +### 8.2. Reach 100% code coverage _Why:_ -> ⌦ Full coverage makes automated dependency drift updates safer. +> ⌦ Full coverage makes automated dependency drift updates safer, which also allows more people to work on the product at the same time. 1. View a test coverage summary in the Terminal: @@ -559,23 +621,27 @@ _Why:_ ----------|----------|----------|----------|----------|----------------| ``` -1. Open `/coverage/lcov-report/index.html` in a Web browser to view detailed coverage reports. +> ![info][octicon-info] Open `/lib/__tests__/coverage/lcov-report/index.html` in a Web browser to view detailed coverage reports. + +## 9. **Directory structure** -## 5. **Directory structure** +file-directory -> `node_modules` has been excluded for brevity. +> ![info][octicon-info] `node_modules` has been excluded for brevity. ```text ``` -## 6. **Logging** +## 10. **Logging** -`readme-inspector` uses [`bunyan`](https://github.com/trentm/node-bunyan) for logging. +eye `readme-inspector` uses [`bunyan`](https://github.com/trentm/node-bunyan) for logging. -## 7. **Dependencies** +## 11. **Dependencies** -### 7.1. Production +package + +### 11.1. Production `readme-inspector` requires the following dependencies to operate. @@ -595,7 +661,7 @@ _Why:_ | [meow@4.0.0](https://github.com/sindresorhus/meow#readme) | CLI app helper | 4.0.0 | MIT | production | -### 7.2. Development +### 11.2. Development `readme-inspector` uses the the following dependencies to build, test, or deploy: @@ -647,335 +713,9 @@ _Why:_ | [standard-version@4.3.0](https://github.com/conventional-changelog/standard-version#readme) | replacement for `npm version` with automatic CHANGELOG generation | 4.3.0 | ISC | dev | -### 7.3. Optional - - -| **Dependency** | **Description** | **Version** | **License** | **Type** | -| -------------- | --------------- | ----------- | ----------- | -------- | - - -## 8. **APIs** - -![APIs][icon-rest-api-image] - -### 8.1 **API design** - -We try to enforce development of sanely constructed RESTful interfaces, which team members and clients can consume simply and consistently. - -Lack of consistency and simplicity can massively increase integration and maintenance costs, which is why `API design` is included in this document. - -1. We mostly follow resource-oriented design. It has three main factors: resources, collection, and URLs. - -1. A resource has data, gets nested, and there are methods that operate against it. -1. A group of resources is called a collection. -1. URL identifies the online location of resource or collection. - - _Why:_ - - > ⌦ This is a very well-known design to developers (your main API consumers). Apart from readability and ease of use, it allows us to write generic libraries and connectors without even knowing what the API is about. - -1. Use kebab-case for URLs. -1. Use camelCase for parameters in the query string or resource fields. -1. Use plural kebab-case for resource names in URLs. - -1. Always use a plural nouns for naming a url pointing to a collection: `/users`. - - _Why:_ - - > ⌦ Basically, it reads better and keeps URLs consistent. [read more...](https://apigee.com/about/blog/technology/restful-api-design-plural-nouns-and-concrete-names) - -1. In the source code convert plurals to variables and properties with a List suffix. - - _Why_: - - > ⌦ Plural is nice in the URL but in the source code, it’s just too subtle and error-prone. - -1. Always use a singular concept that starts with a collection and ends to an identifier: - - ```http - /students/245743 - /airports/kjfk - ``` - -1. Avoid URLs like this: - - ```http - GET /blogs/:blogId/posts/:postId/summary - ``` - - _Why:_ - - > ⌦ This is not pointing to a resource but to a property instead. You can pass the property as a parameter to trim your response. - -1. Keep verbs out of your resource URLs. - - _Why:_ - - > ⌦ Because if you use a verb for each resource operation you soon will have a huge list of URLs and no consistent pattern which makes it difficult for developers to learn. Plus we use verbs for something else. - -1. Use verbs for non-resources. In this case, your API doesn't return any resources. Instead, you execute an operation and return the result. These \**are not*1. CRUD (create, retrieve, update, and delete) operations: - - ```http - /translate?text=Hallo - ``` - - _Why:_ - - > ⌦ Because for CRUD we use HTTP methods on `resource` or `collection` URLs. The verbs we were talking about are actually `Controllers`. You usually don't develop many of these. [read more...](https://byrondover.github.io/post/restful-api-guidelines/#controller) - -1. The request body or response type is JSON then please follow `camelCase` for `JSON` property names to maintain the consistency. - - _Why:_ - - > ⌦ This is a JavaScript project guideline, Where Programming language for generating JSON as well as Programming language for parsing JSON are assumed to be JavaScript. - -1. Even though a resource is a singular concept that is similar to an object instance or database record, you should not use your `table_name` for a resource name and `column_name` resource property. - - _Why:_ - - > ⌦ Because your intention is to expose Resources, not your database schema details. - -1. Again, only use nouns in your URL when naming your resources and don’t try to explain their functionality. - - _Why:_ - - > ⌦ Only use nouns in your resource URLs, avoid endpoints like `/addNewUser` or `/updateUser` . Also avoid sending resource operations as a parameter. - -1. Explain the CRUD functionalities using HTTP methods: - - _How:_ - - > `GET`: Retrieve a representation of a resource. - > - > `POST`: Create new resources and sub-resources. - > - > `PUT`: Replace existing resources. - > - > `PATCH`: Update existing resources. It only updates the fields that were supplied, leaving the others alone. - > - > `DELETE`: Delete existing resources. - -1. For nested resources, use the relation between them in the URL. For instance, using `id` to relate an employee to a company. - - _Why:_ - - > ⌦ This is a natural way to make resources explorable. - > - > _How:_ - > - > `GET /schools/2/students` , should get the list of all students from school 2. - > - > `GET /schools/2/students/31` , should get the details of student 31, which belongs to school 2. - > - > `DELETE /schools/2/students/31` , should delete student 31, which belongs to school 2. - > - > `PUT /schools/2/students/31` , should update info of student 31, Use PUT on resource-URL only, not collection. - > - > `POST /schools` , should create a new school and return the details of the new school created. Use POST on collection-URLs. - -1. Use a simple ordinal number for a version with a `v` prefix (v1, v2). Move it all the way to the left in the URL so that it has the highest scope: - - ```http - http://api.domain.com/v1/schools/3/students - ``` - - _Why:_ - - > ⌦ When your APIs are public for other third parties, upgrading the APIs with some breaking change would also lead to breaking the existing products or services using your APIs. Using versions in your URL can prevent that from happening. [read more...](https://apigee.com/about/blog/technology/restful-api-design-tips-versioning) - -1. Response messages must be self-descriptive. A good error message response might look something like this: - - ```json - { - "code": 404, - "level": "ERROR", - "logger": "[http-logger]", - "message": - "No resource found at URL /archetypes/v1/locales/iso-country-codes/BS", - "timestamp": 1504878062000 - } - ``` - - or for validation errors: - - ```json - { - "code": 400, - "logger": "[registration-form-logger]", - "level": "ERROR", - "timestamp": 1504878062000, - "message": "Validation Failed", - "stack": [ - { - "code": 1233, - "field": "email", - "message": "Invalid email" - }, - { - "code": 1234, - "field": "password", - "message": "No password provided" - } - ] - } - ``` - - _Why:_ - - > ⌦ Developers depend on well-designed errors at the critical times when they are troubleshooting and resolving issues after the applications they've built using your APIs are in the hands of their users. - - --- - - _![alert][octicon-alert] **Keep security exception messages as generic as possible.**_ For instance, instead of saying ‘incorrect password’, you can reply back saying ‘invalid username or password’ so that we don’t unknowingly inform user that username was indeed correct and only the password was incorrect. - - --- - -1. Use only these 8 status codes to send with you response to describe whether **everything worked**, - The **client app did something wrong\*1. or The **API did something wrong\*\*. - - _Which ones:_ - - > `200 OK` response represents success for `GET`, `PUT` or `POST` requests. - > - > `201 Created` for when new instance is created. Creating a new instance, using `POST` method returns `201` status code. - > - > `304 Not Modified` response is to minimize information transfer when the recipient already has cached representations. - > - > `400 Bad Request` for when the request was not processed, as the server could not understand what the client is asking for. - > - > `401 Unauthorized` for when the request lacks valid credentials and it should re-request with the required credentials. - > - > `403 Forbidden` means the server understood the request but refuses to authorize it. - > - > `404 Not Found` indicates that the requested resource was not found. - > - > `500 Internal Server Error` indicates that the request is valid, but the server could not fulfill it due to some unexpected condition. - - _Why:_ - - > ⌦ Most API providers use a small subset HTTP status codes. For example, the Google GData API uses only 10 status codes, Netflix uses 9, and Digg, only 8. Of course, these responses contain a body with additional information.There are over 70 HTTP status codes. However, most developers don't have all 70 memorized. So if you choose status codes that are not very common you will force application developers away from building their apps and over to wikipedia to figure out what you're trying to tell them. [read more...](https://apigee.com/about/blog/technology/restful-api-design-what-about-errors) - -1. Provide total numbers of resources in your response. -1. Accept `limit` and `offset` parameters. - -1. The amount of data the resource exposes should also be taken into account. The API consumer doesn't always need the full representation of a resource.Use a fields query parameter that takes a comma separated list of fields to include: - - ```http - GET /student?fields=id,name,age,class - ``` - -1. Pagination, filtering, and sorting don’t need to be supported from start for all resources. Document those resources that offer filtering and sorting. - -### 8.2 **API security** - -These are some basic security best practices: - -1. Don't use basic authentication unless over a secure connection (HTTPS). Authentication tokens must not be transmitted in the URL: `GET /users/123?token=asdf....` - - _Why:_ - - > ⌦ Because Token, or user ID and password are passed over the network as clear text (it is base64 encoded, but base64 is a reversible encoding), the basic authentication scheme is not secure. [read more...](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication) - -1. Tokens must be transmitted using the Authorization header on every request: `Authorization: Bearer xxxxxx, Extra yyyyy`. - -1. Authorization Code should be short-lived. - -1. Reject any non-TLS requests by not responding to any HTTP request to avoid any insecure data exchange. Respond to HTTP requests by `403 Forbidden`. - -1. Consider using Rate Limiting. - - _Why:_ - - > ⌦ To protect your APIs from bot threats that call your API thousands of times per hour. You should consider implementing rate limit early on. - -1. Setting HTTP headers appropriately can help to lock down and secure your web application. [read more...](https://github.com/helmetjs/helmet) - -1. Your API should convert the received data to their canonical form or reject them. Return 400 Bad Request with details about any errors from bad or missing data. - -1. All the data exchanged with the ReST API must be validated by the API. - -1. Serialize your JSON. - - _Why:_ - - > ⌦ A key concern with JSON encoders is preventing arbitrary JavaScript remote code execution within the browser... or, if you're using node.js, on the server. It's vital that you use a proper JSON serializer to encode user-supplied data properly to prevent the execution of user-supplied input on the browser. - -1. Validate the content-type and mostly use `application/*json` (Content-Type header). - - _Why:_ - - > ⌦ For instance, accepting the `application/x-www-form-urlencoded` mime type allows the attacker to create a form and trigger a simple POST request. The server should never assume the Content-Type. A lack of Content-Type header or an unexpected Content-Type header should result in the server rejecting the content with a `4XX` response. - -### 8.3 **API documentation** - -1. Fill the \**API*1. section in the README for API. -1. Describe API authentication methods with a code sample. -1. Explaining The URL Structure (path only, no root URL) including The request type (Method). For each endpoint explain: - -1. URL Params If URL Params exist, specify them in accordance with name mentioned in URL section: - - ```http - Required: id=[integer] - Optional: photo_id=[alphanumeric] - ``` - -1. If the request type is POST, provide working examples. URL Params rules apply here too. Separate the section into Optional and Required. - -1. \**Success Responses.*1. What should be the status code and is there any return data? This is useful when people need to know what their callbacks should expect: - - ```http - Code: 200 - Content: { id : 12 } - ``` - -1. \**Error Responses.*1. Most endpoints have many ways to fail. From unauthorized access to wrongful parameters etc. All of those should be listed here. It might seem repetitive, but it helps prevent assumptions from being made. For example: - - - 1. **HTTP status code** - - ```http - 404 Not Found - ``` - - 1. **Response body** - - ```json - { - "code": 404, - "level": "ERROR", - "logger": "[http-logger]", - "message": - "No resource found at URL /archetypes/v1/locales/iso-country-codes/BS", - "timestamp": 1504878062000 - } - ``` - - 1. **Response headers** - - ```http - accept-ranges: bytes - access-control-allow-headers: Authorization - access-control-allow-methods: GET, HEAD, OPTIONS - access-control-allow-origin: * - cache-control: public, no-transform, must-revalidate - connection: keep-alive - content-encoding: gzip - content-language: en-US - content-length: 149 - content-type: application/json - date: Fri, 08 Sep 2017 06:41:02 GMT - last-modified: Tue, 1 Oct 2014 10:10:10 GMT - server: nginx/1.12.1 - vary: Accept-Encoding - ``` - -1. Use API design tools, There are lots of open source tools for good documentation such as [API Blueprint](https://apiblueprint.org/) and [Swagger](https://swagger.io/). - -## 9. **Licensing** - -![Licensing][osi-logo-image] +## 12. **Licensing** -Make sure you use resources that you have the rights to use. If you use libraries, remember to look for MIT, Apache or BSD but if you modify them, then take a look into license details. Copyrighted images and videos may cause legal problems. +law Make sure you use resources that you have the rights to use. If you use libraries, remember to look for MIT, Apache or BSD but if you modify them, then take a look into license details. Copyrighted images and videos may cause legal problems. @@ -1031,8 +771,9 @@ Make sure you use resources that you have the rights to use. If you use librarie [stackshare-url]: https://stackshare.io/commonality/readme-inspector [standard-js-badge-image]: https://cdn.rawgit.com/standard/standard/master/badge.svg [standard-js-url]: https://github.com/standard/standard -[standard-version-url]: https://github.com/conventional-changelog/standard-version +[standard-version-url]: https://github.com/semantic-release/semantic-releasehttps://github.com/conventional-changelog/standard-version [tech-stack-image]: ./assets/img/icons8/icon-package-filled.png +[semantic-release-url]: https://github.com/semantic-release/semantic-release diff --git a/docs/project/architecture-decision-records.md b/docs/project/architecture-decision-records.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/project/architecture-decision-records.md @@ -0,0 +1 @@ + diff --git a/lib/index.js b/lib/index.js index 8ff3289..58f5383 100644 --- a/lib/index.js +++ b/lib/index.js @@ -4,7 +4,7 @@ /* * Load required environment variables - * @see /lib/.env.example + * @see /.env.example * @private * @ignore */ @@ -151,11 +151,14 @@ const readmeInspector = { }) { const info = await readmeInspector.getInfo(params) if (info.isPresent) { - info.appraisal = await readmeInspector.getAppraisal(`${params.owner}/${params.repo}`) + info.appraisal = + await readmeInspector.getAppraisal(`${params.owner}/${params.repo}`) } return info }, + envConfig, + /** * An API proxy for the readme-score-api, which provides quality * measures for README files with the {@link appraisalData AppraisalData}