woocommerce/tools/code-analyzer
Leif Singer d0a2b582fe
Consolidate eslint versions (#36700)
* pin eslint in .syncpackrc

run `pnpm run sync-dependencies` to ensure pinned version is used across projects, then run `pnpm install` to update `pnpm-lock.yaml`

* add changelog files

ran `pnpm run --no-bail --filter='[HEAD^1]' changelog add --significance=patch --type=dev --entry='Update eslint to 8.32.0 across the monorepo.'`

* re-run `pnpm install` to fix what broke while merging
2023-02-02 23:25:04 +13:00
..
src Add PR links to release post template output, and allow blog ID to be specified. (#36026) 2023-01-23 08:31:59 -06:00
.eslintignore CLI tool and GH workflow to highlight PR changes (#32063) 2022-05-17 13:47:17 +12:00
.eslintrc.js Fix and consolidate linting across the monorepo (#35012) 2022-10-12 15:05:01 +13:00
.gitignore CLI tool and GH workflow to highlight PR changes (#32063) 2022-05-17 13:47:17 +12:00
README.md Migrate uses of ::set-output in code-analyzer to setOutput. (#35895) 2022-12-12 19:41:00 +13:00
index.ts Extract the scanning functionality from code-analyzer, move common code into a separate package (#34600) 2022-09-11 09:55:53 +12:00
package.json Consolidate eslint versions (#36700) 2023-02-02 23:25:04 +13:00
tsconfig.json Extract the scanning functionality from code-analyzer, move common code into a separate package (#34600) 2022-09-11 09:55:53 +12:00

README.md

Code Analyzer

Description

code-analyzer is a CLI tool designed to analyze change information about plugins in the WooCommerce monorepo.

Commands

Currently there are just 2 commands:

  1. lint. Analyzer is used as a linter for PRs to check if hook/template/db changes were introduced. It produces output either directly on CI or via setting output variables in GH actions.

Here is an example analyzer command, run from this directory:

pnpm run analyzer -- lint "release/6.8" "6.8.0" -b release/6.7

In this command we compare the release/6.7 and release/6.8 branches to find differences, and we're looking for changes introduced since 6.8.0 (using the @since tag).

To find out more about the other arguments to the command you can run pnpm run analyzer -- --help

  1. major-minor. This simple CLI tool gives you the latest .0 major/minor released version of a plugin's mainfile based on Woo release conventions.

Here is an example major-minor command, run from this directory:

pnpm run analyzer major-minor -- "release/6.8" "plugins/woocommerce/woocommerce.php"

In this command we checkout the branch release/6.8 and check the version of the woocommerce.php mainfile located at the path passed. Note that at the time of writing the main file in this particular branch reports 6.8.1 so the output of this command is 6.8.0.

This command is particularly useful combined with the analyzer, allowing you to determine the last major/minor.0 version of a branch or ref before passing that as the version argument to analyzer.