inch 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +170 -56
- data/TODOS.md +0 -6
- data/config/defaults.rb +82 -0
- data/lib/inch/cli/command/base.rb +9 -0
- data/lib/inch/cli/command/base_list.rb +8 -8
- data/lib/inch/cli/command/base_object.rb +1 -1
- data/lib/inch/cli/command/list.rb +6 -1
- data/lib/inch/cli/command/options/base.rb +1 -1
- data/lib/inch/cli/command/options/suggest.rb +3 -1
- data/lib/inch/cli/command/output/list.rb +6 -6
- data/lib/inch/cli/command/output/show.rb +3 -3
- data/lib/inch/cli/command/output/stats.rb +52 -33
- data/lib/inch/cli/command/output/suggest.rb +7 -7
- data/lib/inch/cli/command/show.rb +5 -0
- data/lib/inch/cli/command/stats.rb +6 -1
- data/lib/inch/cli/command/suggest.rb +31 -12
- data/lib/inch/cli/command.rb +7 -14
- data/lib/inch/cli/command_parser.rb +2 -9
- data/lib/inch/cli/sparkline_helper.rb +13 -13
- data/lib/inch/cli/weighted_list.rb +85 -0
- data/lib/inch/cli.rb +2 -1
- data/lib/inch/code_object/nodoc_helper.rb +2 -0
- data/lib/inch/code_object/proxy/base.rb +36 -13
- data/lib/inch/code_object/proxy/method_object.rb +29 -0
- data/lib/inch/code_object/proxy/namespace_object.rb +6 -0
- data/lib/inch/config.rb +30 -37
- data/lib/inch/evaluation/base.rb +53 -1
- data/lib/inch/evaluation/constant_object.rb +8 -11
- data/lib/inch/evaluation/file.rb +1 -1
- data/lib/inch/evaluation/grade.rb +41 -0
- data/lib/inch/evaluation/grade_list.rb +32 -0
- data/lib/inch/evaluation/method_object.rb +10 -51
- data/lib/inch/evaluation/namespace_object.rb +8 -49
- data/lib/inch/evaluation/{criteria.rb → object_schema.rb} +12 -22
- data/lib/inch/evaluation/read_write_methods.rb +21 -0
- data/lib/inch/evaluation/role/method.rb +8 -0
- data/lib/inch/evaluation.rb +5 -2
- data/lib/inch/version.rb +1 -1
- data/lib/inch.rb +3 -1
- data/test/fixtures/simple/lib/broken.rb +15 -0
- data/test/fixtures/simple/lib/role_methods.rb +15 -0
- data/test/inch/cli/weighted_list_test.rb +55 -0
- data/test/inch/code_object/proxy/method_object_test.rb +42 -0
- data/test/integration/stats_options_test.rb +1 -1
- metadata +11 -5
- data/lib/inch/evaluation/score_range.rb +0 -38
| @@ -172,4 +172,46 @@ describe ::Inch::CodeObject::Proxy::MethodObject do | |
| 172 172 |  | 
| 173 173 | 
             
                assert m.score > 0
         | 
| 174 174 | 
             
              end
         | 
| 175 | 
            +
             | 
| 176 | 
            +
              def test_getter
         | 
| 177 | 
            +
                m = @source_parser.find_object("InchTest#getter")
         | 
| 178 | 
            +
                assert m.getter?, "should be a getter"
         | 
| 179 | 
            +
                refute m.setter?
         | 
| 180 | 
            +
              end
         | 
| 181 | 
            +
             | 
| 182 | 
            +
              def test_setter
         | 
| 183 | 
            +
                m = @source_parser.find_object("InchTest#attr_setter=")
         | 
| 184 | 
            +
                refute m.getter?
         | 
| 185 | 
            +
                assert m.setter?, "should be a setter"
         | 
| 186 | 
            +
              end
         | 
| 187 | 
            +
             | 
| 188 | 
            +
              def test_setter2
         | 
| 189 | 
            +
                m = @source_parser.find_object("InchTest#manual_setter=")
         | 
| 190 | 
            +
                refute m.getter?
         | 
| 191 | 
            +
                assert m.setter?, "should be a setter"
         | 
| 192 | 
            +
              end
         | 
| 193 | 
            +
             | 
| 194 | 
            +
              def test_manual_getset
         | 
| 195 | 
            +
                m = @source_parser.find_object("InchTest#manual_getset")
         | 
| 196 | 
            +
                assert m.getter?, "should be a getter"
         | 
