tenv

tenv detects environment variable not using t.Setenv

MIT License

Stars
18

Bot releases are visible (Hide)

tenv - v1.10.0 Latest Release

Published by sivchari 4 months ago

What's Changed

Full Changelog: https://github.com/sivchari/tenv/compare/v1.9.1...v1.10.0

tenv - v1.9.1

Published by sivchari 4 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/sivchari/tenv/compare/v1.9.0...v1.9.1

tenv - v1.9.0

Published by sivchari 5 months ago

What's Changed

Full Changelog: https://github.com/sivchari/tenv/compare/v1.8.1...v1.9.0

tenv - Release v1.8.1

Published by github-actions[bot] 5 months ago

Release v1.8.1 with changes since v1.7.1

  • remove testing.F from target (#34) - by GitHub
tenv - Release v1.7.1

Published by github-actions[bot] almost 2 years ago

Release v1.7.1 with changes since v1.7.0

  • release v1.7.1 (#29) - by GitHub
  • release v1.7.1 - by sivchari
  • delete permission - by sivchari
  • release v1.7.1 (#28) - by GitHub
  • revert - by sivchari
  • Coadler/main (#27) - by GitHub
  • add permission - by sivchari
tenv - Release v1.7.0

Published by github-actions[bot] over 2 years ago

Release v1.7.0 with changes since v1.6.0

  • fix: index out of range (#22) - by GitHub
  • feat: add release file - by sivchari
tenv - We correspond to table driven test

Published by sivchari over 2 years ago

tenv - Apply Fuzz test.

Published by sivchari over 2 years ago

This release handles to diagnose testing.F in Go1.18.

tenv - update linter

Published by sivchari about 3 years ago

package main

import (
	"os"
	"testing"
)

var (
	ee = os.Setenv("a", "b") // never seen
)

func setup() {
	os.Setenv("a", "b")        // never seen
	err := os.Setenv("a", "b") // never seen
	if err != nil {
		_ = err
	}
	os.Setenv("a", "b") // never seen
}

func F(t *testing.T) {
	setup()
	os.Setenv("a", "b")        // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in F"
	err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in F"
	_ = err
	if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in F"
		_ = err
	}
}

func BF(b *testing.B) {
	TBF(b)
	os.Setenv("a", "b")        // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BF"
	err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BF"
	_ = err
	if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BF"
		_ = err
	}
}

func TBF(tb testing.TB) {
	os.Setenv("a", "b")        // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TBF"
	err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TBF"
	_ = err
	if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TBF"
		_ = err
	}
}
package main_test

import (
	"os"
	"testing"
)

var (
	e = os.Setenv("a", "b") // never seen
)

func testsetup() {
	os.Setenv("a", "b")        // if -all = true, want  "os\\.Setenv\\(\\) can be replaced by `testing\\.Setenv\\(\\)` in testsetup"
	err := os.Setenv("a", "b") // if -all = true, want  "os\\.Setenv\\(\\) can be replaced by `testing\\.Setenv\\(\\)` in testsetup"
	if err != nil {
		_ = err
	}
	os.Setenv("a", "b") // if -all = true, "func setup is not using testing.Setenv"
}

func TestF(t *testing.T) {
	testsetup()
	os.Setenv("a", "b")        // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in TestF"
	err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in TestF"
	_ = err
	if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `t\\.Setenv\\(\\)` in TestF"
		_ = err
	}
}

func BenchmarkF(b *testing.B) {
	TB(b)
	os.Setenv("a", "b")        // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BenchmarkF"
	err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BenchmarkF"
	_ = err
	if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `b\\.Setenv\\(\\)` in BenchmarkF"
		_ = err
	}
}

func TB(tb testing.TB) {
	os.Setenv("a", "b")        // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TB"
	err := os.Setenv("a", "b") // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TB"
	_ = err
	if err := os.Setenv("a", "b"); err != nil { // want "os\\.Setenv\\(\\) can be replaced by `tb\\.Setenv\\(\\)` in TB"
		_ = err
	}
}
tenv - fix all flag

Published by sivchari about 3 years ago

tenv - improve report message

Published by sivchari about 3 years ago

tenv - delete confition and force option

Published by sivchari about 3 years ago

tenv - Fix report message

Published by sivchari about 3 years ago

tenv - Add all option

Published by sivchari about 3 years ago

You can use all to check all methods.
By default, only methods that take *testing.T, *testing.B, and testing.TB as arguments are checked.

tenv - adjust package

Published by sivchari about 3 years ago

tenv - fix panic error by out of range

Published by sivchari about 3 years ago

tenv - fix check version

Published by sivchari about 3 years ago

tenv - fix tag option

Published by sivchari about 3 years ago

tenv - Fix tag

Published by sivchari about 3 years ago

tenv - First Release

Published by sivchari about 3 years ago