iwarapter / sonar-puppet

SonarQube plugin for Puppet code.
Other
26 stars 10 forks source link

Merging issues on badly formated multi-line blocks #245

Closed zonArt closed 8 years ago

zonArt commented 8 years ago

In a resource definition if the whole block below is badly indented, sonar plugin raises one issue per line instead of only one for the whole block. Would be great if this could be merged as one single issue.

iwarapter commented 8 years ago

Is this the sort of thing you are seeing?

file { '/tmp/readme.txt':
  ensure => file,
   owner  => '0', # Noncompliant
    group  => '0', # Noncompliant
     mode   => '0644', # Noncompliant
}
zonArt commented 8 years ago

Not really no, more something like:

file { '/tmp/readme.txt':
   ensure => file, # Noncompliant (because of the three spaces instead of two)
   owner  => '0', # Noncompliant
   group  => '0', # Noncompliant
   mode   => '0644', # Noncompliant
}

All the other lines are well aligned with the first one however they're all wrong because of indentation. Not sure if I'm clear enough sorry

iwarapter commented 8 years ago

Is 3 indenting something your doing as standard or do you just have some non compliant code?

zonArt commented 8 years ago

No it was just a mistake and it's not a problem having an issue raised for it but it's probably not necessary to have 5 issues for the same block. Do you know what I mean ?

iwarapter commented 8 years ago

Yeah i understand, where your coming. The main concern I have is lets say we have a file with many statements on it, that could potentially all be poorly indented. Like the params on this class. I'd need to make sure the parent issue clearly states all issues on the block below, this could get quite messy.

Let me have a think and i'll see what i can come up with.

zonArt commented 8 years ago

I understand the concerns of having each line with it own issue and especially if some of them are correctly indented and some other aren't but we can maybe think about regrouping consecutive lines with the same issue under only one.

iwarapter commented 8 years ago

I like the idea of doing it with consecutive lines, so you would have something like:

The following x lines should start on column y.

Which in the example above would be issue raised on line 2 (first occurrence) and be for the following 4 lines.

zonArt commented 8 years ago

yes exactly

iwarapter commented 8 years ago

This will be in the next release.