Skip to content

Commit

Permalink
Ran linter
Browse files Browse the repository at this point in the history
  • Loading branch information
abondrn committed Oct 30, 2023
1 parent ef07e94 commit cac1e55
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ In order to simplify the development experience, and environment setup, the poly

Whether you're a beginner with Go or you're an experienced developer, You should see the suggestions popup automatically when you goto the *Plugins* tab in VSCode. Using these plugins can help accelerate the development experience and also allow you to work more collaboratively with other poly developers.

## Local Checks

Poly runs numerous CI/CD checks via Github Actions before a PR can be merged. In order to make your PR mergeable, your PR must pass all of these checks.

A quick way to check your PR will pass is to run:

```sh
gofmt -s -w . && go test ./...
```

Additionally, you may want to [install](https://golangci-lint.run/usage/install/#local-installation) and run the linter.

# How to report a bug

### Security disclosures
Expand Down
38 changes: 19 additions & 19 deletions io/genbank/genbank.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ package genbank
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"os"
"regexp"
"strconv"
"strings"
"encoding/json"

"github.com/TimothyStiles/poly/transform"
"github.com/lunny/log"
Expand Down Expand Up @@ -79,13 +79,13 @@ type Feature struct {
}

type FeatureJSON struct {
Type string `json:"type"`
Description string `json:"description"`
Type string `json:"type"`
Description string `json:"description"`
Attributes map[string][]string `json:"attributes"`
SequenceHash string `json:"sequence_hash"`
SequenceHashFunction string `json:"hash_function"`
Sequence string `json:"sequence"`
Location Location `json:"location"`
SequenceHash string `json:"sequence_hash"`
SequenceHashFunction string `json:"hash_function"`
Sequence string `json:"sequence"`
Location Location `json:"location"`
}

// Reference holds information for one reference in a Meta struct.
Expand Down Expand Up @@ -151,17 +151,17 @@ func (feature Feature) GetSequence() (string, error) {

func (feature Feature) MarshalJSON() ([]byte, error) {
attributes := make(map[string][]string)
feature.Attributes.EachAssociation(func (key string, values []string) {
feature.Attributes.EachAssociation(func(key string, values []string) {
attributes[key] = values
})
return json.Marshal(FeatureJSON{
Type: feature.Type,
Description: feature.Description,
Attributes: attributes,
SequenceHash: feature.SequenceHash,
Type: feature.Type,
Description: feature.Description,
Attributes: attributes,
SequenceHash: feature.SequenceHash,
SequenceHashFunction: feature.SequenceHashFunction,
Sequence: feature.Sequence,
Location: feature.Location,
Sequence: feature.Sequence,
Location: feature.Location,
})
}

Expand Down Expand Up @@ -1050,7 +1050,7 @@ func BuildFeatureString(feature Feature) string {
returnString := featureHeader

if feature.Attributes != nil {
feature.Attributes.Each(func (key string, value string) {
feature.Attributes.Each(func(key string, value string) {
returnString += generateWhiteSpace(qualifierIndex) + "/" + key + "=\"" + value + "\"\n"
})
}
Expand Down Expand Up @@ -1078,14 +1078,14 @@ func EqualMultiMaps(this, other multimap.MultiMap[string, string]) bool {
if this.Size() != other.Size() {
return false
}
var allEqual bool = true
this.EachAssociation(func (key string, values []string) {
allEqual := true
this.EachAssociation(func(key string, values []string) {
allEqual = allEqual && EqualSlices(values, other.Get(key))
})
if !allEqual {
return false
}
other.EachAssociation(func (key string, values []string) {
other.EachAssociation(func(key string, values []string) {
allEqual = allEqual && EqualSlices(values, this.Get(key))
})
return allEqual
Expand All @@ -1103,4 +1103,4 @@ func EqualSlices[V comparable](this, other []V) bool {
}
}
return true
}
}

0 comments on commit cac1e55

Please sign in to comment.