Skip to content

Commit

Permalink
Merge branch 'main' of github.com:refaktor/rye
Browse files Browse the repository at this point in the history
  • Loading branch information
refaktor committed Dec 2, 2023
2 parents 637ec36 + 1b92884 commit bef5bb9
Show file tree
Hide file tree
Showing 4 changed files with 253 additions and 3 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Build
run: go build -v -tags "b_tiny,b_sqlite,b_http,b_sql,b_postgres,b_openai,b_bson,b_crypto,b_smtpd,b_mail,b_postmark,b_bctypt,b_telegram,b_norepl" ./...

# - name: Test
# run: go test -v -tags "b_tiny,b_sqlite,b_http,b_sql,b_postgres,b_openai,b_bson,b_crypto,b_smtpd,b_mail,b_postmark,b_bctypt,b_telegram" ./...
58 changes: 58 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: golangci-lint
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.54

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

# Optional: golangci-lint command line arguments.
#
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
# args: --timeout=30m --config=/my/path/.golangci.yml --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 all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true

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

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

# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
164 changes: 164 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
linters-settings:
depguard:
# new configuration
rules:
logger:
deny:
# logging is allowed only by logutils.Log,
# logrus is allowed to use only in logutils package.
- pkg: "github.com/sirupsen/logrus"
desc: logging is allowed only by logutils.Log
dupl:
threshold: 100
funlen:
lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner.
statements: 50
goconst:
min-len: 2
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
gocyclo:
min-complexity: 15
gofmt:
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
goimports:
local-prefixes: github.com/golangci/golangci-lint
gomnd:
# don't include the "operation" and "assign"
checks:
- argument
- case
- condition
- return
ignored-numbers:
- '0'
- '1'
- '2'
- '3'
ignored-functions:
- strings.SplitN

govet:
check-shadowing: true
settings:
# printf:
# funcs:
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
# - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
lll:
line-length: 140
misspell:
locale: US
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
revive:
rules:
- name: unexported-return
disabled: true
- name: unused-parameter

linters:
disable-all: true
enable:
- bodyclose
- depguard
- dogsled
# - dupl
# - errcheck
- exportloopref
# - funlen
- gocheckcompilerdirectives
- gochecknoinits
# - goconst
# - gocritic
# - gocyclo
# - gofmt
# - goimports
# - gomnd
- goprintffuncname
- gosec
# - gosimple
- govet
# - ineffassign
# - lll
# - misspell
# - nakedret
- noctx
- nolintlint
# - revive
- staticcheck
# - stylecheck
- typecheck
- unconvert
- unparam
# - unused
# - whitespace

# don't enable:
# - asciicheck
# - scopelint
# - gochecknoglobals
# - gocognit
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - prealloc
# - testpackage
# - wsl

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- text: "evaldo"
linters: typecheck

# - path: _test\.go
# linters:
# - gomnd

# - path: pkg/golinters/errcheck.go
# text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
# - path: pkg/commands/run.go
# text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
# - path: pkg/commands/run.go
# text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used."

# - path: pkg/golinters/gofumpt.go
# text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead."
# - path: pkg/golinters/staticcheck_common.go
# text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead."
# - path: pkg/lint/lintersdb/manager.go
# text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead."
# - path: pkg/golinters/unused.go
# text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)"
# - path: test/(fix|linters)_test.go
# text: "string `gocritic.go` has 3 occurrences, make it a constant"

run:
timeout: 5m
# skip-dirs:
# - test/testdata_etc # test files
# - internal/cache # extracted from Go code
# - internal/renameio # extracted from Go code
# - internal/robustio # extracted from Go code

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

## What is Rye

Rye is a human centric, high level, dynamic **programming language** based on ideas from **Rebol**, flavored by
Rye is a high level, dynamic **programming language** based on ideas from **Rebol**, flavored by
Factor, Linux shells and Golang. It's still an experiment in language design, but it should slowly become more and
more useful in real world.

Expand All @@ -33,8 +33,6 @@ Go's libraries are quite easy to integrate.

## Status: Alpha

Heads up!: Just now, Aug/Sep 2022 I am reorganizing how and where all the integrations are defined, so repository is a little in a mess. Things will get better once I am done with this process.

Core ideas of the language are formed. Most experimenting, at least until version 1 is done.
Right now, my focus is on making the core and runtime more ready and friendly for a potential brave souls that want to install it and
dabble around a little.
Expand Down

0 comments on commit bef5bb9

Please sign in to comment.