Skip to content
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
3 changes: 3 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
brew "pkg-config"
brew "gpgme"
brew "gnupg"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ The suggested way to start running crie is to run `chk` at the top of your proje
crie chk --continue
```

💡 Have ideas or ran into a bug? Open an issue — I’d love your feedback!

## Documentation

See the **[documentation](doc/README.md)** for installation, configuration, and usage guides.
Expand Down
1 change: 1 addition & 0 deletions cmd/crie/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package main is the main entrypoint for the crie CLI.
package main

import (
Expand Down
1 change: 1 addition & 0 deletions cmd/docgen/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package main generates CLI reference documentation for crie.
package main

import (
Expand Down
8 changes: 7 additions & 1 deletion img/apk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
COPY --from=clang_layer /usr/lib/llvm20/lib/libclang-cpp.so.20.1 /usr/lib/llvm20/lib/libclang-cpp.so.20.1
COPY --from=clang_layer /usr/lib/llvm20/lib/libLLVM.so.20.1 /usr/lib/llvm20/lib/libLLVM.so.20.1
COPY --from=clang_layer /usr/bin/clang-format /bin/clang-format
RUN apk --no-cache add cppcheck asciidoctor
RUN apk --no-cache add cppcheck asciidoctor vale

Check warning on line 18 in img/apk/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Sort these package names alphanumerically.

See more on https://sonarcloud.io/project/issues?id=tyhal_crie&issues=AZqy5dwbtaUqskAVP_UA&open=AZqy5dwbtaUqskAVP_UA&pullRequest=848

ENV VALE_CONFIG_PATH=/etc/vale/.vale.ini
COPY --chmod=644 conf/markdown/.vale.ini $VALE_CONFIG_PATH
RUN chmod -R 755 /etc/vale

Check warning on line 22 in img/apk/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this RUN instruction with the consecutive ones.

See more on https://sonarcloud.io/project/issues?id=tyhal_crie&issues=AZqy5dwbtaUqskAVP_T_&open=AZqy5dwbtaUqskAVP_T_&pullRequest=848
# hadolint ignore=DL3059
RUN vale sync

USER standards
10 changes: 10 additions & 0 deletions img/apk/conf/markdown/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
StylesPath = styles

MinAlertLevel = suggestion

Packages = write-good, proselint

# Global settings (applied to every syntax)
[*]
# List of styles to load
BasedOnStyles = proselint, write-good
4 changes: 4 additions & 0 deletions img/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
services:
# apk tools - preferred
apk:
image: docker.io/tyhal/crie-dep-apk
build: apk
# go native tools - TODO shouldn't be needed
go:
image: docker.io/tyhal/crie-dep-go
build: go
# js tools
npm:
image: docker.io/tyhal/crie-dep-npm
build: npm
# python tools
pip:
image: docker.io/tyhal/crie-dep-pip
build: pip
2 changes: 0 additions & 2 deletions img/go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ FROM go_layer AS golint_layer
# hadolint ignore=DL3062
RUN go install github.com/errata-ai/vale@latest \
&& go install github.com/mgechev/revive@latest \
&& go install golang.org/x/lint/golint@latest \
&& go install github.com/yoheimuta/protolint/cmd/protolint@latest


Expand All @@ -18,7 +17,6 @@ RUN adduser -D standards
# [ Golang ]
COPY --from=go_layer /usr/local/go/bin/gofmt /bin/gofmt
COPY --from=golint_layer /go/bin/revive /bin/revive
COPY --from=golint_layer /go/bin/golint /bin/golint
COPY --from=golint_layer /go/bin/vale /bin/vale
COPY --from=golint_layer /go/bin/protolint /bin/protolint

Expand Down
6 changes: 4 additions & 2 deletions img/pip/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ RUN mkdir /.ansible \
RUN adduser -D standards
USER standards

ENV YAMLLINT_CONFIG_FILE=/home/standards/.config/yamllint/config
ENV XDG_CONFIG_DIR=/etc/.config

ENV YAMLLINT_CONFIG_FILE=$XDG_CONFIG_DIR/yamllint/config
COPY --chown=standards:standards conf/yaml/.yamllint.yaml $YAMLLINT_CONFIG_FILE
ENV CMAKELINT_CONFIG_FILE=/home/standards/.config/cmakelintrc
ENV CMAKELINT_CONFIG_FILE=$XDG_CONFIG_DIR/cmakelintrc
COPY --chown=standards:standards conf/cmake/.cmakelintrc $CMAKELINT_CONFIG_FILE
2 changes: 1 addition & 1 deletion internal/cli/complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func completeGitTarget(_ *cobra.Command, _ []string, _ string) ([]cobra.Completi
}

func completeLanguage(cmd *cobra.Command, _ []string, toComplete string) ([]cobra.Completion, cobra.ShellCompDirective) {
filter := func(l language.Language) bool { return true }
filter := func(_ language.Language) bool { return true }
switch cmd.Name() {
case "fmt":
filter = func(l language.Language) bool {
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var LsCmd = &cobra.Command{
Long: `Show all languages available and the commands run when used`,
Args: cobra.NoArgs,
ValidArgsFunction: cobra.FixedCompletions(nil, cobra.ShellCompDirectiveNoFileComp),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
err := crieRun.Languages.Show(os.Stdout)
if err != nil {
log.Fatal(errchain.From(err).Link("crie list failed"))
Expand All @@ -40,7 +40,7 @@ var NonCmd = &cobra.Command{
Find the file extensions that dont have an associated regex match within crie`,
Args: cobra.NoArgs,
ValidArgsFunction: cobra.FixedCompletions(nil, cobra.ShellCompDirectiveNoFileComp),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
err := crieRun.NoStandards()
if err != nil {
log.Fatal(errchain.From(err).Link("finding unassociated files"))
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ var ChkCmd = &cobra.Command{
Long: `Check all code standards for coding conventions`,
Args: cobra.NoArgs,
ValidArgsFunction: cobra.FixedCompletions(nil, cobra.ShellCompDirectiveNoFileComp),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
err := crieRun.Run(runner.LintTypeChk)

if err != nil {
Expand All @@ -89,7 +89,7 @@ var FmtCmd = &cobra.Command{
Long: `Run all formatters in the list`,
Args: cobra.NoArgs,
ValidArgsFunction: cobra.FixedCompletions(nil, cobra.ShellCompDirectiveNoFileComp),
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
err := crieRun.Run(runner.LintTypeFmt)

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ format all python files
Long: `
crie brings together a vast collection of formatters and linters
to create a handy tool that can sanity check any codebase.`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {

viper.SetConfigFile(projectConfigPath)
viper.SetConfigType("yml")
Expand Down
1 change: 1 addition & 0 deletions internal/config/language/config.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package language contains configuration structures and helpers for language definitions.
package language

import (
Expand Down
8 changes: 3 additions & 5 deletions internal/config/language/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ languages:
chk:
type: cli
exec:
bin: golint
start: ["-set_exit_status"]
bin: revive
start: ["-config", "/etc/revive/revive.toml", "-set_exit_status"]
img: "ghcr.io/tyhal/crie-dep-go"
tag_crie_version: true
markdown:
Expand All @@ -132,7 +132,6 @@ languages:
type: cli
exec:
bin: vale
start: ["--config=/etc/vale/.vale.ini"]
img: "ghcr.io/tyhal/crie-dep-go"
tag_crie_version: true
asciidoctor:
Expand All @@ -141,7 +140,6 @@ languages:
type: cli
exec:
bin: vale
start: ["--config=/etc/vale/.vale.ini"]
img: "ghcr.io/tyhal/crie-dep-go"
tag_crie_version: true
json:
Expand Down Expand Up @@ -207,6 +205,6 @@ languages:
type: cli
exec:
bin: cmakelint
start: ["--config=/home/standards/.config/cmakelintrc"]
start: ["--config=/etc/.config/cmakelintrc"]
img: "ghcr.io/tyhal/crie-dep-pip"
tag_crie_version: true
2 changes: 1 addition & 1 deletion internal/config/project/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import (
"testing"
)

func TestProjectSchema(t *testing.T) {
func TestProjectSchema(_ *testing.T) {
Schema()
}
3 changes: 2 additions & 1 deletion internal/filelist/dir.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package filelist provides utilities to build file lists from directories.
package filelist

import (
Expand All @@ -11,7 +12,7 @@ func FromDir(dir string) ([]string, error) {
var files []string

// Create an initial file list
err := filepath.Walk(dir, func(currPath string, f os.FileInfo, err error) error {
err := filepath.Walk(dir, func(currPath string, f os.FileInfo, _ error) error {
if !f.IsDir() {
relPath, err := filepath.Rel(dir, currPath)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions internal/runner/execution.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package runner contains the logic to run the linters
package runner

import (
Expand Down
2 changes: 1 addition & 1 deletion internal/runner/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestFilter(t *testing.T) {
}

// Test empty result
result = Filter([]string{}, true, func(s string) bool { return true })
result = Filter([]string{}, true, func(_ string) bool { return true })
if len(result) != 0 {
t.Errorf("expected empty slice, got %v", result)
}
Expand Down
1 change: 1 addition & 0 deletions internal/runner/language.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package runner contains the logic to run the linters
package runner

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/linter/cli/cli.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package cli allows a CLI tool to be linted from the host or in a container
package cli

import (
Expand Down
1 change: 1 addition & 0 deletions pkg/linter/cli/exec/exec.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package exec allows for a CLI tool to be executed in different contexts
package exec

import "io"
Expand Down
2 changes: 1 addition & 1 deletion pkg/linter/dockfmt/dockfmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestLint_WillRun(t *testing.T) {
assert.NoError(t, l.WillRun())
}

func TestLint_Cleanup(t *testing.T) {
func TestLint_Cleanup(_ *testing.T) {
l := &LintDockFmt{}
var wg sync.WaitGroup
wg.Add(1)
Expand Down
2 changes: 1 addition & 1 deletion pkg/linter/noop/noop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestLint_WillRun(t *testing.T) {
assert.NoError(t, l.WillRun())
}

func TestLint_Cleanup(t *testing.T) {
func TestLint_Cleanup(_ *testing.T) {
l := &LintNoop{}
var wg sync.WaitGroup
wg.Add(1)
Expand Down
2 changes: 1 addition & 1 deletion pkg/linter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (r *Runner) Log(rep *Report) error {
} else {
r.logConditional(strings.NewReader(rep.Err.Error()), "toolerr", log.ErrorLevel)
}
if id != "" {
if !r.StrictLogging {
_ = r.folder.Stop(id)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/linter/shfmt/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"mvdan.cc/sh/v3/syntax"
)

func (s *shfmt) formatPath(path string, checkShebang bool) error {
func (s *shfmt) formatPath(path string, _ bool) error {
var readBuf bytes.Buffer
var copyBuf = make([]byte, 32*1024)

Expand Down
2 changes: 1 addition & 1 deletion pkg/linter/shfmt/shfmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestLint_WillRun(t *testing.T) {
assert.NoError(t, l.WillRun())
}

func TestLint_Cleanup(t *testing.T) {
func TestLint_Cleanup(_ *testing.T) {
l := &LintShfmt{}
var wg sync.WaitGroup
wg.Add(1)
Expand Down
4 changes: 3 additions & 1 deletion script/bootstrap
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/sh
set -xe

cd "$(dirname "$0")/.."

has_command() {
command -v "$1" >/dev/null 2>&1
}

install_brew() {
xargs brew install <"$(dirname "$0")/pkgs/brew.txt"
brew bundle
}

install_apt() {
Expand Down
3 changes: 0 additions & 3 deletions script/pkgs/brew.txt

This file was deleted.

1 change: 1 addition & 0 deletions verify/lang/go/src/gol.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package main is a dummy package for testing
package main

import "fmt"
Expand Down
Loading