diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index fc52275c..053ea539 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,2 @@ -# All changes should be reviewed by iBL -* @bbc/ibl +# All changes should be reviewed by codeowners +* @bbc/ibl @bbc/detl-engineers \ No newline at end of file diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..5371fe52 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct (CoC) + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behaviour that contributes to a positive environment for our community include: + +- Respect different opinions, perspectives, and experiences +- Giving and appreciating constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +- Focusing on what is best for us as individuals and the overall community +- Demonstrating kindness toward other people + +Examples of unacceptable behaviour include: + +- The use of sexualised language or imagery, and sexual attention or advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others’ private information, such as a physical or email address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Enforcement Responsibilities + +Project maintainers are responsible for clarifying and enforcing our standards of acceptable behaviour and will take appropriate and fair corrective action in response to any behaviour that they deem inappropriate, threatening, offensive, or harmful. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behaviour may be reported to the community leaders responsible for enforcement. All complaints will be reviewed and investigated promptly and fairly. + +[Project maintainers](https://github.com/bbc/sqs-consumber/blob/main/.github/CODEOWNERS) are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +### 1. Correction + +Community Impact: Use of inappropriate language or other behaviour deemed unprofessional or unwelcome in the community. + +Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behaviour was inappropriate. A public apology may be requested. + +### 2. Warning + +Community Impact: A violation through a single incident or series of actions. + +Consequence: A warning with consequences for continued behaviour. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +Community Impact: A serious violation of community standards, including sustained inappropriate behaviour. + +Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behaviour, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +Consequence: A permanent ban from any sort of public interaction within the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][version] + +[homepage]: https://contributor-covenant.org +[version]: https://www.contributor-covenant.org/version/2/0/code_of_conduct/ diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d5bbae72..c9152b09 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -9,9 +9,8 @@ Thank you for your interest in contributing to the sqs-consumer. * Maintain the existing coding style. There are some settings in `.jsbeautifyrc` to help. * Be mindful of others when making suggestions and/or code reviewing. - - ## Reporting Issues + Before opening a new issue, first check that there is not already an [open issue or Pull Request](https://github.com/bbc/sqs-consumer/issues?utf8=%E2%9C%93&q=is%3Aopen) that addresses it. If there is, make relevant comments and add your reaction. Use a reaction in place of a "+1" comment: @@ -25,7 +24,8 @@ If you cannot find an existing issue that describes your bug or feature, create 3. Follow your issue in the issue tracking workflow ## Contributing Code -If you do not have push access to the repository, please [fork it](https://help.github.com/en/articles/fork-a-repo). You should then work on your own `master` branch. + +If you do not have push access to the repository, please [fork it](https://help.github.com/en/articles/fork-a-repo). You should then work on your own `main` branch. Otherwise, you may clone this repository and create a working branch with a _kebab-case_ name reflecting what you are working on (e.g. `fix-the-thing`). @@ -34,6 +34,7 @@ Follow the setup instructions in the [README](../README.md). Ensure all your code is thoroughly tested and that this testing is detailed in the pull request. ## Pull Request Process + 1. Make sure you have opened an issue and it was approved by a project maintainer before working on a PR 2. Read and complete all relevant sections of the PR template 3. Wait for the PR get approved diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000..66798af4 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,9 @@ +# Security Policy + +## Reporting a Vulnerability + +Our full security policy and vulnerability reporting procedure is documented on [this external website](https://www.bbc.com/backstage/security-disclosure-policy/#reportingavulnerability). + +Please note that this is a general BBC process. Communication will not be direct with the team responsible for this repo. + +If you would like to, you can also open an issue in this repo regarding your disclosure, but please never share any details of the vulnerability in the GitHub issue. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7bb08802..eab9f274 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,20 +1,29 @@ - -## Description - -## Motivation and Context - - -## Types of changes - +Resolves #NUMBER + +**Description:** +_A very high-level summary of easily-reproducible changes that can be understood by non-devs._ + +**Type of change:** + - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) -## Checklist: - - + +**Why is this change required?:** +_A simple explanation of what the problem is and how this PR solves it_ + +**Code changes:** + +- _A bullet point list of key code changes that have been made._ +- _When describing code changes, try to communicate **how** and **why** you implemented something a specific way, not just **what** has changed._ + +--- + +**Checklist:** + - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have read the **CONTRIBUTING** document. - [ ] I have added tests to cover my changes. -- [ ] All new and existing tests passed. +- [ ] All new and existing tests passed. \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..e9e83899 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,19 @@ +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v6 + with: + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.' + close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' + close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.' + days-before-issue-stale: 30 + days-before-pr-stale: 45 + days-before-issue-close: 5 + days-before-pr-close: 10 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..d9c19995 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,41 @@ +name: Run Tests +on: + pull_request: + branches: + - 'main' + push: + branches: + - main +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [16.x] + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Node Modules + run: npm ci + + - name: NPM Audit + run: npx audit-ci + + - name: Unit Tests + run: npm run test + + - name: Coverage Upload + uses: paambaati/codeclimate-action@v2.2.4 + env: + CC_TEST_REPORTER_ID: 2d851f8f3a9348ac4f43262305037f80a730c2660fda50af8ae4d445fd89333b + with: + coverageCommand: npm run lcov \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index acfc54d4..00000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: node_js -node_js: - - "10" - - "12" -addons: - code_climate: - repo_token: 2d851f8f3a9348ac4f43262305037f80a730c2660fda50af8ae4d445fd89333b -after_script: - - npm run lcov - - cat coverage/lcov.info | node_modules/.bin/codeclimate-test-reporter diff --git a/README.md b/README.md index 975651d6..5d6e980d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Build SQS-based applications without the boilerplate. Just define an async funct ## Installation ```bash -npm install sqs-consumer --save +npm install sqs-consumer --save-dev ``` ## Usage @@ -172,4 +172,4 @@ Each consumer is an [`EventEmitter`](http://nodejs.org/api/events.html) and emit Consumer will receive and delete messages from the SQS queue. Ensure `sqs:ReceiveMessage`, `sqs:DeleteMessage`, `sqs:DeleteMessageBatch`, `sqs:ChangeMessageVisibility` and `sqs:ChangeMessageVisibilityBatch` access is granted on the queue being consumed. ### Contributing -See contributing [guidelines](https://github.com/bbc/sqs-consumer/blob/master/.github/CONTRIBUTING.md). +See contributing [guidelines](https://github.com/bbc/sqs-consumer/blob/main/.github/CONTRIBUTING.md).