# linter-report **Repository Path**: Prof1983/linter-report ## Basic Information - **Project Name**: linter-report - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-25 - **Last Updated**: 2025-03-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # linter-report Tool for linter reporting ## Getting Started ### Operating System Compatibility | OS | Status | |:--------|:----------------------------------------| | Windows | ✅ | | Linux | Only for developers. | ### Prerequisites - [Python3](https://www.python.org/) should be installed (v3.10 or more). - [DevEco Studio 5](https://developer.huawei.com/consumer/cn/download/) should be installed (v5.0.3 or more). ### Basic installation Download the Python executable zip archive (`linter_report.pyz`) from [releases page](https://gitee.com/Prof1983/linter-report/releases). Latest release [here](https://gitee.com/Prof1983/linter-report/releases/latest). > **_NOTE:_** > About executable Python zip archives see [zipapp module](https://docs.python.org/3/library/zipapp.html). ### Execute linter_report.pyz (on Windows) 1. Open your project in the DecEco Studio. 1. Open Terminal tool window (View menu item -> Tool Window -> Terminal, or press Alt-F12). 1. Run `python.exe linter_report.pyz` in your project directory. ```powershell PS> python.exe path\to\linter_report.pyz ``` 1. You get following CSV report files: - [CSV Summary](#csv-summary) (INTEROP.logXXXXXXXXXX.summary.csv). - Aggregated statistics of symbols by `Categories` and declaration in `App`/`SDK`/`Third party`. - [CSV SDK Top](#csv-sdk-top) (INTEROP.logXXXXXXXXXX.sdk_top_by_files.csv). - sorted count of symbols declared in `SDK`. - [CSV All Symbols](#csv-all-symbols) (INTEROP.logXXXXXXXXXX.csv). - All statistics by symbols. To view additional parameters, use the `--help` option: ```powershell PS> python.exe path\to\linter_report.pyz --help ``` Example for `lint` command: ```powershell PS> python.exe path\to\linter_report.pyz lint --help ``` ## Description of commands The `linter_report.pyz` has several commands. You can always see them using the `--help` option: ```powershell PS> python linter_report.pyz --help Usage: linter_report.pyz [OPTIONS] COMMAND [ARGS]... Options: --version Show the version and exit. -v, --verbose Logging level. -h, --help Show this message and exit. Commands: cli Interactive mode docs Show documentation extra Additional commands lint Execute linter in PROJECT_DIR directory. ``` ### Running without parameters If command is not set, then some command will be executed, depending on the conditions: - If `DEVECO_SDK_HOME` environment variable is set: ```powershell PS> python linter_report.pyz lint . ``` - else if `./tsconfig.json` exists: ```powershell PS> python linter_report.pyz pandalint . ``` - else: ```powershell python linter_report.pyz --help ``` ### `lint` command ```powershell PS> python linter_report.pyz lint --help Usage: linter_report.pyz lint [OPTIONS] [PROJECT_DIR] Execute linter in PROJECT_DIR directory. Options: --deveco-sdk-home PATH The path to the Deveco SDK. The default value is in DEVECO_SDK_HOME environment variable. -p, --panda Also execute @panda/sdk linter -m, --module TEXT Check only these modules. This is multiple option. -h, --help Show this message and exit. ``` It is main command. Executes the linter for the project in the `PROJECT_DIR` folder. It is best to run this tool in the DevEco terminal. This tool creates the following files: ```plain ╭─ CSV report files ──────────────────────────────╮ │ Interop: INTEROP.log0000.csv │ │ Summary: INTEROP.log0000.summary.csv │ │ SDK Counts: INTEROP.log0000.sdk_top_by_file.csv │ │ XLSX: INTEROP.log0000.xlsx │ ╰─────────────────────────────────────────────────╯ ``` See [Report Format Description]() for details #### `--panda` option With the `--panda` option, additionally executes the linter from the `@panda/sdk` package. In this case created more files: ```plain ╭─ CSV report files ──────────────────────────────╮ │ Interop: INTEROP.log0000.csv │ │ Panda: INTEROP.log0000.panda.csv │ │ Full Log: INTEROP.log0000.merged.csv │ │ Summary: INTEROP.log0000.summary.csv │ │ SDK Counts: INTEROP.log0000.sdk_top_by_file.csv │ │ XLSX: INTEROP.log0000.xlsx │ ╰─────────────────────────────────────────────────╯ ``` #### `-m`/`--module` option This option specifies the project module to be analyzed. The `--panda` option will be ignored. ### `cli` command ```powershell PS> python linter_report.pyz cli --help Usage: linter_report.pyz cli [OPTIONS] Interactive mode Options: --deveco_sdk_home PATH The path to the Deveco SDK. The default value is in DEVECO_SDK_HOME environment variable. -h, --help Show this message and exit. ``` It is best to run this tool in the DevEco terminal. This command executed tool in interactive mode. ### `extra` commands ```powershell PS> python linter_report.pyz extra --help Usage: extra [OPTIONS] COMMAND [ARGS]... Additional commands for executing built-in tools. Options: --help Show this message and exit. Commands: hvigorw Launcher for hvigorw with the embedded TypeScript. pandalint Executing @panda/sdk linter in ArkTS 2.0 mode and show result summary CSV_FILE: interop.log0000.csv file tslinter.js Launcher for tslinter.js from @panda/sdk. ``` Additional commands for executing built-in tools. ## Report Format Description ### CSV Summary #### Example | interop type | SDK | Third party | App | @network+grs | @hms-security+consent_grs_system | ... | ... | | ------ | --- | ------ | ---- | ------ | ------ | --- | --- | | Covariant overriding (21.4) | 0 | 6 | 0 | 0 | 0 | ... | ... | | TaskPool obj | 20 | 0 | 0 | 0 | 0 | ... | ... | | import op | 324 | 1216 | 1647 | 0 | 1 | ... | ... | | ... | ... | ... | ... | ... | ... | ... | ... | This table aggregates (sums) symbols by *Categories* and *Locations of declaration*. More detailed information with every symbol and related files you can find in the file [INTEROP.logXXXXXXXXXX.csv](#csv-all-symbols) ##### interop type Type of entity we count in these tables. We count interop entities (defined in SDK and .ts files), concurrency entities and ArkTS 2.0 specification breaks. - **Covariant overriding (21.4)** - Covariant overriding is prohibited because type-safety violations are prevented by compiler-generated compile-time errors - **TaskPool obj** - An access to an SDK object `taskPool` - **import op** - Import from SDK or .ts file [**Categories**](Categories.en.md) describes the more detailed information about 'interop type' values ##### SDK Count of entities declared in SDK files ##### Third party Count of entities declared in third parties files ##### App Count of entities declared in App files (not SDK, nor third party) ##### @third-party-name Count of entities declared in the specified third party ### CSV SDK Top Example | full name (namespace.classname.symbol) | declared in file | count | | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----- | | -.-.$r | d:/deveco/devecostudio/sdk/harmonyos-next-db3/openharmony/ets/build-tools/ets-loader/declarations/common.d.ts | 5596 | | -.-.length | d:/deveco/devecostudio/sdk/harmonyos-next-db3/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/lib.es5.d.ts | 1652 | | -.CommonMethod.width | d:/deveco/devecostudio/sdk/harmonyos-next-db3/openharmony/ets/build-tools/ets-loader/declarations/common.d.ts | 1220 | | ... | ... | ... | ##### full name (namespace.classname.symbol) The full name of a symbol. It consists out of `Namespace`.`ClassName`.`SymbolName`. If a namespace or a symbolname is not present it replaced with '-'. ##### declared in file The full path to the file where the symbol is declared. ### CSV All Symbols Example | interop type | sourceFile | line | character | symbol name | class Name | namespace name | declared in file | | ------------------------------ | ---------- | ---- | --------- | ----------- | ---------- | -------------- | ---------------- | | Primitive type override (21.9) | @hms-paf+ui-widget-base@14.16.7-315/oh_modules/@hms-paf/ui-widget-base/src/main/ets/common/PafGridSetting.d.ets | 33 | 5 | - | - | - | ... @hms-paf+ui-widget-base@14.16.7-315/oh_modules/@hms-paf/ui-widget-base/src/main/ets/common/pafgridsetting.d.ets | | import op | @hms-paf+ui-widget-base@14.16.7-315/oh_modules/@hms-paf/ui-widget-base/src/main/ets/common/PafUiWidget.d.ets | 3 | 10 | Configuration | Configuration | - | ... @ohos.app.ability.configuration.d.ts | | import op | @hms-paf+ui-widget-base@14.16.7-315/oh_modules/@hms-paf/ui-widget-base/src/main/ets/common/PafUiWidget.d.ets | 4 | 10 | Callback | Callback | - | ... @ohos.base.d.ts | ... | ... | ... | ... | ... | ... | ... | ... | ##### interop type Type of entity we count in these tables. We count interop entities (defined in SDK and .ts files), concurrency entities and ArkTS 2.0 specification breaks. The categories of entities are described in [Categories](Categories.en.md) ##### sourceFile The full path to the file where the symbol is used. ##### line The line number of the source file where the symbol is appeared ##### character The column number of the source file where the symbol is appeared ##### symbol name The name of the symbol ##### class Name The name of a class the symbol belongs ##### namespace name The namespace where the symbol (the class) is declared ##### declared in file The full path to the file where the symbol is declared. ## Advanced using TBD