{"id":29150191,"url":"https://github.com/humanmade/linter-bot","last_synced_at":"2025-06-30T23:09:47.407Z","repository":{"id":47050576,"uuid":"104753487","full_name":"humanmade/linter-bot","owner":"humanmade","description":"Automatically run the HM Coding Standards on any repository.","archived":false,"fork":false,"pushed_at":"2024-10-28T12:21:42.000Z","size":334,"stargazers_count":16,"open_issues_count":35,"forks_count":3,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-06-30T16:14:53.031Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/apps/hm-linter","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/humanmade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-25T13:27:26.000Z","updated_at":"2025-06-11T10:50:45.000Z","dependencies_parsed_at":"2024-10-28T13:44:12.457Z","dependency_job_id":"319715be-e09b-45bc-b2ee-b2a636d426cb","html_url":"https://github.com/humanmade/linter-bot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/humanmade/linter-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Flinter-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Flinter-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Flinter-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Flinter-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/humanmade","download_url":"https://codeload.github.com/humanmade/linter-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Flinter-bot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262864258,"owners_count":23376461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-30T23:09:46.225Z","updated_at":"2025-06-30T23:09:47.370Z","avatar_url":"https://github.com/humanmade.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ctable width=\"100%\"\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd align=\"left\" width=\"70%\"\u003e\n\t\t\t\u003cstrong\u003ehm-linter bot\u003c/strong\u003e\u003cbr /\u003e\n\t\t\tAutomatically run the HM Coding Standards on any repository.\n\t\t\u003c/td\u003e\n\t\t\u003ctd align=\"center\" width=\"30%\"\u003e\n\t\t\t🤖\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\n\t\t\tA \u003cstrong\u003e\u003ca href=\"https://hmn.md/\"\u003eHuman Made\u003c/a\u003e\u003c/strong\u003e project. Maintained by @rmccue.\n\t\t\u003c/td\u003e\n\t\t\u003ctd align=\"center\" width=\"30%\"\u003e\n\t\t\t\u003cimg src=\"https://hmn.md/content/themes/hmnmd/assets/images/hm-logo.svg\" width=\"100\" /\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\nAutomatically run the [HM Coding standards](https://github.com/humanmade/coding-standards) on any repository.\n\n\u003cimg src=\"https://hmn.md/uploads/2018/02/Screenshot-2018-02-09-16.37.17.png\" width=\"774\" /\u003e\n\n\n## Installation\n\nTo enable on any repository on GitHub, simply [head to the app page](https://github.com/apps/hm-linter) and Install/Configure. You'll get an initial report as a new issue if you have any existing linting errors in your codebase.\n\nEvery repository is different, and you might want to customise the rules that the linter runs. Good news: you can do just that. hm-linter detects custom configuration files automatically, just create a `phpcs.ruleset.xml` file for phpcs, [`eslintrc.*`](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) file for ESLint, or [`.stylelintrc`](https://stylelint.io/user-guide/configure) for stylelint.\n\nSee the [HM Coding standards](https://github.com/humanmade/coding-standards) documentation for how to configure specific rules.\n\n**Note:** Custom configuration can only use rules/standards which hm-linter has available. This includes the HM Coding Standards as well as any dependencies of it (such as the WP Coding Standards).\n\n\n## Configuration\n\nBy default, hmlinter will use the latest version of the Human Made coding standards. You can configure it to use an older or fixed version by creating a `.github/hmlinter.yml` file. This file should look like:\n\n```yaml\n# GLOBAL SETTINGS\n\n# By default, the version is set to \"latest\". This can be set to any version\n# from 0.4.2 and above, but you MUST include the full version number.\n# If you wish to increase the security releases automatically set the \n# version to be 'X.Y', otherwise it will be 'X.Y.Z'.\nversion: latest\n\n# PER-STANDARD SETTINGS\nphpcs:\n    # Set to false to disable phpcs\n    enabled: true\n\n    # Set to \"inherit\" to use the global version, \"latest\" for the latest\n    # version, or a specific full version number.\n    version: inherit\n\neslint:\n    enabled: true\n    version: inherit\n\nstylelint:\n    enabled: true\n    version: inherit\n```\n\nVersions **MUST** be specified in full format (i.e. `0.5.0`). `latest` is available as a convenient shorthand for the latest published version, but note that this will be updated and may cause your code to fail future checks.\n\n\n## Development\n\nhm-linter is a GitHub bot built on top of the [Probot framework](https://probot.github.io/). It runs on Lambda, which runs Node 12.x.\n\nTo get started on development of hm-linter:\n\n1. Clone this repository\n2. `npm install` or `yarn install` the dependencies\n\n\n## Testing\n\n### Live Testing\n\nThe easiest and best way to test hm-linter is to run the bot in development mode. This will run the bot locally, and uses a proxy to forward all webhook events from GitHub.\n\n`yarn start` will run a development copy of the linter bot inside a Lambda-like Docker container.\n\nTo set this up:\n\n1. Download \"hm-linter-development Private Key\" from the team 1Password Documents.\n2. Save this file into the linter-bot directory as `development.private-key.pem`\n3. Download \"hm-linter-development .env\" from the team 1Password Documents.\n4. Save this file into the linter-bot directory as `.env`\n5. Run `yarn start`\n\nThe development mode is set up only on the [linter-bot-test](https://github.com/humanmade/linter-bot-test) repository. You can add it to other repositories on the `humanmade` organisation, but **please only do this temporarily**. You should remove any repositories you add as soon as you're finished testing.\n\nWebhook events for the development bot are sent to Smee.io, which [logs all events](https://smee.io/rpFoxbfDjkw5Srji). If you visit this page, you can also replay events; you should use this while developing/testing rather than repeatedly opening new PRs.\n\nA typical development process looks like this:\n\n1. Generate the test event you want or find one that already exists\n2. Write the first version of your code to handle it\n3. `yarn start`\n4. [Replay the event on Smee](https://smee.io/rpFoxbfDjkw5Srji)\n5. Check that your code did what you expect\n6. If your code worked, you're done 🙌\n7. If your code didn't work, kill the bot\n8. Repeat steps 2-7 until your code works.\n\n\n### Replicating production issues\n\nThe first step to replicating production issues is to understand the request being sent to hm-linter. Note that when running against these events, you are **testing against the live GitHub API**, so be careful.\n\nAccess the CloudWatch Logs for hm-linter (ask the Cloud team for access) and find the request you received. If you have the AWS CLI installed, you can do this by running the `scripts/get-logs.js` command.\n\nEach check status page lists the various request IDs. The **Lambda ID** is the ID you need for pulling down the relevant logs and data.\n\nThis will write the logs to `{id}.log`, and save the raw data to `{id}.json`.\n\n```sh\n# For request deadbeef-badd-ecaf-dead-beefbaddecaf:\nnode scripts/get-logs.js deadbeef-badd-ecaf-dead-beefbaddecaf\n\n# By default, this will only check the last 48 hours; to override, set HOUR_LIMIT:\nHOUR_LIMIT=192 node scripts/get-logs.js deadbeef-badd-ecaf-dead-beefbaddecaf\n```\n\n```\nQuerying for deadbeef-badd-ecaf-dead-beefbaddecaf\nWaiting for results…\nLog saved to:           deadbeef-badd-ecaf-dead-beefbaddecaf.log\nRaw data saved to:      deadbeef-badd-ecaf-dead-beefbaddecaf.json\n```\n\nYou can then run the handler against a simulated Lambda environment locally (using Docker):\n\n```\n# Run build at least once:\nnpm run build\n\n# Run the handler.\nnpm run test \u003c deadbeef-badd-ecaf-dead-beefbaddecaf.json\n```\n\n**Note:** The format of the JSON data passed to `test` **must** be in API Gateway format (i.e. from the get-logs script). If you get an `Cannot read property 'x-github-event' of undefined` error, you're passing a GitHub event instead (i.e. from Smee).\n\n\n### Deployment\n\nhm-linter is deployed on a Lambda instance. Deployment is handled via npm scripts, which you run via `npm run \u003cscript\u003e` or `yarn run \u003cscript\u003e`.\n\nTo deploy hm-linter, you need the following things:\n\n* [AWS CLI](https://aws.amazon.com/cli/)\n* Docker - used to compile and test things in a Lambda-like environment\n* `private-key.pem` - Ask @rmccue or @joehoyle for this file.\n\nDeployment can be done in one step by running the `deploy` script, but you should generally test builds first. The following scripts will help with that:\n\n* `build` - Builds JS, downloads PHP binary, and installs Composer/npm dependencies.\n* `deploy:package` - Builds the directory into a zip. Use this to verify the ZIP before pushing.\n* `deploy:push` - Push the built zip to Lambda. Use this if `deploy` fails due to some sort of network error.\n\n\n## Advanced Configuration\n\nDeployment settings can be changed using environment variables. In addition to the app settings noted above, the following can also be set:\n\n* `BOT_NAME` - Name of the bot (default `hmlinter`)\n* `CONFIG_FILE` - Name of the configuration file (default `hmlinter.yml`)\n* `STANDARD_URL` - URL for the standards directory (default `https://make.hmn.md/hmlinter/standards`)\n* `ENABLED_LINTERS` - Comma-separated string of enabled linter types (default `eslint,phpcs`)\n* `FORCE_STANDARD_PHPCS` - Standard to use for checking, overrides any user standard (default disabled)\n* `DEFAULT_STANDARD_PHPCS` - Default standard to check against for phpcs (default `vendor/humanmade/coding-standards`)\n* `DEFAULT_STANDARD_ESLINT` - Default standard to check against for ESLint (default `eslint-config-humanmade`)\n* `LAMBDA_FUNCTION` - Lambda function name for the `deploy` command (default `hm-linter`)\n* `LAMBDA_REGION` - Lambda function region for the `deploy` command (default `us-east-1`)\n* `FORCE_NEUTRAL_STATUS` - Mark failed checks as \"neutral\", which shows the check but does not mark it as failed (default disabled)\n* `CHECK_ANNOTATION_ONLY_RELATED` - Post annotation in check for change which are related to current change instead of all (default disabled)\n* `TEMP_DIR` - Change default temp directory to custom if we want to use EFS. (default `/tmp`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2Flinter-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhumanmade%2Flinter-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2Flinter-bot/lists"}