Skip to content

jubenitezg/Go-Clone-Thesis

Repository files navigation

Detection of code clones in Go projects through the use of machine learning techniques: Analysis of open source repositories on GitHub

Escuela Colombiana de Ingeniería Master Thesis on Computer Science - Bogotá, Colombia

Example of Types of Clones

Initial Function

func factorial(n int) int {
	j := 1
	for i := 1; i <= n; i++ {
		j *= i
	}
	return j
}

Type 1 - Exact Clone

func factorial(n int) int {
	j := 1
	for i := 1; i <= n; i++ {
		j *= i
	}
	return j
}

Type 2 - Renamed clone

func getFactorial(number int) int {
	acc := 1
	for curr := 1; curr <= number; curr++ {
		acc *= curr
	}
	return acc
}

Type 3 - Near miss clone

func factorialAdd(n int) (int, int) {
	var accFactorial int
	var accSum int
	for curr := 1; curr <= n; curr++ {
		accFactorial *= curr
		accSum += curr
	}
	return accFactorial, accSum
}

Type 4 - Semantic clone

func fact(num int) int {
	if num == 0 {
		return 1
	}
	return num * fact(num-1)
}

Available Go repositories on GitHub

Total Go repositories on GitHub (excluding forks): 1,332,711

Total Go repositories with more than 100 stars: 15,863

Author

Director

  • Héctor Fabio Cadavid Rengifo

Co-director

  • Wilmer Edicson Garzón Alfonso

About

Escuela Colombiana de Ingeniería Master's Thesis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages