Super-linter: Super linter does not respect .ruby-lint.yml

Created on 22 Jun 2020  路  8Comments  路  Source: github/super-linter

Describe the bug
I followed this doc creating .github/linters/.ruby-lint.yml with the following content but Super linter is still checking the excluded directories

AllCops:
  EnabledByDefault: true
  Exclude:
    - 'bin/**/*'
    - 'config/**/*'
    - 'config.ru'
    - 'db/**/*'
    - 'node_modules/**/*'
    - 'spec/rails_helper.rb'
    - 'spec/spec_helper.rb'
    - 'tmp/**/*'

My linter.yml

name: Lint Code Base

on:
  push:
    branches: [ master, develop ]
  pull_request:
    branches: [ master, develop ]

jobs:
  build:
    name: Lint Code Base
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Code
        uses: actions/checkout@v2

      - name: Lint Code Base
        uses: docker://github/super-linter:v2.1.1
        env:
          VALIDATE_ALL_CODEBASE: false
          VALIDATE_YAML: true
          VALIDATE_JSON: true
          VALIDATE_MD: true
          VALIDATE_BASH: true
          VALIDATE_RUBY: true
          VALIDATE_JAVASCRIPT_ES: false
          VALIDATE_DOCKER: true
          VALIDATE_CSS: true
          VALIDATE_ENV: true

Expected behavior
Super linter should skip checking the excluded directories.

Screenshots
Screen Shot 2020-06-22 at 08 43 36

Additional context
I ran rubocop -c .github/linters/.ruby-lint.yml on my local and it's fine, no offenses detected.

bug

All 8 comments

I think this is because the script logics, runs rubocop against every single file? not sure what would be the way to fix this 馃

I'm having the same issue on python. I've added a new exclusion to my own .python-lint file. The output states the local config file is being loaded - however the pylint issue is still not ignored.

I'm having the same issue with a dockerfilelintrc file being ignored (and again isn't ignored locally)

I've come up with a hybrid solution as a workaround:

  • Install my own rubocop to lint Ruby
  • Use super linter to lint other languages
name: Lint Code Base

on:
  push:
    branches: [ master, develop ]
  pull_request:
    branches: [ master, develop ]

jobs:
  build:
    name: Lint Code Base
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Code
        uses: actions/checkout@v2

      - name: Set up Ruby
        uses: ruby/setup-ruby@v1

      - name: Lint Ruby
        run: |
          gem install rubocop -v '~> 0.86.0'
          rubocop -c .github/linters/.ruby-lint.yml

      - name: Lint Other Languages
        uses: docker://github/super-linter:v2.2.0
        env:
          VALIDATE_YAML: true
          VALIDATE_JSON: true
          VALIDATE_MD: true
          VALIDATE_BASH: true
          VALIDATE_JAVASCRIPT_ES: false
          VALIDATE_DOCKER: true
          VALIDATE_CSS: true
          VALIDATE_ENV: true

I'm having the same issue on python. I've added a new exclusion to my own .python-lint file. The output states the local config file is being loaded - however the pylint issue is still not ignored.

FYI if anyone peaks in here and sees that. I fixed this with #301 - maybe other linters may have other similar issues?

I'm having the same issue when running locally (RUN_LOCAL=true) with a golangci-lint config added to .github/linters/.golangci-lint.yml in my project.

docker run -e RUN_LOCAL=true -e VALIDATE_GO=true -e ACTIONS_RUNNER_DEBUG=true -v $(pwd):/tmp/lint github/super-linter

I'm not able to use GH actions so I'm unsure if this is the same issue but it appears to be similar at least. These are my findings:

The logs inform me that: User provided file:[.golangci.yml], setting rules file... which is coming from this line
Then, the $LANGUAGE_LINTER_RULES var is declared on this line
However, this var isn't used where I'd expect it (here)
LintCodebase "GO" "golangci-lint" "golangci-lint run -c $GO_LINTER_RULES" ".*\.\(go\)\$" "${FILE_ARRAY_GO[@]}"
The GO_LINTER_RULES var is defined here which is using the default rules location (/action/lib/.automation).

I can't see where this is getting overwritten if a custom config has been supplied. My thinking is that when the LintCodebase function is called, the LANGUAGE_LINTER_RULES var should be used, eg

LintCodebase "GO" "golangci-lint" "golangci-lint run -c $LANGUAGE_LINTER_RULES" ".*\.\(go\)\$" "${FILE_ARRAY_GO[@]}"

Edit: I think I see my mistake, LANGUAGE_LINTER_RULES is evaluating to (in my case) GO_LINTER_RULES so it would appear that the var _is_ getting set correctly. So back to square one :(

With the linter pulling the files from the local location and not from a designed location, this should work as expected now...

@admiralAwkbar I just tested this again with v.3.3.0 and I'm afraid this is still an issue, AllCops/Exclude is not being honoured.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

patrick-compass picture patrick-compass  路  4Comments

dshevtsov picture dshevtsov  路  3Comments

IlanCosman picture IlanCosman  路  4Comments

DawidJanczak picture DawidJanczak  路  5Comments

krtschmr picture krtschmr  路  4Comments