首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Github验证.editorconfig文件

使用Github验证.editorconfig文件
EN

Stack Overflow用户
提问于 2021-06-06 19:35:25
回答 1查看 736关注 0票数 3

我想要确保我的Github中的任何拉请求都遵循.editorconfig (ASp.NET Core 5 C#项目)中定义的规则。我发现https://github.com/github/super-linter可以使用

我在工作流程中添加了下面的linter.yml文件,

代码语言:javascript
复制
---
###########################
###########################
## 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:
    branches-ignore: [main]
    # Remove the line above to run when pushing to main
    pull_request:
    branches: [main]

###############
# Set the Job #
###############
jobs:
    build:
    # Name the Job
    name: Lint Code Base
    # Set the agent to run on
    runs-on: ubuntu-latest

    ##################
    # Load all steps #
    ##################
    steps:
        ##########################
        # Checkout the code base #
        ##########################
        - name: Checkout Code
        uses: actions/checkout@v2
        with:
            # Full git history is needed to get a proper list of changed files within `super-linter`
            fetch-depth: 0

        ################################
        # Run Linter against codebase #
        ################################
        - name: Lint Code Base
        uses: github/super-linter@v4
        env:
            VALIDATE_ALL_CODEBASE: false
            DEFAULT_BRANCH: main
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

它是成功的,但我不认为它是在验证.editorconfig存储库根目录中的规则?我是不是遗漏了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-06 19:45:52

检查超级Linter中的EDITORCONFIG_FILE_NAME环境变量文件的默认值是.ecrc

因此,如果文件名为.editorconfig,则必须将其添加到操作参数列表中,如下所示:

代码语言:javascript
复制
- name: Lint Code Base
  uses: github/super-linter@v4
  env:
    VALIDATE_ALL_CODEBASE: false
    DEFAULT_BRANCH: main
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    EDITORCONFIG_FILE_NAME: .editorconfig

识别这个文件,超级链接操作将使用编辑配置检查器存储库来检查它。

编辑:基于注释的,超级链接器使用的dotnet-format也自动使用.editorconf文件。如果您想使用此链接检查它,则不需要设置EDITORCONFIG_FILE_NAME.只,设置VALIDATE_CSHARP: true

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67863002

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档