Skip to content

Commit

Permalink
Draft: Playing with local linting
Browse files Browse the repository at this point in the history
  • Loading branch information
cfkoehler committed Oct 5, 2023
1 parent 01ad754 commit dd49957
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,3 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# setting this to false means that only changed files will be scanned in each commit
VALIDATE_ALL_CODEBASE: ${{ github.event_name != 'pull_request' }}
# Enable Linters to run
VALIDATE_GITHUB_ACTIONS: true
# VALIDATE_GOOGLE_JAVA_FORMAT: true
JAVA_FILE_NAME: ../../contrib/checkstyle.xml
VALIDATE_DOCKERFILE_HADOLINT: true
DOCKERFILE_HADOLINT_FILE_NAME: ../../contrib/docker/.hadolint.yaml
# VALIDATE_MARKDOWN: true
VALIDATE_XML: true
VALIDATE_YAML: true
FILTER_REGEX_EXCLUDE: .*contrib/helm.*
GITHUB_COMMENT_REPORTER: false
34 changes: 34 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Configuration file for MegaLinter
# See all available variables at https://megalinter.io/configuration/ and in linters documentation

APPLY_FIXES: all
# ENABLE: # If you use ENABLE variable, all other languages/formats/tooling formats will be disabled by default
# ENABLE_LINTERS: # If you use ENABLE_LINTERS variable, all other linters will be disabled by default
ENABLE:
- COPYPASTE
- SPELL
- ACTION
- DOCKERFILE
- XML
- YAML
ENABLE_LINTERS:
- JSON_PRETTIER
- REPOSITORY_GITLEAKS
- DOCKERFILE_HADOLINT
- XML_XMLLINT
- YAML_PRETTIER
- YAML_YAMLLINT
- SPELL_CSPELL
- ACTION_ACTIONLINT
- KUBERNETES_HELM
PRINT_ALL_FILES: false
DOCKERFILE_HADOLINT_FILE_NAME: ../../contrib/docker/.hadolint.yaml
FILTER_REGEX_EXCLUDE: .*contrib/helm.*
MARKDOWN_MARKDOWN_LINK_CHECK_DISABLE_ERRORS: true
SHOW_ELAPSED_TIME: true
FLAVOR_SUGGESTIONS: false
EMAIL_REPORTER: false
FILEIO_REPORTER: false
JSON_REPORTER: true
GITHUB_STATUS_REPORTER: false
GITHUB_COMMENT_REPORTER: false
10 changes: 10 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,16 @@ additional things to consider when developing:
* If you fix a bug, add a test.
* If you answer a question, add some documentation.

### Local Mega Linter validation and auto fix
The project leverages [MegaLinter](https://github.com/marketplace/actions/megalinter) as a GitHub action to run across
changed files in PR's and the entire codebase on merge. To run the same linting rule set local following the following steps.
Instructions are derived from [MegaLinter Runner Documentation](https://megalinter.io/latest/mega-linter-runner/)

1) Install [Node Package Manager (NPM)](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
2) Install mega-linter-runner for current users `npm install mega-linter-runner --save-dev`
3) Run MegaLinter from project root using project configuration `mega-linter-runner .mega-linter.yml .`
* To have MegaLinter attempt to fix errors add the `--fix` option to the command: `mega-linter-runner .mega-linter.yml --fix .`

## Helpful Commands

### Cleaning
Expand Down

0 comments on commit dd49957

Please sign in to comment.