> 文章列表 > GitHub Action中的github/super-linter作用是什么?

GitHub Action中的github/super-linter作用是什么?

GitHub Action中的github/super-linter作用是什么?

What?

github/super-linter 是一个开源工具包,其中包含多个静态分析工具,用于对代码进行静态分析以查找潜在的错误、优化代码性能和提高代码可读性等。github/super-linter@v3.17.0 是一个版本号,表示这个版本使用了哪个静态分析工具。

具体来说,github/super-linter 包中包含的静态分析工具包括:

  • cyclomatic_complexity:用于检查代码的复杂性,帮助开发人员识别复杂的代码结构。
  • method_count:用于检查代码中方法的数量,帮助开发人员识别代码是否过于冗长。
  • string_mutations:用于检查代码中的字符串操作,帮助开发人员识别字符串操作是否可行,以及避免不必要的字符串操作。
  • TODO:用于检查代码中的 TODO 注释,帮助开发人员识别 TODO 任务。
  • tests_count:用于检查代码中的测试数量,帮助开发人员识别代码是否过于缺少测试。

github/super-linter 包中的静态分析工具使用了一些流行的开源工具,例如 cyclomatic_complexity 使用的是 coveralls.io/cyclomatic_complexity method_count 使用的是 coveralls.io/methods string_mutations 使用的是 coveralls.io/string_mutations TODO 使用的是 coveralls.io/todo tests_count 使用的是 coveralls.io/test_number

总之,github/super-linter 包中的静态分析工具可以帮助开发人员识别代码中的潜在错误和优化代码性能,提高代码质量和可读性。

how?

---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
##############################
# Start the job on all push #
#############################
on:push:pull_request:branches: [master]###############
# Set the Job #
###############
jobs:build:# Name the Jobname: Lint Code Base# Set the agent to run onruns-on: ubuntu-latest################### Load all steps ###################steps:########################### Checkout the code base ###########################- name: Checkout Codeuses: actions/checkout@v2with:# Full git history is needed to get a proper list of changed files within `super-linter`fetch-depth: 0- name: Setup script executablerun: |chmod +x *.sh################################# Run Linter against code base #################################- name: Lint Code Baseuses: github/super-linter@v3.17.0env:VALIDATE_ALL_CODEBASE: falseERROR_ON_MISSING_EXEC_BIT: trueDEFAULT_BRANCH: masterGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}