diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index fbf7d1c..0809caf 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,21 +1,65 @@ -name: linter +name: Node.js Linting on: - # Execute on every pull request to the master branch + push: + branches: ["**"] pull_request_target: - branches: - - main + branches: [main] jobs: - linter: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up node + - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' - - run: npm install -g dockerfilelint prettier@latest - - run: dockerfilelint Dockerfile - - run: prettier --check . + cache: 'npm' + + - name: Install dependencies + run: | + if [ -f package.json ]; then + npm install + else + echo "No package.json found, installing global tools only" + fi + + # JavaScript/Node.js Linting + - name: Install linting tools + run: npm install -g prettier eslint dockerfilelint + + - name: Format check with Prettier (using centralized config) + run: | + # Use centralized prettier config if available + if [ -f "../Pyrrha-Development-Tools/configs/.prettierrc.js" ]; then + npx prettier --config ../Pyrrha-Development-Tools/configs/.prettierrc.js --check "**/*.{js,json,md}" + else + npx prettier --check "**/*.{js,json,md}" + fi + + - name: Lint with ESLint (if configured) + run: | + if [ -f .eslintrc.* ] || [ -f eslint.config.* ]; then + npx eslint . || echo "ESLint issues found (non-blocking)" + else + echo "No ESLint configuration found, skipping" + fi + + - name: Run tests (if available) + run: | + if [ -f package.json ] && npm run test --if-present; then + npm test + else + echo "No tests configured, skipping" + fi + + # Dockerfile Linting + - name: Dockerfile linting + run: | + if ls Dockerfile* 1> /dev/null 2>&1; then + dockerfilelint Dockerfile* + else + echo "No Dockerfiles found, skipping" + fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a0bcb75..5ec44f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ # Contributing When contributing a major change to this repository, please first discuss the change you wish to make via an [issue](contributing/ISSUES.md) or via -[Slack in the #prometeo channel](https://callforcode.org/slack). Minor issues can simply be addressed by sending by a pull request. +[Slack in the #prometeo-pyrrha channel](https://callforcode.org/slack). Minor issues can simply be addressed by sending by a pull request. All [pull requests](contributing/PULL-REQUESTS.md) will require you to ensure the change is certified via the [Developer Certificate of Origin (DCO)](https://github.com/apps/dco/). The DCO is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project. @@ -69,7 +69,7 @@ further defined and clarified by project maintainers. ### Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team on [Slack in the #prometeo channel](https://callforcode.org/slack). +reported by contacting the project team on [Slack in the #prometeo-pyrrha channel](https://callforcode.org/slack). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident.Further details of specific enforcement policies may be posted separately.