Skip to content

Commit

Permalink
Implements Markdown, GH Action, YAML, and Shell Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
dvonthenen committed Jul 23, 2024
1 parent f247994 commit ed98d86
Show file tree
Hide file tree
Showing 19 changed files with 654 additions and 83 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/check-actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check - actionlint

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
paths:
- ".github/workflows/**"

jobs:
checkactionlint:
name: Check actionlint
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-js-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps
- name: Run actionlint
run: |
make actionlint
35 changes: 35 additions & 0 deletions .github/workflows/check-all.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check - All linters, etc
on:
push:
branches:
- main
- release-*
tags-ignore:
- "**"

jobs:
build:
name: Change to Main/Release Branch
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-js-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: "1.19"
id: go

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps
- name: Run all checks
shell: bash
run: |
make check
32 changes: 32 additions & 0 deletions .github/workflows/check-mdlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check - mdlint

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
paths:
- "**.md"
- "hack/check/check-mdlint.sh"

jobs:
checkmdlint:
name: Check mdlint
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-js-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps
- name: Run mdlint
run: |
make mdlint
33 changes: 33 additions & 0 deletions .github/workflows/check-shell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Check - shell

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
paths:
- "**/Makefile"
- "**.sh"
- "hack/check/check-shell.sh"

jobs:
checkshell:
name: Check shell
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-js-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps
- name: Run shellcheck
run: |
make shellcheck
31 changes: 31 additions & 0 deletions .github/workflows/check-yaml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check - yaml

on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
paths:
- ".github/workflows/**"

jobs:
checkmdlint:
name: Check mdlint
# Only run this job if we're in the main repo, not a fork.
if: github.repository == 'deepgram/deepgram-js-sdk'
runs-on: ubuntu-latest
steps:

- name: Checkout code by commit
uses: actions/checkout@v4

- name: Ensure dependencies installed
shell: bash
run: |
make ensure-deps
- name: Run mdlint
run: |
make mdlint
7 changes: 7 additions & 0 deletions .markdownlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"default": true,
"line_length": false,
"MD024": { "allow_different_nesting": true },
"MD026": { "punctuation": ".,;:!" },
"MD046": { "style": "fenced" }
}
19 changes: 19 additions & 0 deletions .yamllintconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
extends: relaxed

rules:
line-length: disable
trailing-spaces: enable
new-line-at-end-of-file: enable
new-lines:
type: unix
indentation: disable
key-duplicates: disable
empty-lines: enable
colons: disable
commas: disable

ignore: |
# /deepgram-go-sdk/.github/ISSUE_TEMPLATE/config.yml
/deepgram-go-sdk/node_modules/**/*/
/deepgram-go-sdk/jspm_packages/**/*/
24 changes: 12 additions & 12 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

The Deepgram developer community is filled with amazing, clever and creative people, and we're excited for you to join us. Our goal is to create safe and inclusive spaces, have meaningful conversations, and explore ways to make sure that every voice is heard and understood.

#### Being a Good Community Member
## Being a Good Community Member

Because we prioritize creating a safe space for our members, we believe in actively working on how we, as individuals, can ensure a positive community environment through our own actions and mindsets.

Expand Down Expand Up @@ -64,7 +64,7 @@ Contribute to the community in a positive and thoughtful way. Consider what’s

Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.

# Additional rules for online spaces
## Additional rules for online spaces

For Deepgram’s official online spaces, like our YouTube & Twitch chats, we have some additional rules. Any of the following behaviors can result in a ban without warning.

Expand All @@ -88,45 +88,45 @@ Please don’t post it or link to it. It doesn’t belong in our online spaces.

Please do not use excessive curse words. Additionally, do not use graphic sexual or violent language — again, think of our spaces as places for people of all ages.

# Enforcement & Reporting
## Enforcement & Reporting

If you are being harassed by a member of the Deepgram developer community, if you observe someone else being harassed, or you experience actions or behaviors that are contrary to our Code of Conduct, please report the behavior using our [Code of Conduct Report Form](https://developers.deepgram.com/code-of-conduct/report-form/).

## Enforcement Guidelines
### Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction
#### 1. Correction

**_Community Impact:_** Use of inappropriate language or other behavior 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 behavior was inappropriate. A public apology may be requested.

### 2. Warning
#### 2. Warning

**_Community Impact:_** A violation through a single incident or series of actions.

**_Consequence:_** A warning with consequences for continued behavior. 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
#### 3. Temporary Ban

**_Community Impact:_** A serious violation of community standards, including sustained inappropriate behavior.

**_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
#### 4. Permanent Ban

**_Community Impact:_** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, 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
## Attribution

This Code of Conduct is adapted from:

- Contributor Covenant, version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct
- https://eventhandler.community/conduct/, which itself is inspired by Quest, who in turn provides credit to Scripto, the #botALLY Code of Conduct, the LGBTQ in Tech code of Conduct, and the XOXO Code of Conduct.
- Contributor Covenant, version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct)
- [https://eventhandler.community/conduct/](https://eventhandler.community/conduct/), which itself is inspired by Quest, who in turn provides credit to Scripto, the #botALLY Code of Conduct, the LGBTQ in Tech code of Conduct, and the XOXO Code of Conduct.

Community Impact Guidelines, which were copied from InnerSource Commons, were inspired by Mozilla’s code of conduct enforcement ladder.

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant](https://www.contributor-covenant).org/faq. Translations are available at [https://www.contributor-covenant.org/translations]( https://www.contributor-covenant.org/translations).
51 changes: 51 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2024 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

# detect the build OS
ifeq ($(OS),Windows_NT)
build_OS := Windows
NUL = NUL
else
build_OS := $(shell uname -s 2>/dev/null || echo Unknown)
NUL = /dev/null
endif

.DEFAULT_GOAL:=help

##### GLOBAL
ROOT_DIR := $(shell git rev-parse --show-toplevel)

help: #### Display help
@echo ''
@echo 'Syntax: make <target>'
@awk 'BEGIN {FS = ":.*## "; printf "\nTargets:\n"} /^[a-zA-Z_-]+:.*?#### / { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
@echo ''
##### GLOBAL

##### LINTING TARGETS
.PHONY: version
version: #### display version of components
@echo 'ROOT_DIR: $(ROOT_DIR)'

.PHONY: check mdlint shellcheck actionlint yamllint ### Performs all of the checks, lint'ing, etc available
check: mdlint shellcheck actionlint yamllint

.PHONY: ensure-deps
ensure-deps: #### Ensure that all required dependency utilities are downloaded or installed
hack/ensure-deps/ensure-dependencies.sh

mdlint: #### Performs Markdown lint
# mdlint rules with common errors and possible fixes can be found here:
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
hack/check/check-mdlint.sh

shellcheck: #### Performs bash/shell lint
hack/check/check-shell.sh

yamllint: #### Performs yaml lint
hack/check/check-yaml.sh

actionlint: #### Performs GitHub Actions lint
actionlint
##### LINTING TARGETS
Loading

0 comments on commit ed98d86

Please sign in to comment.