Skip to content

Commit

Permalink
Merge branch 'main' into 21-make-test-timeout-smart
Browse files Browse the repository at this point in the history
  • Loading branch information
k3rn31 authored Jul 23, 2022
2 parents 957485d + 143942e commit bf619f7
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 16 deletions.
8 changes: 8 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = 1

[[analyzers]]
name = "go"
enabled = true

[analyzers.meta]
import_root = "github.com/k3rn31/gremlins"
24 changes: 24 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
XS:
name: s/XS
lines: 0
color: 3CBF00
S:
name: s/S
lines: 10
color: 5D9801
M:
name: s/M
lines: 30
color: 7F7203
L:
name: s/L
lines: 100
color: A14C05
XL:
name: s/XL
lines: 500
color: C32607
XXL:
name: s/XXL
lines: 1000
color: E50009
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![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)
Expand Down
4 changes: 2 additions & 2 deletions coverage/coverage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ func TestParseOutputFail(t *testing.T) {
}
}

func TestCoverageProcessSuccess(t *testing.T) {
func TestCoverageProcessSuccess(_ *testing.T) {
if os.Getenv("GO_TEST_PROCESS") != "1" {
return
}
os.Exit(0)
}

func TestCoverageProcessFailure(t *testing.T) {
func TestCoverageProcessFailure(_ *testing.T) {
if os.Getenv("GO_TEST_PROCESS") != "1" {
return
}
Expand Down
2 changes: 1 addition & 1 deletion mutator/internal/tokenmutant.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func openFile(fs *token.FileSet, tokPos token.Pos, workdir string) (*os.File, er
if workdir != "" {
workdir += "/"
}
f, err := os.OpenFile(workdir+file.Name(), os.O_CREATE|os.O_WRONLY, 0777)
f, err := os.OpenFile(workdir+file.Name(), os.O_CREATE|os.O_WRONLY, 0600)
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions mutator/mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (mu Mutator) Run() report.Results {
return res
}

func (mu Mutator) runOnFile(fileName string, src io.Reader) {
func (mu *Mutator) runOnFile(fileName string, src io.Reader) {
set := token.NewFileSet()
file, _ := parser.ParseFile(set, fileName, src, parser.ParseComments)
ast.Inspect(file, func(node ast.Node) bool {
Expand All @@ -167,7 +167,7 @@ func (mu Mutator) runOnFile(fileName string, src io.Reader) {
})
}

func (mu Mutator) findMutations(set *token.FileSet, file *ast.File, node *internal.NodeToken) {
func (mu *Mutator) findMutations(set *token.FileSet, file *ast.File, node *internal.NodeToken) {
mutantTypes, ok := internal.TokenMutantType[node.Tok()]
if !ok {
return
Expand All @@ -182,7 +182,7 @@ func (mu Mutator) findMutations(set *token.FileSet, file *ast.File, node *intern
}
}

func (mu Mutator) mutationStatus(pos token.Position) mutant.Status {
func (mu *Mutator) mutationStatus(pos token.Position) mutant.Status {
var status mutant.Status
if mu.covProfile.IsCovered(pos) {
status = mutant.Runnable
Expand All @@ -191,7 +191,7 @@ func (mu Mutator) mutationStatus(pos token.Position) mutant.Status {
return status
}

func (mu Mutator) executeTests() report.Results {
func (mu *Mutator) executeTests() report.Results {
if mu.dryRun {
log.Infoln("Running in 'dry-run' mode...")
} else {
Expand Down
4 changes: 2 additions & 2 deletions mutator/mutator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,14 +383,14 @@ func TestMutatorTestExecution(t *testing.T) {
}
}

func TestCoverageProcessSuccess(t *testing.T) {
func TestCoverageProcessSuccess(_ *testing.T) {
if os.Getenv("GO_TEST_PROCESS") != "1" {
return
}
os.Exit(0)
}

func TestCoverageProcessFailure(t *testing.T) {
func TestCoverageProcessFailure(_ *testing.T) {
if os.Getenv("GO_TEST_PROCESS") != "1" {
return
}
Expand Down
14 changes: 7 additions & 7 deletions report/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,19 @@ func (s stubMutant) Type() mutant.Type {
return s.mutantType
}

func (s stubMutant) SetType(_ mutant.Type) {
func (stubMutant) SetType(_ mutant.Type) {
panic("implement me")
}

func (s stubMutant) Status() mutant.Status {
return s.status
}

func (s stubMutant) SetStatus(_ mutant.Status) {
func (stubMutant) SetStatus(_ mutant.Status) {
panic("implement me")
}

func (s stubMutant) Position() token.Position {
func (stubMutant) Position() token.Position {
return token.Position{
Filename: "aFolder/aFile.go",
Offset: 0,
Expand All @@ -169,18 +169,18 @@ func (s stubMutant) Position() token.Position {
}
}

func (s stubMutant) Pos() token.Pos {
func (stubMutant) Pos() token.Pos {
return 123
}

func (s stubMutant) SetWorkdir(_ string) {
func (stubMutant) SetWorkdir(_ string) {
panic("implement me")
}

func (s stubMutant) Apply() error {
func (stubMutant) Apply() error {
panic("implement me")
}

func (s stubMutant) Rollback() error {
func (stubMutant) Rollback() error {
panic("implement me")
}

0 comments on commit bf619f7

Please sign in to comment.