Skip to content

--format doesn't respect custom Indentation #31

Closed
@b1zzu

Description

Hi,
this is may groovy file:

pipeline {
  agent none
  options {
    timestamps()
    ansiColor('xterm')
  }
  stages {
    stage('stuff') {
      steps {
        sh 'echo "stuff"'
      }
    }
  }
}

and this is my .groovylintrc.json configuration:

{
  "extends": "recommended-jenkinsfile",
  "rules": {
    "Indentation": {
      "spacesPerIndentLevel": 2
    }
  }
}

as you can see the groovy file is correct and if I analyze the file it doesn't report any error

➜ npm-groovy-lint         

npm-groovy-lint results in  linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity  │ Total found │
├─────────┼───────────┼─────────────┤
│    0    │  'Error'  │      0      │
│    1    │ 'Warning' │      0      │
│    2    │  'Info'   │      0      │
└─────────┴───────────┴─────────────┘

but if I try to automatically format it will indent everything with four spaces instant of two

➜  npm-groovy-lint --format
/home/b1zzu/Projects/gitlab.cee.redhat.com/integreatly-qe/ci-cd/stuff/test.groovy


npm-groovy-lint results in  linted files:
┌─────────┬───────────┬─────────────┬─────────────┬─────────────────┐
│ (index) │ Severity  │ Total found │ Total fixed │ Total remaining │
├─────────┼───────────┼─────────────┼─────────────┼─────────────────┤
│    0    │  'Error'  │      0      │      0      │        0        │
│    1    │ 'Warning' │      0      │      0      │        0        │
│    2    │  'Info'   │      8      │      8      │        0        │
└─────────┴───────────┴─────────────┴─────────────┴─────────────────┘

and if I analyze again the modified it will show indentation problems:

➜  npm-groovy-lint         
/home/b1zzu/Projects/gitlab.cee.redhat.com/integreatly-qe/ci-cd/stuff/test.groovy
  2     info     The statement on line 2 in class None is at the incorrect indent level: Expected column 3 but was 5  Indentation             
  3     info     The statement on line 3 in class None is at the incorrect indent level: Expected column 3 but was 5  Indentation             
  4     info     The statement on line 4 in class None is at the incorrect indent level: Expected column 5 but was 9  Indentation             
  5     info     The statement on line 5 in class None is at the incorrect indent level: Expected column 5 but was 9  Indentation             
  7     info     The statement on line 7 in class None is at the incorrect indent level: Expected column 3 but was 5  Indentation             
  8     info     The statement on line 8 in class None is at the incorrect indent level: Expected column 5 but was 9  Indentation             
  9     info     The statement on line 9 in class None is at the incorrect indent level: Expected column 7 but was 13  Indentation             
  10    info     The statement on line 10 in class None is at the incorrect indent level: Expected column 9 but was 17  Indentation             


npm-groovy-lint results in  linted files:
┌─────────┬───────────┬─────────────┐
│ (index) │ Severity  │ Total found │
├─────────┼───────────┼─────────────┤
│    0    │  'Error'  │      0      │
│    1    │ 'Warning' │      0      │
│    2    │  'Info'   │      8      │
└─────────┴───────────┴─────────────┘

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions