Skip to content

Commit

Permalink
Change mistakes to errors. (#128)
Browse files Browse the repository at this point in the history
# Describe Request

Change mistakes to errors.

# Change Type

Code maintenance.
  • Loading branch information
cinar authored Oct 30, 2024
1 parent b88aed2 commit 80ba6aa
Show file tree
Hide file tree
Showing 22 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
* Accepting responsibility and apologizing to those affected by our errors,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Expand Down
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ type Person struct {

person := &Person{}

mistakes, valid := checker.Check(person)
errors, valid := checker.Check(person)
if !valid {
// Send the mistakes back to the user
// Send the errors back to the user
}
```

Expand Down Expand Up @@ -333,7 +333,7 @@ import (
func main() {
err := checker.IsASCII("Checker")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -365,7 +365,7 @@ import (
func main() {
err := checker.IsAlphanumeric("ABcd1234")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -398,7 +398,7 @@ func main() {
err := checker.IsAmexCreditCard("378282246310005")

if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -431,7 +431,7 @@ func main() {
err := checker.IsAnyCreditCard("6011111111111117")

if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -463,7 +463,7 @@ import (
func main() {
err := checker.IsCidr("2001:db8::/32")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -495,7 +495,7 @@ import (
func main() {
err := checker.IsDigits("1234")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -528,7 +528,7 @@ func main() {
err := checker.IsDinersCreditCard("36227206271667")

if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -561,7 +561,7 @@ func main() {
err := checker.IsDiscoverCreditCard("6011111111111117")

if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -593,7 +593,7 @@ import (
func main() {
err := checker.IsEmail("[email protected]")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -625,7 +625,7 @@ import (
func main() {
err := checker.IsFqdn("zdo.com")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -657,7 +657,7 @@ import (
func main() {
err := checker.IsIP("2001:db8::68")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -689,7 +689,7 @@ import (
func main() {
err := checker.IsIPV4("192.168.1.1")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -722,7 +722,7 @@ func main() {
err := checker.IsIPV6("2001:db8::68")

if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -754,7 +754,7 @@ import (
func main() {
err := checker.IsISBN("1430248270")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -786,7 +786,7 @@ import (
func main() {
err := checker.IsISBN10("1430248270")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -818,7 +818,7 @@ import (
func main() {
err := checker.IsISBN13("9781430248279")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -851,7 +851,7 @@ func main() {
err := checker.IsJcbCreditCard("3530111333300000")

if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -883,7 +883,7 @@ import (
func main() {
err := checker.IsLuhn("4012888888881881")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -915,7 +915,7 @@ import (
func main() {
err := checker.IsMac("00:00:5e:00:53:01")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -948,7 +948,7 @@ func main() {
err := checker.IsMasterCardCreditCard("5555555555554444")

if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -982,7 +982,7 @@ func main() {

err := checker.IsMax(quantity, 10)
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -1016,7 +1016,7 @@ func main() {

err := checker.IsMaxLength(s, 4)
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -1050,7 +1050,7 @@ func main() {

err := checker.IsMin(age, 21)
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -1084,7 +1084,7 @@ func main() {

err := checker.IsMinLength(s, 4)
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -1150,7 +1150,7 @@ import (
func main() {
err := checker.IsURL("https://zdo.com")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -1183,7 +1183,7 @@ func main() {
err := checker.IsUnionPayCreditCard("6200000000000005")

if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down Expand Up @@ -1216,7 +1216,7 @@ func main() {
err := checker.IsVisaCreditCard("4111111111111111")

if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion alphanumeric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func ExampleIsAlphanumeric() {
err := checker.IsAlphanumeric("ABcd1234")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}

Expand Down
2 changes: 1 addition & 1 deletion ascii_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func ExampleIsASCII() {
err := checker.IsASCII("Checker")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}

Expand Down
6 changes: 3 additions & 3 deletions checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func Check(s interface{}) (Errors, bool) {
panic("expecting struct")
}

errors := Errors{}
errs := Errors{}

jobs := []checkerJob{
{
Expand Down Expand Up @@ -118,14 +118,14 @@ func Check(s interface{}) (Errors, bool) {
} else {
for _, checker := range initCheckers(job.Config) {
if err := checker(job.Value, job.Parent); err != nil {
errors[job.Name] = err
errs[job.Name] = err
break
}
}
}
}

return errors, len(errors) == 0
return errs, len(errs) == 0
}

// initCheckers initializes the checkers provided in the config.
Expand Down
18 changes: 9 additions & 9 deletions checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ func TestCheckInvalid(t *testing.T) {

person := &Person{}

mistakes, valid := Check(person)
errors, valid := Check(person)
if valid {
t.Fail()
}

if len(mistakes) != 1 {
if len(errors) != 1 {
t.Fail()
}

if mistakes["Name"] != ErrRequired {
if errors["Name"] != ErrRequired {
t.Fail()
}
}
Expand All @@ -83,12 +83,12 @@ func TestCheckValid(t *testing.T) {
Name: "Onur",
}

mistakes, valid := Check(person)
errors, valid := Check(person)
if !valid {
t.Fail()
}

if len(mistakes) != 0 {
if len(errors) != 0 {
t.Fail()
}
}
Expand All @@ -112,20 +112,20 @@ func TestCheckNestedStruct(t *testing.T) {

person := &Person{}

mistakes, valid := Check(person)
errors, valid := Check(person)
if valid {
t.Fail()
}

if len(mistakes) != 2 {
if len(errors) != 2 {
t.Fail()
}

if mistakes["Name"] != ErrRequired {
if errors["Name"] != ErrRequired {
t.Fail()
}

if mistakes["Home.Street"] != ErrRequired {
if errors["Home.Street"] != ErrRequired {
t.Fail()
}
}
Expand Down
2 changes: 1 addition & 1 deletion cidr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func ExampleIsCidr() {
err := checker.IsCidr("2001:db8::/32")
if err != nil {
// Send the mistakes back to the user
// Send the errors back to the user
}
}

Expand Down
Loading

0 comments on commit 80ba6aa

Please sign in to comment.