diff --git a/.deepsource.toml b/.deepsource.toml index e9a83d64..5f8415dd 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -5,6 +5,6 @@ name = "go" enabled = true [analyzers.meta] -import_root = "github.com/k3rn31/gremlins" +import_root = "github.com/go-gremlins/gremlins" cgo_enabled = false dependencies_vendored = false \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0e066bb3..251dfcf1 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -19,7 +19,7 @@ _Put an `x` in the boxes that apply. You can also fill these out after creating them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._ -- [ ] I have read the [CONTRIBUTING](https://github.com/k3rn31/gremlins/CONTRIBUTING.md) doc +- [ ] I have read the [CONTRIBUTING](https://github.com/go-gremlins/gremlins/CONTRIBUTING.md) doc - [ ] Lint and unit tests pass locally with my changes - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added necessary documentation (if appropriate) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58748fd6..ba7cdc47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,7 @@ jobs: - name: Report coverage to CodeCov uses: codecov/codecov-action@v2 with: + token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true files: ./coverage.out flags: unittests @@ -47,7 +48,7 @@ jobs: env: CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} with: - prefix: github.com/k3rn31/gremlins + prefix: github.com/go-gremlins/gremlins coverageLocations: | ${{github.workspace}}/coverage.out:gocov - name: Report coverage to Codacy diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7ab85f67..445923c2 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -22,7 +22,7 @@ release: draft: true prerelease: auto nfpms: - - homepage: https://github.com/k3rn31/gremlins + - homepage: https://github.com/go-gremlins/gremlins description: A mutation testing tool for Go. license: Apache 2.0 License maintainer: Davide Petilli @@ -31,12 +31,12 @@ nfpms: - rpm brews: - tap: - owner: k3rn31 - name: gremlins-tap + owner: go-gremlins + name: homebrew-tap branch: main token: "{{ .Env.WORKFLOW_PAT }}" folder: Formula - homepage: https://github.com/k3rn31/gremlins + homepage: https://github.com/go-gremlins/gremlins description: A mutation testing tool for Go. license: Apache 2.0 License skip_upload: auto diff --git a/README.md b/README.md index 91a9b0e0..0afb64c9 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ # Gremlins -[![Tests](https://github.com/k3rn31/gremlins/actions/workflows/ci.yml/badge.svg)](https://github.com/k3rn31/gremlins/actions/workflows/ci.yml) -[![Go Report Card](https://goreportcard.com/badge/github.com/k3rn31/gremlins)](https://goreportcard.com/report/github.com/k3rn31/gremlins) -[![Maintainability](https://api.codeclimate.com/v1/badges/970114e2c5a770987a75/maintainability)](https://codeclimate.com/github/k3rn31/gremlins/maintainability) -[![DeepSource](https://deepsource.io/gh/k3rn31/gremlins.svg/?label=active+issues&token=cE9h3dLg1IepQkfT26BMgObn)](https://deepsource.io/gh/k3rn31/gremlins/?ref=repository-badge) -[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5b54f2c399214e53aa93cf0df837855a)](https://www.codacy.com/gh/k3rn31/gremlins/dashboard?utm_source=github.com&utm_medium=referral&utm_content=k3rn31/gremlins&utm_campaign=Badge_Grade) -[![codecov](https://codecov.io/gh/k3rn31/gremlins/branch/main/graph/badge.svg?token=MICF9A6U3J)](https://codecov.io/gh/k3rn31/gremlins) -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fk3rn31%2Fgremlins.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fk3rn31%2Fgremlins?ref=badge_shield) +[![Tests](https://github.com/go-gremlins/gremlins/actions/workflows/ci.yml/badge.svg)](https://github.com/go-gremlins/gremlins/actions/workflows/ci.yml) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-gremlins/gremlins)](https://goreportcard.com/report/github.com/go-gremlins/gremlins) +[![Maintainability](https://api.codeclimate.com/v1/badges/70142b378bff36c23550/maintainability)](https://codeclimate.com/github/go-gremlins/gremlins/maintainability) +[![DeepSource](https://deepsource.io/gh/go-gremlins/gremlins.svg/?label=active+issues&token=posNnh5FHpZG9DhM23YH7h6d)](https://deepsource.io/gh/go-gremlins/gremlins/?ref=repository-badge) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/744b4ac720c34518b7578204cfc61997)](https://www.codacy.com/gh/go-gremlins/gremlins/dashboard?utm_source=github.com&utm_medium=referral&utm_content=go-gremlins/gremlins&utm_campaign=Badge_Grade) +[![codecov](https://codecov.io/gh/go-gremlins/gremlins/branch/main/graph/badge.svg?token=MICF9A6U3J)](https://codecov.io/gh/go-gremlins/gremlins) +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fgo-gremlins%2Fgremlins.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fgo-gremlins%2Fgremlins?ref=badge_shield) **WARNING1: Gremlins is in its early stages of development, and it can be unstable and/or poorly performant.** + **WARNING2: Gremlins isn't currently supported on Windows.** Gremlins is a mutation testing tool for Go. @@ -45,7 +46,8 @@ Here is a nice [intro to mutation testing](https://pedrorijo.com/blog/intro-muta #### Linux -Download a `.deb` or `.rpm` file from the [release page](https://github.com/k3rn31/gremlins/releases) and install +Download a `.deb` or `.rpm` file from the [release page](https://github.com/go-gremlins/gremlins/releases/latest) and +install with `dpkg -i` and `rpm -i` respectively. #### MacOS @@ -54,13 +56,14 @@ On macOS, you can use [Homebrew](https://brew.sh/) to install by first tapping t a homebrew tap. ```shell -brew tap k3rn31/gremlins https://github.com/k3rn31/gremlins-tap +brew tap go-gremlins/gremlins https://github.com/go-gremlins/homebrew-tap brew install gremlins ``` #### Manual -- Download the binary appropriate for your platform from the [release page](https://github.com/k3rn31/gremlins/releases) +- Download the binary appropriate for your platform from + the [release page](https://github.com/go-gremlins/gremlins/releases/latest) . - Put the `gremlins` executable somewhere in your `PATH` (ex. `/usr/local/bin`). @@ -70,7 +73,7 @@ To build Gremlins you need the Go compiler, make and golangci-lint for linting. You can clone the Gremlins repository and then build it: ```shell -git clone https://github.com/k3rn31/gremlins.git +git clone https://github.com/go-gremlins/gremlins.git ``` Ad then: @@ -265,5 +268,3 @@ See [contributing](CONTRIBUTING.md). ## License Gremlins is released under the [Apache 2.0 License](LICENSE) - -[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fk3rn31%2Fgremlins.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fk3rn31%2Fgremlins?ref=badge_large) diff --git a/cmd/gremlins.go b/cmd/gremlins.go index d99c888a..848ef80b 100644 --- a/cmd/gremlins.go +++ b/cmd/gremlins.go @@ -37,7 +37,7 @@ func (gc gremlinsCmd) execute() error { func newRootCmd(version string) *gremlinsCmd { cmd := &cobra.Command{ Use: "gremlins", - Short: `Gremlins is a mutation testing tool for Go projects, made with love by k3rn31 + Short: `Gremlins is a mutation testing tool for Go projects, made with love by k3rn31 and friends. `, Version: version, diff --git a/cmd/gremlins/main.go b/cmd/gremlins/main.go index 916afd3f..ad77ce14 100644 --- a/cmd/gremlins/main.go +++ b/cmd/gremlins/main.go @@ -18,11 +18,13 @@ package main import ( "fmt" - "github.com/fatih/color" - "github.com/k3rn31/gremlins/cmd" - "github.com/k3rn31/gremlins/log" "os" "runtime" + + "github.com/fatih/color" + + "github.com/go-gremlins/gremlins/cmd" + "github.com/go-gremlins/gremlins/log" ) var ( diff --git a/cmd/unleash.go b/cmd/unleash.go index 24329788..96e3f3b8 100644 --- a/cmd/unleash.go +++ b/cmd/unleash.go @@ -18,14 +18,16 @@ package cmd import ( "fmt" - "github.com/k3rn31/gremlins/coverage" - "github.com/k3rn31/gremlins/log" - "github.com/k3rn31/gremlins/mutator" - "github.com/k3rn31/gremlins/mutator/workdir" - "github.com/k3rn31/gremlins/report" - "github.com/spf13/cobra" "io/ioutil" "os" + + "github.com/spf13/cobra" + + "github.com/go-gremlins/gremlins/coverage" + "github.com/go-gremlins/gremlins/log" + "github.com/go-gremlins/gremlins/mutator" + "github.com/go-gremlins/gremlins/mutator/workdir" + "github.com/go-gremlins/gremlins/report" ) type unleashCmd struct { diff --git a/coverage/coverage.go b/coverage/coverage.go index 84ef2428..070a3f7f 100644 --- a/coverage/coverage.go +++ b/coverage/coverage.go @@ -20,13 +20,15 @@ import ( "bufio" "bytes" "fmt" - "github.com/k3rn31/gremlins/log" - "golang.org/x/tools/cover" "io" "os" "os/exec" "strings" "time" + + "golang.org/x/tools/cover" + + "github.com/go-gremlins/gremlins/log" ) // Result contains the Profile generated by the coverage and the time diff --git a/coverage/coverage_test.go b/coverage/coverage_test.go index 7368e78c..cd460d6a 100644 --- a/coverage/coverage_test.go +++ b/coverage/coverage_test.go @@ -18,12 +18,14 @@ package coverage_test import ( "fmt" - "github.com/google/go-cmp/cmp" - "github.com/k3rn31/gremlins/coverage" "os" "os/exec" "strings" "testing" + + "github.com/google/go-cmp/cmp" + + "github.com/go-gremlins/gremlins/coverage" ) type commandHolder struct { diff --git a/coverage/profile_test.go b/coverage/profile_test.go index 27ca0c67..507bcaad 100644 --- a/coverage/profile_test.go +++ b/coverage/profile_test.go @@ -17,9 +17,10 @@ package coverage_test import ( - "github.com/k3rn31/gremlins/coverage" "go/token" "testing" + + "github.com/go-gremlins/gremlins/coverage" ) func TestIsCovered(t *testing.T) { diff --git a/go.mod b/go.mod index 50451faa..547574fe 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/k3rn31/gremlins +module github.com/go-gremlins/gremlins go 1.18 diff --git a/log/log_test.go b/log/log_test.go index 76e2f80c..ba9af852 100644 --- a/log/log_test.go +++ b/log/log_test.go @@ -18,8 +18,9 @@ package log_test import ( "bytes" - "github.com/k3rn31/gremlins/log" "testing" + + "github.com/go-gremlins/gremlins/log" ) func TestUninitialised(t *testing.T) { diff --git a/mutant/mutant_test.go b/mutant/mutant_test.go index 98c03133..b8580c6d 100644 --- a/mutant/mutant_test.go +++ b/mutant/mutant_test.go @@ -17,9 +17,11 @@ package mutant_test import ( - "github.com/google/go-cmp/cmp" - "github.com/k3rn31/gremlins/mutant" "testing" + + "github.com/google/go-cmp/cmp" + + "github.com/go-gremlins/gremlins/mutant" ) func TestStatusString(t *testing.T) { diff --git a/mutator/internal/mappings.go b/mutator/internal/mappings.go index a1f09b0e..48823040 100644 --- a/mutator/internal/mappings.go +++ b/mutator/internal/mappings.go @@ -17,8 +17,9 @@ package internal import ( - "github.com/k3rn31/gremlins/mutant" "go/token" + + "github.com/go-gremlins/gremlins/mutant" ) // TokenMutantType is the mapping from each token.Token and all the diff --git a/mutator/internal/node_test.go b/mutator/internal/node_test.go index b1894ac1..53c0e938 100644 --- a/mutator/internal/node_test.go +++ b/mutator/internal/node_test.go @@ -17,10 +17,11 @@ package internal_test import ( - "github.com/k3rn31/gremlins/mutator/internal" "go/ast" "go/token" "testing" + + "github.com/go-gremlins/gremlins/mutator/internal" ) func TestNewTokenNode(t *testing.T) { diff --git a/mutator/internal/tokenmutant.go b/mutator/internal/tokenmutant.go index 4285a178..c237ee5e 100644 --- a/mutator/internal/tokenmutant.go +++ b/mutator/internal/tokenmutant.go @@ -17,12 +17,13 @@ package internal import ( - "github.com/k3rn31/gremlins/log" - "github.com/k3rn31/gremlins/mutant" "go/ast" "go/printer" "go/token" "os" + + "github.com/go-gremlins/gremlins/log" + "github.com/go-gremlins/gremlins/mutant" ) // TokenMutant is a mutant.Mutant of a token.Token. diff --git a/mutator/internal/tokenmutant_test.go b/mutator/internal/tokenmutant_test.go index 50acea6e..ae36e6b9 100644 --- a/mutator/internal/tokenmutant_test.go +++ b/mutator/internal/tokenmutant_test.go @@ -17,14 +17,16 @@ package internal_test import ( - "github.com/google/go-cmp/cmp" - "github.com/k3rn31/gremlins/mutant" - "github.com/k3rn31/gremlins/mutator/internal" "go/ast" "go/parser" "go/token" "os" "testing" + + "github.com/google/go-cmp/cmp" + + "github.com/go-gremlins/gremlins/mutant" + "github.com/go-gremlins/gremlins/mutator/internal" ) func TestMutantApplyAndRollback(t *testing.T) { diff --git a/mutator/mutator.go b/mutator/mutator.go index df1ff6ef..24ab43b8 100644 --- a/mutator/mutator.go +++ b/mutator/mutator.go @@ -29,12 +29,12 @@ import ( "strings" "time" - "github.com/k3rn31/gremlins/coverage" - "github.com/k3rn31/gremlins/log" - "github.com/k3rn31/gremlins/mutant" - "github.com/k3rn31/gremlins/mutator/internal" - "github.com/k3rn31/gremlins/mutator/workdir" - "github.com/k3rn31/gremlins/report" + "github.com/go-gremlins/gremlins/coverage" + "github.com/go-gremlins/gremlins/log" + "github.com/go-gremlins/gremlins/mutant" + "github.com/go-gremlins/gremlins/mutator/internal" + "github.com/go-gremlins/gremlins/mutator/workdir" + "github.com/go-gremlins/gremlins/report" ) // Mutator is the "engine" that performs the mutation testing. @@ -242,9 +242,7 @@ func (mu *Mutator) runTests() mutant.Status { defer cancel() cmd := mu.execContext(ctx, "go", mu.getTestArgs()...) - rel, err := run(cmd) - defer rel() - + err := cmd.Run() if ctx.Err() == context.DeadlineExceeded { return mutant.TimedOut } @@ -257,20 +255,6 @@ func (mu *Mutator) runTests() mutant.Status { return mutant.Lived } -func run(cmd *exec.Cmd) (func(), error) { - if err := cmd.Run(); err != nil { - - return func() {}, err - } - - return func() { - err := cmd.Process.Release() - if err != nil { - _ = cmd.Process.Kill() - } - }, nil -} - func (mu *Mutator) getTestArgs() []string { args := []string{"test"} if mu.buildTags != "" { diff --git a/mutator/mutator_test.go b/mutator/mutator_test.go index 9fe174a7..9bf3a1b3 100644 --- a/mutator/mutator_test.go +++ b/mutator/mutator_test.go @@ -19,10 +19,6 @@ package mutator_test import ( "context" "fmt" - "github.com/google/go-cmp/cmp" - "github.com/k3rn31/gremlins/coverage" - "github.com/k3rn31/gremlins/mutant" - "github.com/k3rn31/gremlins/mutator" "go/token" "io/ioutil" "os" @@ -31,6 +27,12 @@ import ( "testing" "testing/fstest" "time" + + "github.com/google/go-cmp/cmp" + + "github.com/go-gremlins/gremlins/coverage" + "github.com/go-gremlins/gremlins/mutant" + "github.com/go-gremlins/gremlins/mutator" ) const expectedTimeout = 10 * time.Second diff --git a/mutator/workdir/workdir.go b/mutator/workdir/workdir.go index 2156d4e5..cec4ee71 100644 --- a/mutator/workdir/workdir.go +++ b/mutator/workdir/workdir.go @@ -17,10 +17,11 @@ package workdir import ( - "github.com/k3rn31/gremlins/log" "io/fs" "os" "path/filepath" + + "github.com/go-gremlins/gremlins/log" ) // Dealer is the responsible for creating and returning the reference diff --git a/mutator/workdir/workdir_test.go b/mutator/workdir/workdir_test.go index ee8edffa..e53c7e78 100644 --- a/mutator/workdir/workdir_test.go +++ b/mutator/workdir/workdir_test.go @@ -18,12 +18,14 @@ package workdir_test import ( "fmt" - "github.com/google/go-cmp/cmp" - "github.com/k3rn31/gremlins/mutator/workdir" "io/fs" "os" "path/filepath" "testing" + + "github.com/google/go-cmp/cmp" + + "github.com/go-gremlins/gremlins/mutator/workdir" ) func TestLinkFolder(t *testing.T) { diff --git a/report/report.go b/report/report.go index 68348cba..d9bf2f6c 100644 --- a/report/report.go +++ b/report/report.go @@ -17,11 +17,13 @@ package report import ( + "time" + "github.com/fatih/color" "github.com/hako/durafmt" - "github.com/k3rn31/gremlins/log" - "github.com/k3rn31/gremlins/mutant" - "time" + + "github.com/go-gremlins/gremlins/log" + "github.com/go-gremlins/gremlins/mutant" ) var ( diff --git a/report/report_test.go b/report/report_test.go index 1bdac2ed..92e57a2c 100644 --- a/report/report_test.go +++ b/report/report_test.go @@ -18,13 +18,15 @@ package report_test import ( "bytes" - "github.com/google/go-cmp/cmp" - "github.com/k3rn31/gremlins/log" - "github.com/k3rn31/gremlins/mutant" - "github.com/k3rn31/gremlins/report" "go/token" "testing" "time" + + "github.com/google/go-cmp/cmp" + + "github.com/go-gremlins/gremlins/log" + "github.com/go-gremlins/gremlins/mutant" + "github.com/go-gremlins/gremlins/report" ) func TestReport(t *testing.T) {