| 197 | 
            +
                refute m.setter?
         | 
| 198 | 
            +
              end
         | 
| 199 | 
            +
             | 
| 200 | 
            +
              def test_manual_getset2
         | 
| 201 | 
            +
                m = @source_parser.find_object("InchTest#manual_getset=")
         | 
| 202 | 
            +
                refute m.getter?
         | 
| 203 | 
            +
                assert m.setter?, "should be a setter"
         | 
| 204 | 
            +
              end
         | 
| 205 | 
            +
             | 
| 206 | 
            +
              def test_attr_getset
         | 
| 207 | 
            +
                m = @source_parser.find_object("InchTest#attr_getset")
         | 
| 208 | 
            +
                assert m.getter?, "should be a getter"
         | 
| 209 | 
            +
                refute m.setter?
         | 
| 210 | 
            +
              end
         | 
| 211 | 
            +
             | 
| 212 | 
            +
              def test_attr_getset2
         | 
| 213 | 
            +
                m = @source_parser.find_object("InchTest#attr_getset=")
         | 
| 214 | 
            +
                refute m.getter?
         | 
| 215 | 
            +
                assert m.setter?, "should be a setter"
         | 
| 216 | 
            +
              end
         | 
| 175 217 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: inch
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - René Föhring
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014-02- | 
| 11 | 
            +
            date: 2014-02-07 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -112,6 +112,7 @@ files: | |
| 112 112 | 
             
            - Rakefile
         | 
| 113 113 | 
             
            - TODOS.md
         | 
| 114 114 | 
             
            - bin/inch
         | 
| 115 | 
            +
            - config/defaults.rb
         | 
| 115 116 | 
             
            - inch.gemspec
         | 
| 116 117 | 
             
            - lib/inch.rb
         | 
| 117 118 | 
             
            - lib/inch/cli.rb
         | 
| @@ -139,6 +140,7 @@ files: | |
| 139 140 | 
             
            - lib/inch/cli/command_parser.rb
         | 
| 140 141 | 
             
            - lib/inch/cli/sparkline_helper.rb
         | 
| 141 142 | 
             
            - lib/inch/cli/trace_helper.rb
         | 
| 143 | 
            +
            - lib/inch/cli/weighted_list.rb
         | 
| 142 144 | 
             
            - lib/inch/cli/yardopts_helper.rb
         | 
| 143 145 | 
             
            - lib/inch/code_object.rb
         | 
| 144 146 | 
             
            - lib/inch/code_object/docstring.rb
         | 
| @@ -159,11 +161,14 @@ files: | |
| 159 161 | 
             
            - lib/inch/evaluation/base.rb
         | 
| 160 162 | 
             
            - lib/inch/evaluation/class_object.rb
         | 
| 161 163 | 
             
            - lib/inch/evaluation/constant_object.rb
         | 
| 162 | 
            -
            - lib/inch/evaluation/criteria.rb
         | 
| 163 164 | 
             
            - lib/inch/evaluation/file.rb
         | 
| 165 | 
            +
            - lib/inch/evaluation/grade.rb
         | 
| 166 | 
            +
            - lib/inch/evaluation/grade_list.rb
         | 
| 164 167 | 
             
            - lib/inch/evaluation/method_object.rb
         | 
| 165 168 | 
             
            - lib/inch/evaluation/module_object.rb
         | 
| 166 169 | 
             
            - lib/inch/evaluation/namespace_object.rb
         | 
| 170 | 
            +
            - lib/inch/evaluation/object_schema.rb
         | 
| 171 | 
            +
            - lib/inch/evaluation/read_write_methods.rb
         | 
| 167 172 | 
             
            - lib/inch/evaluation/role/base.rb
         | 
| 168 173 | 
             
            - lib/inch/evaluation/role/constant.rb
         | 
| 169 174 | 
             
            - lib/inch/evaluation/role/method.rb
         | 
| @@ -171,7 +176,6 @@ files: | |
| 171 176 | 
             
            - lib/inch/evaluation/role/missing.rb
         | 
| 172 177 | 
             
            - lib/inch/evaluation/role/namespace.rb
         | 
| 173 178 | 
             
            - lib/inch/evaluation/role/object.rb
         | 
| 174 | 
            -
            - lib/inch/evaluation/score_range.rb
         | 
| 175 179 | 
             
            - lib/inch/rake.rb
         | 
| 176 180 | 
             
            - lib/inch/rake/suggest.rb
         | 
