Using CodeTidy in my GitHub automated workflow for linting ObjsectScript code
I installed and configure CodeTidy in my local development environment, without InterSystems source-control (git-source-control) and only git for source control.
I would like to use only CodeTidy to stablish an automated Linting and Code Style Validation for InterSystems ObjectScript code triggered by GitHub Actions.
Could you shed some light on how to accomplish that?
Comments
To set up an automated linting and code style validation for InterSystems ObjectScript code using CodeTidy and GitHub Actions:
Install the CodeTidy Package:
- Ensure that you have ObjectScript Package Manager (ZPM) installed.
- Use the command:
This will install the CodeTidy package required for linting ObjectScript code [1].zpm "install isc.codetidy"
Configure GitHub Actions Workflow:
- Create a GitHub Actions workflow file in your repository. For example, create a file
.github/workflows/objectscript-linting.yml. - Define your GitHub Action to include steps where CodeTidy is executed during your CI pipeline.
- Example workflow:
Customize this template based on your CodeTidy usage and specific requirements. Integrate any file exclusions or specific rules for your linting process [1][2].name: ObjectScript Lint on: push: branches: - main pull_request: jobs: lint: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Install dependencies (ZPM if needed) run: | # Install ObjectScript Package Manager (if not pre-installed) zpm "install isc.codetidy" - name: Run CodeTidy for linting run: | # Add commands here to invoke CodeTidy linting # as per its documentation
- Create a GitHub Actions workflow file in your repository. For example, create a file
Refer to the CodeTidy Documentation for specific commands and configurations related to linting operations [1].
Sources:
I think it's worth pinging CodeTidy's author @Timothy Leavitt
Oops - I was out on leave, just seeing this now. Filed a GitHub issue to support/document such a use case: https://github.com/intersystems/isc-codetidy/issues/66
Currently, the expectation is that isc.codetidy is configured as a server-side extension so it automatically applies on e.g. isfs-mode editing from VSCode, or any use of Studio (if you still must). I *think* the edits will also work for client-side editing and be reflected automatically, similar to storage definition changes, but that isn't part of the workflow it's intended for.
On a side note, have you tried ObjectScript Quality for the same linting purpose? It is very naturally connected to GitHub Actions - you can add this file to any open-source GitHub repository with objectscript to see it in action, with examples.