mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 14:26:46 +00:00
feat: add golangci-lint for Go code quality
- Add .golangci.yml configuration enabling govet, staticcheck, errcheck, gosimple, ineffassign, unused, gofmt, and goimports linters - Update scripts/check.sh to run golangci-lint with go vet fallback - Update CI workflow to install golangci-lint in both format and quality jobs - Add golangci-lint to CONTRIBUTING.md setup instructions Closes #266
This commit is contained in:
@@ -102,7 +102,27 @@ if [[ "$MODE" != "check" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}3. Running ShellCheck...${NC}"
|
||||
echo -e "${YELLOW}3. Running Go linters...${NC}"
|
||||
if command -v golangci-lint > /dev/null 2>&1; then
|
||||
if golangci-lint run ./cmd/...; then
|
||||
echo -e "${GREEN}${ICON_SUCCESS} golangci-lint passed${NC}\n"
|
||||
else
|
||||
echo -e "${RED}${ICON_ERROR} golangci-lint failed${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
elif command -v go > /dev/null 2>&1; then
|
||||
echo -e "${YELLOW}${ICON_WARNING} golangci-lint not installed, falling back to go vet${NC}"
|
||||
if go vet ./cmd/...; then
|
||||
echo -e "${GREEN}${ICON_SUCCESS} go vet passed${NC}\n"
|
||||
else
|
||||
echo -e "${RED}${ICON_ERROR} go vet failed${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "${YELLOW}${ICON_WARNING} Go not installed, skipping Go checks${NC}\n"
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}4. Running ShellCheck...${NC}"
|
||||
if command -v shellcheck > /dev/null 2>&1; then
|
||||
if shellcheck mole bin/*.sh lib/*/*.sh scripts/*.sh; then
|
||||
echo -e "${GREEN}${ICON_SUCCESS} ShellCheck passed${NC}\n"
|
||||
@@ -114,7 +134,7 @@ else
|
||||
echo -e "${YELLOW}${ICON_WARNING} shellcheck not installed, skipping${NC}\n"
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}4. Running syntax check...${NC}"
|
||||
echo -e "${YELLOW}5. Running syntax check...${NC}"
|
||||
if ! bash -n mole; then
|
||||
echo -e "${RED}${ICON_ERROR} Syntax check failed (mole)${NC}\n"
|
||||
exit 1
|
||||
@@ -133,7 +153,7 @@ find lib -name "*.sh" | while read -r script; do
|
||||
done
|
||||
echo -e "${GREEN}${ICON_SUCCESS} Syntax check passed${NC}\n"
|
||||
|
||||
echo -e "${YELLOW}5. Checking optimizations...${NC}"
|
||||
echo -e "${YELLOW}6. Checking optimizations...${NC}"
|
||||
OPTIMIZATION_SCORE=0
|
||||
TOTAL_CHECKS=0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user