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

fix: clean project #1

Merged
merged 7 commits into from
Oct 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
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and tests
on:
push:
branches:
- main
pull_request:

jobs:

cross:
name: Go
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 0

strategy:
matrix:
go-version: [ oldstable, stable ]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Test
run: make test

- name: Build
run: make build
38 changes: 38 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Linting

on:
push:
branches:
- main
pull_request:

jobs:

lint:
name: Linting Process
runs-on: ubuntu-latest
env:
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.61.0
CGO_ENABLED: 0

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Check and get dependencies
run: |
go mod download
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: ${GOLANGCI_LINT_VERSION}

- name: Make
run: make tes
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ site/
http-client.*.json

#local autotest temp files
test/http-client.env.json
test/http-client.env.json

/dist
/vendor
/filen
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY: clean lint test build

default: clean lint test build

clean:
rm -rf dist/ cover.out

test: clean
go test -v -cover ./...

lint:
golangci-lint run

build:
go build -ldflags "-s -w" -trimpath ./cmd/filen/
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
# filen

Open-source linter to control file size on golang.
Open-source linter to control file size on Go.

## Why filen?

Vertical size of a file should be typically 200 lines, with upper limit of 500,
but you can configure it for your project.

```
defaultМaxLinesNum - 500
defaultМinLinesNum - 5
```

- Very small files are useless
- Very big files are difficult to understand it (probably you have architecture problems)
- default `maxLinesNum`: `500`.
Very big files are difficult to understand it (probably you have architecture problems)
- default `minLinesNum`: `5`.
Very small files are useless.

## Usage

```
git clone [email protected]:DanilXO/filen.git

cd dist
```bash
go install github.com/DanilXO/filen/cmd/filen@latest

./filen <path_for_check>
```
Expand All @@ -29,4 +24,4 @@ Available parameters:

* `-maxLinesNum int` - the maximum number of lines in a file. `500` by default
* `-minLinesNum int` - the minimum number of lines in a file. `5` by default
* `-ignoreComments bool` - ignore comment lines or not. `false` by default
* `-ignoreComments bool` - ignore comment lines or not. `false` by default
2 changes: 1 addition & 1 deletion cmd/filen/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/DanilXO/filen/pgk/filen"
"github.com/DanilXO/filen/pkg/filen"
"golang.org/x/tools/go/analysis/singlechecker"
)

Expand Down
Binary file removed dist/filen
Binary file not shown.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/DanilXO/filen

go 1.23.2
go 1.22.0

require (
github.com/stretchr/testify v1.9.0
Expand Down
1 change: 1 addition & 0 deletions pgk/filen/analyzer.go → pkg/filen/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"go/ast"
"go/token"

"golang.org/x/tools/go/analysis"
)

Expand Down
File renamed without changes.
15 changes: 0 additions & 15 deletions vendor/github.com/davecgh/go-spew/LICENSE

This file was deleted.

145 changes: 0 additions & 145 deletions vendor/github.com/davecgh/go-spew/spew/bypass.go

This file was deleted.

38 changes: 0 additions & 38 deletions vendor/github.com/davecgh/go-spew/spew/bypasssafe.go

This file was deleted.

Loading