| 177 181 | 
             
            - lib/inch/source_parser.rb
         | 
| @@ -198,6 +202,7 @@ files: | |
| 198 202 | 
             
            - test/inch/cli/command/suggest_test.rb
         | 
| 199 203 | 
             
            - test/inch/cli/command_parser_test.rb
         | 
| 200 204 | 
             
            - test/inch/cli/trace_helper_test.rb
         | 
| 205 | 
            +
            - test/inch/cli/weighted_list_test.rb
         | 
| 201 206 | 
             
            - test/inch/cli/yardopts_helper_test.rb
         | 
| 202 207 | 
             
            - test/inch/code_object/docstring_test.rb
         | 
| 203 208 | 
             
            - test/inch/code_object/nodoc_helper_test.rb
         | 
| @@ -227,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 227 232 | 
             
                  version: '0'
         | 
| 228 233 | 
             
            requirements: []
         | 
| 229 234 | 
             
            rubyforge_project: 
         | 
| 230 | 
            -
            rubygems_version: 2.0. | 
| 235 | 
            +
            rubygems_version: 2.0.6
         | 
| 231 236 | 
             
            signing_key: 
         | 
| 232 237 | 
             
            specification_version: 4
         | 
| 233 238 | 
             
            summary: Documentation measurement tool for Ruby
         | 
| @@ -254,6 +259,7 @@ test_files: | |
| 254 259 | 
             
            - test/inch/cli/command/suggest_test.rb
         | 
| 255 260 | 
             
            - test/inch/cli/command_parser_test.rb
         | 
| 256 261 | 
             
            - test/inch/cli/trace_helper_test.rb
         | 
| 262 | 
            +
            - test/inch/cli/weighted_list_test.rb
         | 
| 257 263 | 
             
            - test/inch/cli/yardopts_helper_test.rb
         | 
| 258 264 | 
             
            - test/inch/code_object/docstring_test.rb
         | 
| 259 265 | 
             
            - test/inch/code_object/nodoc_helper_test.rb
         | 
| @@ -1,38 +0,0 @@ | |
| 1 | 
            -
            module Inch
         | 
| 2 | 
            -
              module Evaluation
         | 
| 3 | 
            -
                # ScoreRange objects associate a range of scores with a grade,
         | 
| 4 | 
            -
                # description, color etc.
         | 
| 5 | 
            -
                #
         | 
| 6 | 
            -
                # @see .new_score_ranges
         | 
| 7 | 
            -
                class ScoreRange < Struct.new(:range, :grade, :description, :color, :bg_color)
         | 
| 8 | 
            -
                  # Returns code_objects that received a score with the defined +range+
         | 
| 9 | 
            -
                  attr_reader :objects
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                  # Assigns code_objects that received a score with the defined +range+
         | 
| 12 | 
            -
                  #
         | 
| 13 | 
            -
                  # @param arr [Array<CodeObject::Proxy::Base>]
         | 
| 14 | 
            -
                  # @return [Array<CodeObject::Proxy::Base>]
         | 
| 15 | 
            -
                  def objects=(arr)
         | 
| 16 | 
            -
                    arr.each { |o| o.grade = grade }
         | 
| 17 | 
            -
                    @objects = arr
         | 
| 18 | 
            -
                  end
         | 
| 19 | 
            -
                end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                SCORE_RANGE_ARGS = [
         | 
| 22 | 
            -
                  [80..100, :A, "Seems really good", :green],
         | 
| 23 | 
            -
                  [50...80, :B, "Proper documentation present", :yellow],
         | 
| 24 | 
            -
                  [1...50,  :C, "Needs work", :red],
         | 
| 25 | 
            -
                  [0..0,    :U, "Undocumented", :color141, :color105],
         | 
| 26 | 
            -
                ]
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                # Returns newly instanciated score range objects based on 
         | 
| 29 | 
            -
                # {SCORE_RANGE_ARGS}
         | 
| 30 | 
            -
                #
         | 
| 31 | 
            -
                # @return [Array<ScoreRange>]
         | 
| 32 | 
            -
                def self.new_score_ranges
         | 
| 33 | 
            -
                  SCORE_RANGE_ARGS.map do |args|
         | 
| 34 | 
            -
                    ScoreRange.new(*args)
         | 
| 35 | 
            -
                  end
         | 
| 36 | 
            -
                end
         | 
| 37 | 
            -
              end
         | 
| 38 | 
            -
            end
         |