JacobNinja / exercism-analysis

2 stars 2 forks source link

"inconsistent indentation" is greedy #1

Closed kytrinyx closed 10 years ago

kytrinyx commented 10 years ago

I've run a bunch of tests locally against the indentation analyzer, and I get a huge number of false positives for inconsistent indentation.

For example:

class Hamming 
    def self.compute (x,y)
        a = 0;
        min = [x.length,y.length].min
        for i in 0...min 
            if x[i]!=y[i]
                a += 1
            end
        end
        return a
    end
end

I don't think this one has inconsistent indentation, it uses tabs consistently... unless it's looking at spacing around binary operators and after commas, etc. If so, I need to update the feedback text to reflect that.

Another one that gets inconsistent indentation is this one:

class Hamming
  def self.compute(strand1, strand2)
    min = [strand1.length, strand2.length].min
    (0...min).count do |i|
      strand1[i] != strand2[i]
    end
  end
end

This one consistently uses two spaces for indentation.

I've got almost 200 examples all taken from Hamming in Ruby, so just let me know what kind of data would be useful for figuring out what to do with this.

JacobNinja commented 10 years ago

I used the wrong regular expression :/. Fixed in 284bd9e82167363981239a34476101864142e05c

Note: It's possible to have two types of feedback here: tab and inconsistent_spacing when using tabs and it's inconsistent.

kytrinyx commented 10 years ago

Yeah, if the tabs are inconsistent we should get both (or if combination of tabs and spaces, I suppose).

kytrinyx commented 10 years ago

I ran a test against 1700 submissions, and didn't get a single error. I've spot-checked some of the results, and I'm still not quite sure about the inconsistent_spacing result. I'll collect some samples and send them to you so that you have some specifics to test against.

I'm really loving where this is going!

for-loop