Skip to content

Commit

Permalink
migrate to go-gremlins organization
Browse files Browse the repository at this point in the history
  • Loading branch information
k3rn31 committed Jul 28, 2022
1 parent 4fc2094 commit e29a9d0
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .deepsource.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Expand All @@ -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
Expand Down
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -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&amp;utm_medium=referral&amp;utm_content=k3rn31/gremlins&amp;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&amp;utm_medium=referral&amp;utm_content=go-gremlins/gremlins&amp;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.
Expand Down Expand Up @@ -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
Expand All @@ -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`).

Expand All @@ -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:
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion cmd/gremlins.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions cmd/gremlins/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
14 changes: 8 additions & 6 deletions cmd/unleash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions coverage/coverage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions coverage/coverage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion coverage/profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/k3rn31/gremlins
module github.com/go-gremlins/gremlins

go 1.18

Expand Down
3 changes: 2 additions & 1 deletion log/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions mutant/mutant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion mutator/internal/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion mutator/internal/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions mutator/internal/tokenmutant.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 5 additions & 3 deletions mutator/internal/tokenmutant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
30 changes: 7 additions & 23 deletions mutator/mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand All @@ -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 != "" {
Expand Down
10 changes: 6 additions & 4 deletions mutator/mutator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion mutator/workdir/workdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit e29a9d0

Please sign in to comment.