Skip to content

Commit

Permalink
Re-enable golangci-lint.yml, turn on linters, and lint. (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
carreter authored Sep 12, 2023
1 parent ad662c7 commit 10b8f39
Show file tree
Hide file tree
Showing 41 changed files with 122 additions and 181 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: golangci-lint

on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/[email protected]
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
34 changes: 14 additions & 20 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,25 @@ run:
linters:
enable:
- bodyclose
##- dogsled
- dupl
#- exhaustivestruct
- exportloopref
#- funlen
- gochecknoinits
##- goconst
##- gocritic
##- gocyclo
##- gofmt
##- goimports
#- gomnd
# - goconst # TODO: Enable this and fix the errors.
- gofmt
- goimports
- goprintffuncname
##- gosec
#- lll
##- misspell
- misspell
- nakedret
- nilnil
- noctx
- nolintlint
##- stylecheck
##- unconvert
##- unparam
##- whitespace
#linters-settings:
# stylecheck:
# # https://staticcheck.io/docs/options#checks
# checks: ["all", "-ST1005"]
- stylecheck
- unconvert
- unparam
- whitespace
linters-settings:
stylecheck:
# https://staticcheck.io/docs/options#checks
checks:
- "all"
- "-ST1005" # Disable "Incorrectly formatted error string" errors. TODO: Enable this and fix the errors.
3 changes: 0 additions & 3 deletions align/align.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ type Scoring struct {

// NewScoring returns a new Scoring struct with default values for DNA.
func NewScoring(substitutionMatrix *matrix.SubstitutionMatrix, gapPenalty int) (Scoring, error) {

if substitutionMatrix == nil {
substitutionMatrix = matrix.Default
}
Expand All @@ -99,7 +98,6 @@ func (s Scoring) Score(a, b byte) (int, error) {
// It returns the final score and the optimal alignments of the two strings in O(nm) time and O(nm) space.
// https://en.wikipedia.org/wiki/Needleman-Wunsch_algorithm
func NeedlemanWunsch(stringA string, stringB string, scoring Scoring) (int, string, string, error) {

// Get the M and N dimensions of the matrix. The M x N matrix is standard linear algebra notation.
// But I added columns and rows to the variable name to make it more clear what the dimensions are.
columnLengthM, rowLengthN := len(stringA), len(stringB)
Expand Down Expand Up @@ -171,7 +169,6 @@ func NeedlemanWunsch(stringA string, stringB string, scoring Scoring) (int, stri
// It returns the max score and optimal local alignments between two strings alignments of the two strings in O(nm) time and O(nm) space.
// https://en.wikipedia.org/wiki/Smith-Waterman_algorithm
func SmithWaterman(stringA string, stringB string, scoring Scoring) (int, string, string, error) {

columnLengthM, rowLengthN := len(stringA), len(stringB)

// Initialize the alignment matrix
Expand Down
3 changes: 0 additions & 3 deletions align/align_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
)

func TestNeedlemanWunsch(t *testing.T) {

mat := [][]int{
/* A C G T U */
/* A */ {1, -1, -1, -1, -1},
Expand Down Expand Up @@ -138,7 +137,6 @@ func TestNeedlemanWunsch(t *testing.T) {
}

func TestSmithWaterman(t *testing.T) {

mat := [][]int{
/* - A C G T */
/* - */ {0, 0, 0, 0, 0},
Expand Down Expand Up @@ -291,5 +289,4 @@ func TestSmithWaterman(t *testing.T) {
if alignN != "G" {
t.Errorf("Alignment is %s, expected G", alignN)
}

}
1 change: 1 addition & 0 deletions align/example_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//nolint:dupl
package align_test

import (
Expand Down
2 changes: 1 addition & 1 deletion align/matrix/matrices.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// license that can be found in the LICENSE file.

/*
Package matrix provides a variety of alignment scoring matrices for sequence alignment.
Package matrix provides a variety of alignment scoring matrices for sequence alignment.
These matrices have been lovingly borrowed from biogo/align.
https://github.com/biogo/biogo/blob/master/align/matrix/matrices.go
Expand Down
2 changes: 1 addition & 1 deletion align/matrix/matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func TestSubstitutionMatrix(t *testing.T) {
alpha1 := alphabet.NewAlphabet([]string{"-", "A", "C", "G", "T"})
alpha2 := alphabet.NewAlphabet([]string{"-", "A", "C", "G", "T"})
NUC_4 := [][]int{
NUC_4 := [][]int{ //nolint:stylecheck
/* - A C G T */
/* - */ {0, 0, 0, 0, 0},
/* A */ {0, 5, -4, -4, -4},
Expand Down
1 change: 0 additions & 1 deletion alphabet/alphabet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func TestAlphabet(t *testing.T) {
}

func TestAlphabet_Symbols(t *testing.T) {

// Test Symbols
symbols := []string{"A", "C", "G", "T"}
a := alphabet.NewAlphabet(symbols)
Expand Down
1 change: 0 additions & 1 deletion clone/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ func ExampleGoldenGate() {

fmt.Println(seqhash.RotateSequence(Clones[0]))
// Output: AAAAAAAGGATCTCAAGAAGGCCTACTATTAGCAACAACGATCCTTTGATCTTTTCTACGGGGTCTGACGCTCAGTGGAACGAAAACTCACGTTAAGGGATTTTGGTCATGAGATTATCAAAAAGGATCTTCACCTAGATCCTTTTAAATTAAAAATGAAGTTTTAAATCAATCTAAAGTATATATGAGTAAACTTGGTCTGACAGTTACCAATGCTTAATCAGTGAGGCACCTATCTCAGCGATCTGTCTATTTCGTTCATCCATAGTTGCCTGACTCCCCGTCGTGTAGATAACTACGATACGGGAGGGCTTACCATCTGGCCCCAGTGCTGCAATGATACCGCGAGAACCACGCTCACCGGCTCCAGATTTATCAGCAATAAACCAGCCAGCCGGAAGGGCCGAGCGCAGAAGTGGTCCTGCAACTTTATCCGCCTCCATCCAGTCTATTAATTGTTGCCGGGAAGCTAGAGTAAGTAGTTCGCCAGTTAATAGTTTGCGCAACGTTGTTGCCATTGCTACAGGCATCGTGGTGTCACGCTCGTCGTTTGGTATGGCTTCATTCAGCTCCGGTTCCCAACGATCAAGGCGAGTTACATGATCCCCCATGTTGTGCAAAAAAGCGGTTAGCTCCTTCGGTCCTCCGATCGTTGTCAGAAGTAAGTTGGCCGCAGTGTTATCACTCATGGTTATGGCAGCACTGCATAATTCTCTTACTGTCATGCCATCCGTAAGATGCTTTTCTGTGACTGGTGAGTACTCAACCAAGTCATTCTGAGAATAGTGTATGCGGCGACCGAGTTGCTCTTGCCCGGCGTCAATACGGGATAATACCGCGCCACATAGCAGAACTTTAAAAGTGCTCATCATTGGAAAACGTTCTTCGGGGCGAAAACTCTCAAGGATCTTACCGCTGTTGAGATCCAGTTCGATGTAACCCACTCGTGCACCCAACTGATCTTCAGCATCTTTTACTTTCACCAGCGTTTCTGGGTGAGCAAAAACAGGAAGGCAAAATGCCGCAAAAAAGGGAATAAGGGCGACACGGAAATGTTGAATACTCATACTCTTCCTTTTTCAATATTATTGAAGCATTTATCAGGGTTATTGTCTCATGAGCGGATACATATTTGAATGTATTTAGAAAAATAAACAAATAGGGGTTCCGCGCACCTGCACCAGTCAGTAAAACGACGGCCAGTAGTCAAAAGCCTCCGACCGGAGGCTTTTGACTTGGTTCAGGTGGAGTGGGAGAAACACGTGGCAAACATTCCGGTCTCAAATGGAAAAGAGCAACGAAACCAACGGCTACCTTGACAGCGCTCAAGCCGGCCCTGCAGCTGGCCCGGGCGCTCCGGGTACCGCCGCGGGTCGTGCACGTCGTTGCGCGGGCTTCCTGCGGCGCCAAGCGCTGGTGCTGCTCACGGTGTCTGGTGTTCTGGCAGGCGCCGGTTTGGGCGCGGCACTGCGTGGGCTCAGCCTGAGCCGCACCCAGGTCACCTACCTGGCCTTCCCCGGCGAGATGCTGCTCCGCATGCTGCGCATGATCATCCTGCCGCTGGTGGTCTGCAGCCTGGTGTCGGGCGCCGCCTCCCTCGATGCCAGCTGCCTCGGGCGTCTGGGCGGTATCGCTGTCGCCTACTTTGGCCTCACCACACTGAGTGCCTCGGCGCTCGCCGTGGCCTTGGCGTTCATCATCAAGCCAGGATCCGGTGCGCAGACCCTTCAGTCCAGCGACCTGGGGCTGGAGGACTCGGGGCCTCCTCCTGTCCCCAAAGAAACGGTGGACTCTTTCCTCGACCTGGCCAGAAACCTGTTTCCCTCCAATCTTGTGGTTGCAGCTTTCCGTACGTATGCAACCGATTATAAAGTCGTGACCCAGAACAGCAGCTCTGGAAATGTAACCCATGAAAAGATCCCCATAGGCACTGAGATAGAAGGGATGAACATTTTAGGATTGGTCCTGTTTGCTCTGGTGTTAGGAGTGGCCTTAAAGAAACTAGGCTCCGAAGGAGAGGACCTCATCCGTTTCTTCAATTCCCTCAACGAGGCGACGATGGTGCTGGTGTCCTGGATTATGTGGTACGTACCTGTGGGCATCATGTTCCTTGTTGGAAGCAAGATCGTGGAAATGAAAGACATCATCGTGCTGGTGACCAGCCTGGGGAAATACATCTTCGCATCTATATTGGGCCACGTCATTCATGGTGGTATCGTCCTGCCGCTGATTTATTTTGTTTTCACACGAAAAAACCCATTCAGATTCCTCCTGGGCCTCCTCGCCCCATTTGCGACAGCATTTGCTACGTGCTCCAGCTCAGCGACCCTTCCCTCTATGATGAAGTGCATTGAAGAGAACAATGGTGTGGACAAGAGGATCTCCAGGTTTATTCTCCCCATCGGGGCCACCGTGAACATGGACGGAGCAGCCATCTTCCAGTGTGTGGCCGCGGTGTTCATTGCGCAACTCAACAACGTAGAGCTCAACGCAGGACAGATTTTCACCATTCTAGTGACTGCCACAGCGTCCAGTGTTGGAGCAGCAGGCGTGCCAGCTGGAGGGGTCCTCACCATTGCCATTATCCTGGAGGCCATTGGGCTGCCTACTCATGATCTGCCTCTGATCCTGGCTGTGGACTGGATTGTGGACCGGACCACCACGGTGGTGAATGTGGAAGGGGATGCCCTGGGTGCAGGCATTCTCCACCACCTGAATCAGAAGGCAACAAAGAAAGGCGAGCAGGAACTTGCTGAGGTGAAAGTGGAAGCCATCCCCAACTGCAAGTCTGAGGAGGAAACCTCGCCCCTGGTGACACACCAGAACCCCGCTGGCCCCGTGGCCAGTGCCCCAGAACTGGAATCCAAGGAGTCGGTTCTGTGAAGAGCTTAGAGACCGACGACTGCCTAAGGACATTCGCTGAGGTGTCAATCGTCGGAGCCGCTGAGCAATAACTAGCATAACCCCTTGGGGCCTCTAAACGGGTCTTGAGGGGTTTTTTGCATGGTCATAGCTGTTTCCTGAGAGCTTGGCAGGTGATGACACACATTAACAAATTTCGTGAGGAGTCTCCAGAAGAATGCCATTAATTTCCATAGGCTCCGCCCCCCTGACGAGCATCACAAAAATCGACGCTCAAGTCAGAGGTGGCGAAACCCGACAGGACTATAAAGATACCAGGCGTTTCCCCCTGGAAGCTCCCTCGTGCGCTCTCCTGTTCCGACCCTGCCGCTTACCGGATACCTGTCCGCCTTTCTCCCTTCGGGAAGCGTGGCGCTTTCTCATAGCTCACGCTGTAGGTATCTCAGTTCGGTGTAGGTCGTTCGCTCCAAGCTGGGCTGTGTGCACGAACCCCCCGTTCAGCCCGACCGCTGCGCCTTATCCGGTAACTATCGTCTTGAGTCCAACCCGGTAAGACACGACTTATCGCCACTGGCAGCAGCCACTGGTAACAGGATTAGCAGAGCGAGGTATGTAGGCGGTGCTACAGAGTTCTTGAAGTGGTGGCCTAACTACGGCTACACTAGAAGAACAGTATTTGGTATCTGCGCTCTGCTGAAGCCAGTTACCTTCGGAAAAAGAGTTGGTAGCTCTTGATCCGGCAAACAAACCACCGCTGGTAGCGGTGGTTTTTTTGTTTGCAAGCAGCAGATTACGCGCAG

}

func TestSignalKilledGoldenGate(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions fold/fold.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ func multibranch(start, mid, end int, foldContext context, helix bool) (nucleicA
}
summedEnergy += w.energy
}

}

if unpaired < 0 {
Expand Down Expand Up @@ -539,7 +538,6 @@ func internalLoop(start, rightOfStart, end, leftOfEnd int, foldContext context)

if loopLeftIndex < 1 {
return 0, fmt.Errorf("internal loop: subsequence (%d, %d, %d, %d): missing left part of the loop", start, rightOfStart, end, leftOfEnd)

}
if loopRightIndex < 1 {
return 0, fmt.Errorf("internal loop: subsequence (%d, %d, %d, %d): missing right part of the loop", start, rightOfStart, end, leftOfEnd)
Expand Down
3 changes: 1 addition & 2 deletions fold/seqfold.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ A - number of helices in the loop
B - number of unpaired nucleotides in the loop
C - coxial stacking in the loop
D - terminal mismatch contributions
E - base composition of the unpaired nucleotides (probably neglible?)
E - base composition of the unpaired nucleotides (probably negligible?)
Inferred from:
Supplemental Material: Annu.Rev.Biophs.Biomol.Struct.33:415-40
doi: 10.1146/annurev.biophys.32.110601.141800
Expand Down Expand Up @@ -189,7 +189,6 @@ func newFoldingContext(seq string, temp float64) (context, error) {
return context{}, fmt.Errorf("error filling the caches for the FoldingContext: %w", err)
}
return ret, nil

}

// Result holds the resulting structures of the folded s
Expand Down
1 change: 0 additions & 1 deletion io/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
// This is where the integration tests that make effed up cyclic dependencies go.

func Example() {

// Poly can take in basic gff, gbk, fasta, and JSON.
// We call the json package "pson" (poly JSON) to prevent namespace collision with Go's standard json package.

Expand Down
1 change: 0 additions & 1 deletion io/fasta/fasta.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ func Build(fastas []Fasta) ([]byte, error) {
lineCount := 0
// write the fasta sequence 80 characters at a time
for _, character := range fasta.Sequence {

fastaString.WriteRune(character)
lineCount++
if lineCount == 80 {
Expand Down
7 changes: 2 additions & 5 deletions io/genbank/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func ExampleParseMulti() {
}

func ExampleGenbank_AddFeature() {

// Sequence for greenflourescent protein (GFP) that we're using as test data for this example.
gfpSequence := "ATGGCTAGCAAAGGAGAAGAACTTTTCACTGGAGTTGTCCCAATTCTTGTTGAATTAGATGGTGATGTTAATGGGCACAAATTTTCTGTCAGTGGAGAGGGTGAAGGTGATGCTACATACGGAAAGCTTACCCTTAAATTTATTTGCACTACTGGAAAACTACCTGTTCCATGGCCAACACTTGTCACTACTTTCTCTTATGGTGTTCAATGCTTTTCCCGTTATCCGGATCATATGAAACGGCATGACTTTTTCAAGAGTGCCATGCCCGAAGGTTATGTACAGGAACGCACTATATCTTTCAAAGATGACGGGAACTACAAGACGCGTGCTGAAGTCAAGTTTGAAGGTGATACCCTTGTTAATCGTATCGAGTTAAAAGGTATTGATTTTAAAGAAGATGGAAACATTCTCGGACACAAACTCGAGTACAACTATAACTCACACAATGTATACATCACGGCAGACAAACAAAAGAATGGAATCAAAGCTAACTTCAAAATTCGCCACAACATTGAAGATGGATCCGTTCAACTAGCAGACCATTATCAACAAAATACTCCAATTGGCGATGGCCCTGTCCTTTTACCAGACAACCATTACCTGTCGACACAATCTGCCCTTTCGAAAGATCCCAACGAAAAGCGTGACCACATGGTCCTTCTTGAGTTTGTAACTGCTGCTGGGATTACACATGGCATGGATGAGCTCTACAAATAA"

Expand All @@ -123,7 +122,7 @@ func ExampleGenbank_AddFeature() {
sequence.Sequence = gfpSequence

// Set the initialized feature name and sequence location.
feature.Description = "Green Flourescent Protein"
feature.Description = "Green Fluorescent Protein"
feature.Location = genbank.Location{}
feature.Location.Start = 0
feature.Location.End = len(sequence.Sequence)
Expand All @@ -141,7 +140,6 @@ func ExampleGenbank_AddFeature() {
}

func ExampleFeature_GetSequence() {

// Sequence for greenflourescent protein (GFP) that we're using as test data for this example.
gfpSequence := "ATGGCTAGCAAAGGAGAAGAACTTTTCACTGGAGTTGTCCCAATTCTTGTTGAATTAGATGGTGATGTTAATGGGCACAAATTTTCTGTCAGTGGAGAGGGTGAAGGTGATGCTACATACGGAAAGCTTACCCTTAAATTTATTTGCACTACTGGAAAACTACCTGTTCCATGGCCAACACTTGTCACTACTTTCTCTTATGGTGTTCAATGCTTTTCCCGTTATCCGGATCATATGAAACGGCATGACTTTTTCAAGAGTGCCATGCCCGAAGGTTATGTACAGGAACGCACTATATCTTTCAAAGATGACGGGAACTACAAGACGCGTGCTGAAGTCAAGTTTGAAGGTGATACCCTTGTTAATCGTATCGAGTTAAAAGGTATTGATTTTAAAGAAGATGGAAACATTCTCGGACACAAACTCGAGTACAACTATAACTCACACAATGTATACATCACGGCAGACAAACAAAAGAATGGAATCAAAGCTAACTTCAAAATTCGCCACAACATTGAAGATGGATCCGTTCAACTAGCAGACCATTATCAACAAAATACTCCAATTGGCGATGGCCCTGTCCTTTTACCAGACAACCATTACCTGTCGACACAATCTGCCCTTTCGAAAGATCCCAACGAAAAGCGTGACCACATGGTCCTTCTTGAGTTTGTAACTGCTGCTGGGATTACACATGGCATGGATGAGCTCTACAAATAA"

Expand All @@ -153,7 +151,7 @@ func ExampleFeature_GetSequence() {
sequence.Sequence = gfpSequence

// Set the initialized feature name and sequence location.
feature.Description = "Green Flourescent Protein"
feature.Description = "Green Fluorescent Protein"
feature.Location.Start = 0
feature.Location.End = len(sequence.Sequence)

Expand All @@ -167,5 +165,4 @@ func ExampleFeature_GetSequence() {
fmt.Println(gfpSequence == featureSequence)

// Output: true

}
Loading

0 comments on commit 10b8f39

Please sign in to comment.