Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed linter workflow #116

Merged
merged 4 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Go version: [e.g. 1.21]
- Package version: [e.g. 1.0.0]
- OS: [e.g. iOS]
- Go version: [e.g. 1.21]
- Package version: [e.g. 1.0.0]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ linters:
- makezero
- wrapcheck
- interfacebloat
- dupl
- errorlint
- gosmopolitan
- ireturn
- nolintlint

# disabled because of generics
- rowserrcheck
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
branches: [ "main" ]
schedule:
- cron: '0 9 * * *'

permissions:
contents: read
security-events: write
pull-requests: read

jobs:
analyze:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- main
pull_request:

permissions:
contents: read

jobs:
build:
name: Build Examples
Expand Down
29 changes: 25 additions & 4 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ on:
- main
pull_request:

permissions:
contents: read
packages: read
statuses: write

jobs:
build:
name: Lint Code Base
super-linter:
name: Super-Linter
runs-on: ubuntu-latest

steps:
Expand All @@ -25,6 +30,22 @@ jobs:
- name: Lint Code Base
uses: super-linter/super-linter/slim@v6
env:
VALIDATE_GO: true
VALIDATE_ALL_CODEBASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_GO: false
VALIDATE_MARKDOWN: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

golangci-lint:
name: GolangCI-Lint
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.0
- name: Checkout source code
uses: actions/checkout@v4
- name: Install dependencies
run: go mod tidy
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
6 changes: 6 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
schedule:
- cron: '0 8 * * *'

permissions:
contents: read
statuses: write
issues: write
pull-requests: write

jobs:
stale:

Expand Down
12 changes: 5 additions & 7 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ decisions when appropriate.

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
info@kaiser-bielefeld.de.
[info@kaiser-bielefeld.de](mailto:info@kaiser-bielefeld.de).
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down Expand Up @@ -116,13 +116,11 @@ the community.

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
[contributor-covenant.org](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
[https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at
[https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Supported Versions

I am dedicated to ensure the security of go-dbase. To achieve this, I follow the Semantic Versioning (semver) scheme, where revisions are in the format "major.minor.patch".
I am dedicated to ensure the security of go-dbase. To achieve this, I follow the Semantic Versioning (SemVer) scheme, where revisions are in the format "major.minor.patch".
I will release patches for any security vulnerabilities that are discovered in the latest major or minor release.

| Version | Supported |
Expand Down
1 change: 1 addition & 0 deletions dbase/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func julianDate(y, m, d int) int {

// Convert julian day number to year, month and day.
// (Julian day number -> days since 01-01-4712 BC)
// nolint: gocritic // assignment can not be simplified
func julianToDate(jd int) (int, int, int) {
l := jd + 68569
n := (4 * l) / 146097
Expand Down
12 changes: 6 additions & 6 deletions dbase/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewError(err string) Error {
trace: make([]string, 0),
details: make([]error, 0),
}
e.trace = trace(e, 2)
e.trace = trace(e)
return e
}

Expand All @@ -47,7 +47,7 @@ func NewErrorf(format string, a ...interface{}) Error {
trace: make([]string, 0),
details: make([]error, 0),
}
e.trace = trace(e, 2)
e.trace = trace(e)
return e
}

Expand Down Expand Up @@ -82,20 +82,20 @@ func WrapError(err error) Error {
return NewError("unknown error occurred - cant wrap nil error")
}
if e, ok := err.(Error); ok {
e.trace = trace(e, 2)
e.trace = trace(e)
return e
}
e := Error{
msg: err.Error(),
trace: make([]string, 0),
details: make([]error, 0),
}
e.trace = trace(e, 2)
e.trace = trace(e)
return e
}

func trace(e Error, level int) []string {
_, file, line, ok := runtime.Caller(level)
func trace(e Error) []string {
_, file, line, ok := runtime.Caller(2)
if !ok {
return e.trace
}
Expand Down
8 changes: 4 additions & 4 deletions dbase/io_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (u UnixIO) ReadHeader(file *File) error {
return nil
}

func (u UnixIO) WriteHeader(file *File) (err error) {
func (u UnixIO) WriteHeader(file *File) error {
debugf("Writing header - exclusive writing: %v", file.config.WriteLock)
handle, err := u.getHandle(file)
if err != nil {
Expand Down Expand Up @@ -280,7 +280,7 @@ func (u UnixIO) ReadColumns(file *File) ([]*Column, *Column, error) {
return columns, nullFlag, nil
}

func (u UnixIO) WriteColumns(file *File) (err error) {
func (u UnixIO) WriteColumns(file *File) error {
debugf("Writing columns - exclusive writing: %v", file.config.WriteLock)
handle, err := u.getHandle(file)
if err != nil {
Expand Down Expand Up @@ -488,7 +488,7 @@ func (u UnixIO) WriteMemo(file *File, raw []byte, text bool, length int) ([]byte
return address, nil
}

func (u UnixIO) WriteMemoHeader(file *File, size int) (err error) {
func (u UnixIO) WriteMemoHeader(file *File, size int) error {
relatedHandle, err := u.getRelatedHandle(file)
if err != nil {
return WrapError(err)
Expand Down Expand Up @@ -543,7 +543,7 @@ func (u UnixIO) ReadRow(file *File, position uint32) ([]byte, error) {
return buf, nil
}

func (u UnixIO) WriteRow(file *File, row *Row) (err error) {
func (u UnixIO) WriteRow(file *File, row *Row) error {
debugf("Writing row: %d ...", row.Position)
row.handle.dbaseMutex.Lock()
defer row.handle.dbaseMutex.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion examples/documentation/documentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func main() {

output = append(output, "\n\n## Columns\n\n")
for _, info := range tableInfos {
output = append(output, fmt.Sprintf("### %v\n\n", info.Name))
output = append(output, fmt.Sprintf("\n### %v\n\n", info.Name))
output = append(output, "| Column | Type | Length | Comment |\n|---|---|---|---|\n")
for _, column := range info.ColumnsInfo {
output = append(output, column.String())
Expand Down
100 changes: 52 additions & 48 deletions examples/documentation/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,64 @@

Exracted in 45.2824ms

| Table | Columns | Records | First record | Row size | File size | Modified |
|---|---|---|---|---|---|---|
| [employees](#employees) | 16 | 3 | 808 | 523 B | 2.4 kB | 2022-10-15 00:00:00 +0200 CEST |
| [expense_categories](#expense_categories) | 3 | 5 | 392 | 59 B | 687 B | 2022-10-15 00:00:00 +0200 CEST |
| [expense_details](#expense_details) | 6 | 6 | 488 | 79 B | 962 B | 2022-10-15 00:00:00 +0200 CEST |
| [expense_reports](#expense_reports) | 9 | 3 | 584 | 140 B | 1.0 kB | 2022-10-15 00:00:00 +0200 CEST |
| Table | Columns | Records | First record | Row size | File size | Modified |
| ----------------------------------------- | ------- | ------- | ------------ | -------- | --------- | ------------------------------ |
| [employees](#employees) | 16 | 3 | 808 | 523 B | 2.4 kB | 2022-10-15 00:00:00 +0200 CEST |
| [expense_categories](#expense_categories) | 3 | 5 | 392 | 59 B | 687 B | 2022-10-15 00:00:00 +0200 CEST |
| [expense_details](#expense_details) | 6 | 6 | 488 | 79 B | 962 B | 2022-10-15 00:00:00 +0200 CEST |
| [expense_reports](#expense_reports) | 9 | 3 | 584 | 140 B | 1.0 kB | 2022-10-15 00:00:00 +0200 CEST |

## EMPLOYEES

| Name | Type | Golang type | Length | Comment |
| --- | --- | --- | --- | --- |
| *EMPLOYEEID* | I | int32 | 4 | |
| *DEPARTMENT* | C | string | 50 | |
| *SOCIALSECU* | C | string | 30 | |
| *EMPLOYEENU* | C | string | 30 | |
| *FIRSTNAME* | C | string | 50 | |
| *LASTNAME* | C | string | 50 | |
| *TITLE* | C | string | 50 | |
| *EMAILNAME* | C | string | 50 | |
| *EXTENSION* | C | string | 30 | |
| *ADDRESS* | M | []uint8 | 4 | |
| *CITY* | C | string | 50 | |
| *STATEORPRO* | C | string | 20 | |
| *POSTALCODE* | C | string | 20 | |
| *COUNTRY* | C | string | 50 | |
| *WORKPHONE* | C | string | 30 | |
| *NOTES* | M | []uint8 | 4 | |
| Name | Type | Golang type | Length | Comment |
| ------------ | ---- | ----------- | ------ | ------- |
| *EMPLOYEEID* | I | int32 | 4 | |
| *DEPARTMENT* | C | string | 50 | |
| *SOCIALSECU* | C | string | 30 | |
| *EMPLOYEENU* | C | string | 30 | |
| *FIRSTNAME* | C | string | 50 | |
| *LASTNAME* | C | string | 50 | |
| *TITLE* | C | string | 50 | |
| *EMAILNAME* | C | string | 50 | |
| *EXTENSION* | C | string | 30 | |
| *ADDRESS* | M | []uint8 | 4 | |
| *CITY* | C | string | 50 | |
| *STATEORPRO* | C | string | 20 | |
| *POSTALCODE* | C | string | 20 | |
| *COUNTRY* | C | string | 50 | |
| *WORKPHONE* | C | string | 30 | |
| *NOTES* | M | []uint8 | 4 | |

## EXPENSE_CATEGORIES

| Name | Type | Golang type | Length | Comment |
| --- | --- | --- | --- | --- |
| *EXPENSECAT* | I | int32 | 4 | |
| *EXPENSECA2* | C | string | 50 | |
| *EXPENSECA3* | I | int32 | 4 | |
| Name | Type | Golang type | Length | Comment |
| ------------ | ---- | ----------- | ------ | ------- |
| *EXPENSECAT* | I | int32 | 4 | |
| *EXPENSECA2* | C | string | 50 | |
| *EXPENSECA3* | I | int32 | 4 | |


## EXPENSE_DETAILS

| Name | Type | Golang type | Length | Comment |
| --- | --- | --- | --- | --- |
| *EXPENSEDET* | I | int32 | 4 | |
| *EXPENSEREP* | I | int32 | 4 | |
| *EXPENSECAT* | I | int32 | 4 | |
| *EXPENSEITE* | Y | float64 | 8 | |
| *EXPENSEIT2* | C | string | 50 | |
| *EXPENSEDAT* | T | time.Time | 8 | |
| Name | Type | Golang type | Length | Comment |
| ------------ | ---- | ----------- | ------ | ------- |
| *EXPENSEDET* | I | int32 | 4 | |
| *EXPENSEREP* | I | int32 | 4 | |
| *EXPENSECAT* | I | int32 | 4 | |
| *EXPENSEITE* | Y | float64 | 8 | |
| *EXPENSEIT2* | C | string | 50 | |
| *EXPENSEDAT* | T | time.Time | 8 | |

## EXPENSE_REPORTS

| Name | Type | Golang type | Length | Comment |
| --- | --- | --- | --- | --- |
| *EXPENSEREP* | I | int32 | 4 | |
| *EMPLOYEEID* | I | int32 | 4 | |
| *EXPENSETYP* | C | string | 50 | |
| *EXPENSERPT* | C | string | 30 | |
| *EXPENSERP2* | M | []uint8 | 4 | |
| *DATESUBMIT* | T | time.Time | 8 | |
| *ADVANCEAMO* | Y | float64 | 8 | |
| *DEPARTMENT* | C | string | 30 | |
| *PAID* | L | bool | 1 | |
| Name | Type | Golang type | Length | Comment |
| ------------ | ---- | ----------- | ------ | ------- |
| *EXPENSEREP* | I | int32 | 4 | |
| *EMPLOYEEID* | I | int32 | 4 | |
| *EXPENSETYP* | C | string | 50 | |
| *EXPENSERPT* | C | string | 30 | |
| *EXPENSERP2* | M | []uint8 | 4 | |
| *DATESUBMIT* | T | time.Time | 8 | |
| *ADVANCEAMO* | Y | float64 | 8 | |
| *DEPARTMENT* | C | string | 30 | |
| *PAID* | L | bool | 1 | |
Loading