Skip to content

Commit d1a88bd

Browse files
authored
Merge pull request #5 from slashdevops/chore/community-files-and-stdlib-tests
chore: add community files, badges, and drop testify for stdlib tests
2 parents 5c406d4 + bb85cd1 commit d1a88bd

11 files changed

Lines changed: 354 additions & 69 deletions

File tree

.github/FUNDING.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# These are supported funding model platforms
2+
github: [christiangda]
3+
liberapay: christiangda
4+
patreon: christiangda
5+
custom: ["https://paypal.me/slashdevops"]

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "gomod" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "weekly"

.github/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
# https://docs.github.com/es/repositories/releasing-projects-on-github/automatically-generated-release-notes
3+
changelog:
4+
categories:
5+
- title: Breaking Changes 🛠
6+
labels:
7+
- Semver-Major
8+
- breaking-change
9+
- title: New Features 🎉
10+
labels:
11+
- Semver-Minor
12+
- enhancement
13+
- title: Other Changes
14+
labels:
15+
- "*"

.github/workflows/codeql.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL Advanced"
13+
14+
on:
15+
push:
16+
branches: ["main"]
17+
pull_request:
18+
branches: ["main"]
19+
schedule:
20+
- cron: "10 12 * * 3"
21+
22+
jobs:
23+
analyze:
24+
name: Analyze (${{ matrix.language }})
25+
# Runner size impacts CodeQL analysis time. To learn more, please see:
26+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27+
# - https://gh.io/supported-runners-and-hardware-resources
28+
# - https://gh.io/using-larger-runners (GitHub.com only)
29+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
30+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31+
permissions:
32+
# required for all workflows
33+
security-events: write
34+
35+
# required to fetch internal or private CodeQL packs
36+
packages: read
37+
38+
# only required for workflows in private repositories
39+
actions: read
40+
contents: read
41+
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
- language: actions
47+
build-mode: none
48+
- language: go
49+
build-mode: autobuild
50+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
51+
# Use `c-cpp` to analyze code written in C, C++ or both
52+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
53+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
54+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
55+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
56+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
57+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v6
61+
62+
# Add any setup steps before running the `github/codeql-action/init` action.
63+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
64+
# or others). This is typically only required for manual builds.
65+
# - name: Setup runtime (example)
66+
# uses: actions/setup-example@v1
67+
68+
# Initializes the CodeQL tools for scanning.
69+
- name: Initialize CodeQL
70+
uses: github/codeql-action/init@v4
71+
with:
72+
languages: ${{ matrix.language }}
73+
build-mode: ${{ matrix.build-mode }}
74+
# If you wish to specify custom queries, you can do so here or in a config file.
75+
# By default, queries listed here will override any specified in a config file.
76+
# Prefix the list here with "+" to use these queries and those in the config file.
77+
78+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
79+
# queries: security-extended,security-and-quality
80+
81+
# If the analyze step fails for one of the languages you are analyzing with
82+
# "We were unable to automatically build your code", modify the matrix above
83+
# to set the build mode to "manual" for that language. Then modify this step
84+
# to build your code.
85+
# ℹ️ Command-line programs to run using the OS shell.
86+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
87+
- if: matrix.build-mode == 'manual'
88+
shell: bash
89+
run: |
90+
echo 'If you are using a "manual" build mode for one or more of the' \
91+
'languages you are analyzing, replace this with the commands to build' \
92+
'your code, for example:'
93+
echo ' make bootstrap'
94+
echo ' make release'
95+
exit 1
96+
97+
- name: Perform CodeQL Analysis
98+
uses: github/codeql-action/analyze@v4
99+
with:
100+
category: "/language:${{matrix.language}}"

.golangci.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
version: "2"
2+
linters:
3+
# Enable specific linter
4+
# https://golangci-lint.run/usage/linters/#enabled-by-default
5+
enable:
6+
- errcheck
7+
- ineffassign
8+
- staticcheck
9+
- unused
10+
11+
# Disable specific linter
12+
# https://golangci-lint.run/usage/linters/#disabled-by-default
13+
disable:
14+
# Enable presets.
15+
# https://golangci-lint.run/usage/linters
16+
# Default: []
17+
- govet
18+
- godot
19+
- wsl
20+
- testpackage
21+
- whitespace
22+
- tagalign
23+
- nosprintfhostport
24+
- nlreturn
25+
- nestif
26+
- mnd
27+
- misspell
28+
- lll
29+
- godox
30+
- funlen
31+
- gochecknoinits
32+
- depguard
33+
- goconst
34+
- dupword
35+
- cyclop
36+
- gocognit
37+
- maintidx
38+
- gocyclo
39+
- dupl
40+
41+
settings:
42+
errcheck:
43+
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
44+
# Such cases aren't reported by default.
45+
# Default: false
46+
check-type-assertions: false
47+
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
48+
# Such cases aren't reported by default.
49+
# Default: false
50+
check-blank: false
51+
# To disable the errcheck built-in exclude list.
52+
# See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details.
53+
# Default: false
54+
disable-default-exclusions: true
55+
# List of functions to exclude from checking, where each entry is a single function to exclude.
56+
# See https://github.com/kisielk/errcheck#excluding-functions for details.
57+
exclude-functions:
58+
- (*os.File).Close
59+
- (io.Closer).Close
60+
- io/ioutil.ReadFile
61+
- io.Copy(*bytes.Buffer)
62+
- io.Copy(os.Stdout)
63+
- (io.Writer).Write
64+
- (*bufio.Writer).Write
65+
- (*encoding/json.Encoder).Encode
66+
- os.Setenv
67+
- os.Unsetenv
68+
- fmt.Printf
69+
- fmt.Print
70+
- fmt.Println
71+
- fmt.Fprint
72+
- fmt.Fprintf
73+
- (*strings.Builder).WriteString

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# ratelimiter
22

33
[![Go Reference](https://pkg.go.dev/badge/github.com/slashdevops/ratelimiter.svg)](https://pkg.go.dev/github.com/slashdevops/ratelimiter)
4+
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/slashdevops/ratelimiter?style=plastic)
5+
[![license](https://img.shields.io/github/license/slashdevops/ratelimiter.svg)](https://github.com/slashdevops/ratelimiter/blob/main/LICENSE)
6+
[![Release](https://github.com/slashdevops/ratelimiter/actions/workflows/release.yml/badge.svg)](https://github.com/slashdevops/ratelimiter/actions/workflows/release.yml)
7+
[![CodeQL Advanced](https://github.com/slashdevops/ratelimiter/actions/workflows/codeql.yml/badge.svg)](https://github.com/slashdevops/ratelimiter/actions/workflows/codeql.yml)
48

59
A flexible, goroutine-safe, **per-key** rate limiter for Go, built as a thin
610
manager around the token-bucket implementation in

SECURITY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Security Policy
2+
3+
This project uses [GitHub CodeQL](https://codeql.github.com/) to scan the code for
4+
vulnerabilities. You can see the report in the pipeline
5+
[![CodeQL Advanced](https://github.com/slashdevops/ratelimiter/actions/workflows/codeql.yml/badge.svg)](https://github.com/slashdevops/ratelimiter/actions/workflows/codeql.yml)
6+
7+
## Supported Versions
8+
9+
| Version | Supported |
10+
| ------- | ------------------ |
11+
| 1.0.x | :white_check_mark: |
12+
13+
## Reporting a Vulnerability
14+
15+
Please use the [Project Issues --> Report a vulnerability](https://github.com/slashdevops/ratelimiter/issues/new/choose)
16+
to report it.

0 commit comments

Comments
 (0)