zmoazeni / csscss

A CSS redundancy analyzer that analyzes redundancy.
http://zmoazeni.github.io/csscss/
MIT License
2.92k stars 151 forks source link

Add line numbers and update tests #43

Closed mduvall closed 11 years ago

mduvall commented 11 years ago

Augmented the RuleSet struct to contain the metadata about the line number, would be useful to help implement https://github.com/zmoazeni/csscss/issues/39 and pass the data through redundancy_analyzer.rb.

zmoazeni commented 11 years ago

Nice! I have some issue with the implementation, but you definitely figured out the hard part. I forgot parslet returned a "slice".

zmoazeni commented 11 years ago

@mduvall I think I'm going to take this one, but I appreciate the PR. We have a file mapping issue in the case where a user runs csscss file1.css file2.css and I don't know how much I love the Metadata stuff. I think we can push this behavior into the class itself and then only deal with it in the tests when we care.

But you certainly hit the nail on the head by using Slice#line_and_column, that was the hard part about this functionality that was eluding me. The rest should be gravy. /cc @kschiess

mduvall commented 11 years ago

@zmoazeni Agreed, after some thought it seemed like it would make more sense for the data to be with the declaration, especially since the declaration is specifically on it's own line in most CSS files - thanks for the feedback again :)

zmoazeni commented 11 years ago

I'm going to close this unmerged. But I'm planning on spending some time to implement this.