All Projects → charithe → durationcheck

charithe / durationcheck

Licence: Apache-2.0 License
Go linter to detect erroneous multiplication of duration values

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to durationcheck

go-namecheck
Source code analyzer that helps you to maintain variable/field naming conventions inside your project.
Stars: ✭ 37 (+32.14%)
Mutual labels:  linter
static-code-analysis-plugin
A plugin to simplify Static Code Analysis on Gradle. Not restricted to, but specially useful, in Android projects, by making sure all analysis can access the SDK classes.
Stars: ✭ 36 (+28.57%)
Mutual labels:  linter
megalinter
🦙 Mega-Linter analyzes 48 languages, 22 formats, 19 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
Stars: ✭ 534 (+1807.14%)
Mutual labels:  linter
scalafix-maven-plugin
Enables automatic refactoring and linting of Maven projects written in Scala using Scalafix.
Stars: ✭ 15 (-46.43%)
Mutual labels:  linter
salt-lint
A command-line utility that checks for best practices in SaltStack.
Stars: ✭ 111 (+296.43%)
Mutual labels:  linter
godot
Linter that checks if comments end in a period
Stars: ✭ 28 (+0%)
Mutual labels:  linter
standard-loader
webpack loader for linting your code with https://github.com/feross/standard
Stars: ✭ 66 (+135.71%)
Mutual labels:  linter
illuaminate
Very WIP static analysis for Lua
Stars: ✭ 21 (-25%)
Mutual labels:  linter
cpplint
Static code checker for C++
Stars: ✭ 1,014 (+3521.43%)
Mutual labels:  linter
golintui
A simple terminal UI for Go linters
Stars: ✭ 73 (+160.71%)
Mutual labels:  linter
fsharp-linting-for-vs
Visual Studio Linter for F#
Stars: ✭ 33 (+17.86%)
Mutual labels:  linter
flake8-broken-line
🚨 Flake8 plugin to forbid backslashes (\) for line breaks
Stars: ✭ 85 (+203.57%)
Mutual labels:  linter
ue5-style-guide
An attempt to make Unreal Engine 4 projects more consistent
Stars: ✭ 2,892 (+10228.57%)
Mutual labels:  linter
lint-prepush
Lint committed files on pre-push 🔬
Stars: ✭ 18 (-35.71%)
Mutual labels:  linter
clj-kondo.lsp
Clj-kondo language server and VSCode extension: https://marketplace.visualstudio.com/items?itemName=borkdude.clj-kondo
Stars: ✭ 17 (-39.29%)
Mutual labels:  linter
dockerfile-utils
A library and command line interface for formatting and linting Dockerfiles.
Stars: ✭ 17 (-39.29%)
Mutual labels:  linter
pahout
A pair programming partner for writing better PHP. Pahout means PHP mahout 🐘
Stars: ✭ 43 (+53.57%)
Mutual labels:  linter
addlint
An example linter written with go/analysis for tutorial purposes
Stars: ✭ 49 (+75%)
Mutual labels:  linter
dustmite
A linter for DustJS templates
Stars: ✭ 14 (-50%)
Mutual labels:  linter
quick-lint-js
quick-lint-js finds bugs in JavaScript programs
Stars: ✭ 575 (+1953.57%)
Mutual labels:  linter

CircleCI

Duration Check

A Go linter to detect cases where two time.Duration values are being multiplied in possibly erroneous ways.

Consider the following (highly contrived) code:

func waitForSeconds(someDuration time.Duration) {
	timeToWait := someDuration * time.Second
	fmt.Printf("Waiting for %s\n", timeToWait)
}

func main() {
	waitForSeconds(5) // waits for 5 seconds
	waitForSeconds(5 * time.Second) // waits for 1388888h 53m 20s
}

Both invocations of the function are syntactically correct but the second one is probably not what most people want. In this contrived example it is quite easy to spot the mistake. However, if the incorrect waitForSeconds invocation is nested deep within a complex piece of code that runs in the background, the mistake could go unnoticed for months (which is exactly what happened in a production backend system of fairly well-known software service).

See the test cases for more examples of the types of errors detected by the linter.

Installation

Requires Go 1.11 or above.

go get -u github.com/charithe/durationcheck/cmd/durationcheck

Usage

Invoke durationcheck with your package name

durationcheck ./...
# or
durationcheck github.com/you/yourproject/...
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].