<commit_before>package shippers

import "fmt"
import "net"
import "net/url"
import "strings"
import "time"
import "github.com/josegonzalez/metricsd/structs"
import "github.com/Sirupsen/logrus"
import ini "github.com/vaughan0/go-ini"

type GraphiteShipper struct {
	debug   bool
	enabled bool
	host    string
	prefix  string
	port    string
}

func (this *GraphiteShipper) Enabled() bool {
	return this.enabled
}

func (this *GraphiteShipper) State(state bool) {
	this.enabled = state
}

func (this *GraphiteShipper) Setup(conf ini.File) {
	this.State(true)

	useDebug, ok := conf.Get("GraphiteShipper", "debug")
	if ok && useDebug == "true" {
		this.debug = true
	} else {
		this.debug = false
	}

	this.host = "127.0.0.1"
	this.port = "2003"
	useGraphiteUrl, ok := conf.Get("GraphiteShipper", "url")
	if ok {
		graphiteUrl, err := url.Parse(useGraphiteUrl)
		if err == nil {
			splitted := strings.Split(graphiteUrl.Host, ":")
			this.host, this.port = splitted[0], "2003"
			switch {
			case len(splitted) > 2:
				logrus.Warning("error parsing graphite url")
				logrus.Warning("using default 127.0.0.1:2003 for graphite url")
			case len(splitted) > 1:
				this.host, this.port = splitted[0], splitted[1]
			default:
				this.host, this.port = splitted[0], "2003"
			}
		} else {
			logrus.Warning("error parsing graphite url: %s", err)
			logrus.Warning("using default 127.0.0.1:2003 for graphite url")
		}<commit_msg>Follow variable naming conventions for URL<commit_after>package shippers

import "fmt"
import "net"
import "net/url"
import "strings"
import "time"
import "github.com/josegonzalez/metricsd/structs"
import "github.com/Sirupsen/logrus"
import ini "github.com/vaughan0/go-ini"

type GraphiteShipper struct {
	debug   bool
	enabled bool
	host    string
	prefix  string
	port    string
}

func (this *GraphiteShipper) Enabled() bool {
	return this.enabled
}

func (this *GraphiteShipper) State(state bool) {
	this.enabled = state
}

func (this *GraphiteShipper) Setup(conf ini.File) {
	this.State(true)

	useDebug, ok := conf.Get("GraphiteShipper", "debug")
	if ok && useDebug == "true" {
		this.debug = true
	} else {
		this.debug = false
	}

	this.host = "127.0.0.1"
	this.port = "2003"
	useGraphiteURL, ok := conf.Get("GraphiteShipper", "url")
	if ok {
		graphiteURL, err := url.Parse(useGraphiteURL)
		if err == nil {
			splitted := strings.Split(graphiteURL.Host, ":")
			this.host, this.port = splitted[0], "2003"
			switch {
			case len(splitted) > 2:
				logrus.Warning("error parsing graphite url")
				logrus.Warning("using default 127.0.0.1:2003 for graphite url")
			case len(splitted) > 1:
				this.host, this.port = splitted[0], splitted[1]
			default:
				this.host, this.port = splitted[0], "2003"
			}
		} else {
			logrus.Warning("error parsing graphite url: %s", err)
			logrus.Warning("using default 127.0.0.1:2003 for graphite url")
		}
{'fraction_non_alphanumeric': 0.13843478260869566, 'fraction_numerical': 0.03130434782608696, 'mean_word_length': 3.8745762711864407, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2334427', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1034, 'n_words': 257}