<commit_before>package main

import (
	"encoding/json"
	"os/user"
	"io/ioutil"
	"fmt"
	"os"
)

type Settings struct {
	Projects map[string]string `json:"projects"`
}

func LoadSettings() (settings *Settings, err error) {
	homedir := HomeDir()
	content, err := ioutil.ReadFile(homedir + "/.hack/config")

	if err != nil {
		if !os.IsNotExist(err) {
			return
		}
		err = nil
		settings = &Settings{make(map[string]string)}
	}else{
		err = json.Unmarshal(content, &settings)
		if err != nil {
			return
		}
	}

	return
}

func (s *Settings) Write() (err error) {
	homedir := HomeDir()

	// Convert to json
	b, err := json.Marshal(s)
	if err != nil {
		return
	}

	// Create the config dir (no-op)
	err = os.MkdirAll(homedir + "/.hack", 0700)
	if err != nil {
		return
	}

	// Write to the file
    err = ioutil.WriteFile(homedir + "/.hack/config", b, 0700)
	if err != nil {
		return
	}
	return
}

func HomeDir() (string) {
	usr, err := user.Current()
    if err != nil {
        fmt.Println( err )
    }
    return usr.HomeDir
}<commit_msg>Whitespace<commit_after>package main

import (
	"encoding/json"
	"os/user"
	"io/ioutil"
	"fmt"
	"os"
)

type Settings struct {
	Projects map[string]string `json:"projects"`
}

func LoadSettings() (settings *Settings, err error) {
	homedir := HomeDir()
	content, err := ioutil.ReadFile(homedir + "/.hack/config")

	if err != nil {
		if !os.IsNotExist(err) {
			return
		}
		err = nil
		settings = &Settings{make(map[string]string)}
	}else{
		err = json.Unmarshal(content, &settings)
		if err != nil {
			return
		}
	}

	return
}

func (s *Settings) Write() (err error) {
	homedir := HomeDir()

	// Convert to json
	b, err := json.Marshal(s)
	if err != nil {
		return
	}

	// Create the config dir (no-op)
	err = os.MkdirAll(homedir + "/.hack", 0700)
	if err != nil {
		return
	}

	// Write to the file
	err = ioutil.WriteFile(homedir + "/.hack/config", b, 0700)
	if err != nil {
		return
	}
	return
}

func HomeDir() (string) {
	usr, err := user.Current()
    if err != nil {
        fmt.Println( err )
    }
    return usr.HomeDir
}
{'fraction_non_alphanumeric': 0.15845410628019324, 'fraction_numerical': 0.007729468599033816, 'mean_word_length': 2.967432950191571, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '3039865', 'n_tokens_mistral': 873, 'n_tokens_neox': 819, 'n_words': 206}