Skip to content

onpush-census

GitHub stars sarif GitHub release (latest SemVer) GitHub last commit GitHub commit activity GitHub contributors

Community plugin: Plugins are maintained by their community authors, not by the MegaLinter team. Using a plugin means trusting its author. This plugin is maintained by Müslim Yılmaz: report its problems on its repository, not to MegaLinter.

Angular OnPush readiness check, one verdict per component with the line of code behind it, from the OnPush readiness census (ANGULAR_ONPUSH_CENSUS)

⚠️ Required items are missing in this plugin (native mode): see MegaLinter checks.

onpush-census reads every Angular component of the workspace and says whether it is ready for 'ChangeDetectionStrategy.OnPush', the default since Angular 22. Each component gets one verdict ('ready', 'probable', 'blocked' or 'unknown') and every verdict other than ready comes with the lines of code behind it. It is a static reading with the TypeScript compiler API and Angular's template parser: nothing in the workspace is executed.

The run fails on 'blocked' components; set 'ANGULAR_ONPUSH_CENSUS_ARGUMENTS' to '--fail-on blocked,probable' to tighten the gate. Test files are skipped unless '--include-tests' is added, and MegaLinter 10 and later also forward the directories they exclude ('EXCLUDED_DIRECTORIES') through '--exclude'. The rules and their validation are described in the report linked as web site.

onpush-census documentation

onpush-census - GitHub

Configuration in MegaLinter

Variable Description Default value
ANGULAR_ONPUSH_CENSUS_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
ANGULAR_ONPUSH_CENSUS_COMMAND_REMOVE_ARGUMENTS User custom arguments to remove from command line before calling the linter
Ex: -s --foo "bar"
ANGULAR_ONPUSH_CENSUS_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src\|lib)
⚠️ Not available with ANGULAR_ONPUSH_CENSUS_CLI_LINT_MODE = project
Exclude no file
ANGULAR_ONPUSH_CENSUS_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test\|examples)
⚠️ Not available with ANGULAR_ONPUSH_CENSUS_CLI_LINT_MODE = project
Exclude no file
ANGULAR_ONPUSH_CENSUS_CLI_LINT_MODE Override default CLI lint mode
- project: Call the linter from the root of the project
project
ANGULAR_ONPUSH_CENSUS_FORWARD_EXCLUDED_DIRECTORIES In project CLI lint mode, forward excluded directories (EXCLUDED_DIRECTORIES + ADDITIONAL_EXCLUDED_DIRECTORIES, and .gitignored directories when IGNORE_GITIGNORED_FILES is true) to the linter through its native exclusion arguments or generated ignore/config files true
ANGULAR_ONPUSH_CENSUS_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".ts"]
ANGULAR_ONPUSH_CENSUS_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
Include every file
ANGULAR_ONPUSH_CENSUS_PRE_COMMANDS List of bash commands to run before the linter None
ANGULAR_ONPUSH_CENSUS_POST_COMMANDS List of bash commands to run after the linter None
ANGULAR_ONPUSH_CENSUS_UNSECURED_ENV_VARIABLES List of env variables explicitly not filtered before calling ANGULAR_ONPUSH_CENSUS and its pre/post commands None
ANGULAR_ONPUSH_CENSUS_DISABLE_ERRORS Run linter but consider errors as warnings false
ANGULAR_ONPUSH_CENSUS_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0
ANGULAR_ONPUSH_CENSUS_TIMEOUT_SECONDS Maximum duration in seconds of the linter run, after which the linter process and its child processes are killed and reported as an error (exit code 124). Overrides LINTER_TIMEOUT_SECONDS. 0 disables the timeout 300
ANGULAR_ONPUSH_CENSUS_CLI_EXECUTABLE Override CLI executable ['onpush-census']

Use this plugin

Add the descriptor URL of the plugin to PLUGINS in .mega-linter.yml. MegaLinter installs the plugin when it starts, whatever the flavor:

PLUGINS:
  - https://raw.githubusercontent.com/MuslumYilmaz/onpush-census/main/mega-linter-plugin-onpush-census/onpush-census.megalinter-descriptor.yml

Behind the scenes

How are identified applicable files

  • Activated only if one of these files is found: angular.json, nx.json
  • File extensions: .ts

How the linting is performed

onpush-census is called once on the whole project directory (project CLI lint mode)

  • filtering can not be done using MegaLinter configuration variables,it must be done using onpush-census configuration or ignore file (if existing)
  • VALIDATE_ALL_CODEBASE: false doesn't make onpush-census analyze only updated files

Example calls

onpush-census
onpush-census --fail-on blocked,probable
onpush-census --format sarif --out onpush-census.sarif

Installation in Docker

MegaLinter runs these commands when it loads the plugin (only RUN instructions):

RUN npm install -g --ignore-scripts --no-audit --no-fund onpush-census@0.2.0

Installation without Docker (native mode)

Native mode does not run plugins yet: this section shows what the plugin declares for native mode.

Not available: see the MegaLinter checks of the plugin.

MegaLinter checks

These results last changed on 2026-11-29, and MegaLinter checks the plugins every day. The checks only look at the descriptor of the plugin: they do not review the plugin, nor the tool it runs.

Check Result
Descriptor ⚠️ Incomplete
Native mode ❌ Not supported
SARIF output ✅
Native lock ⚠️ No lock shipped by the plugin author

Required

Missing required items:

  • native_install declared and valid for the 5 native platforms (ANGULAR_ONPUSH_CENSUS): Native mode (MegaLinter without Docker) can not install the linter. Declare native_install, listing each of linux/amd64, linux/arm64, darwin/amd64, darwin/arm64 and windows/amd64 in platforms or in unsupported (with a reason)

Missing recommended items:

  • Native lock shipped next to the descriptor (<name>.megalinter-native-lock.json), for verified native installs
  • Inline disable documentation URL (linter_rules_inline_disable_url) (ANGULAR_ONPUSH_CENSUS)
  • Icon (linter_icon_png_url) (ANGULAR_ONPUSH_CENSUS)
  • IDE extensions (ide) (ANGULAR_ONPUSH_CENSUS)
  • Default configuration file (config_file_name) (ANGULAR_ONPUSH_CENSUS)
  • Test fixtures (test_folder) (ANGULAR_ONPUSH_CENSUS)

Plugin authors

The requirements and how to fix them are described in Create your own plugin.

Comments